forked from GoogleCloudPlatform/fda-mystudies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtf-deployment.yaml
130 lines (130 loc) · 4.25 KB
/
tf-deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Copyright 2020 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
apiVersion: apps/v1
kind: Deployment
metadata:
name: study-datastore
labels:
app: study-datastore
spec:
replicas: 1
selector:
matchLabels:
app: study-datastore
template:
metadata:
labels:
app: study-datastore
annotations:
sidecar.istio.io/inject: "true"
spec:
containers:
- name: study-datastore
image: gcr.io/<PREFIX>-<ENV>-apps/study-datastore:latest
env:
# DB ACCESS
- name: DB_USER
valueFrom:
secretKeyRef:
name: study-datastore-credentials
key: dbusername
- name: DB_PASS
valueFrom:
secretKeyRef:
name: study-datastore-credentials
key: dbpassword
- name: DB_NAME
valueFrom:
secretKeyRef:
name: study-datastore-credentials
key: dbname
- name: DB_INSTANCE_URL
value: "127.0.0.1"
# SERVER CALLS
- name: PARTICIPANT_USER_DATASTORE_URL
value: "http://participant-user-datastore-np:50000/participant-user-datastore"
- name: RESPONSE_DATASTORE_APP_TOKEN
valueFrom:
secretKeyRef:
name: study-datastore-connect-credentials
key: response_datastore_token
- name: RESPONSE_SERVER_BUNDLE_ID
valueFrom:
secretKeyRef:
name: study-datastore-connect-credentials
key: response_datastore_id
- name: ANDROID_APP_TOKEN
valueFrom:
secretKeyRef:
name: study-datastore-connect-credentials
key: android_token
- name: ANDROID_BUNDLE_ID
valueFrom:
secretKeyRef:
name: study-datastore-connect-credentials
key: android_id
- name: IOS_APP_TOKEN
valueFrom:
secretKeyRef:
name: study-datastore-connect-credentials
key: ios_token
- name: IOS_BUNDLE_ID
valueFrom:
secretKeyRef:
name: study-datastore-connect-credentials
key: ios_id
# MISC
- name: STUDY_DATASTORE_BASE_URL
valueFrom:
secretKeyRef:
name: shared-secrets
key: studies_base_url
- name: TERMS_AND_CONDITION_URL
valueFrom:
secretKeyRef:
name: shared-secrets
key: terms_url
- name: PRIVACY_POLICY_URL
valueFrom:
secretKeyRef:
name: shared-secrets
key: privacy_url
- name: GCP_BUCKET_NAME
valueFrom:
secretKeyRef:
name: shared-secrets
key: study_resources_bucket_name
- name: GOOGLE_APPLICATION_CREDENTIALS
value: "/secrets/gcloud_key/key.json"
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /study-datastore/healthCheck
port: 8080
initialDelaySeconds: 180
periodSeconds: 20
resources:
requests:
memory: "400Mi"
cpu: "50m"
volumeMounts:
- name: gcloud-key-volume
mountPath: /secrets/gcloud_key
readOnly: true
- name: cloudsql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:latest
command: ["/cloud_sql_proxy",
"-instances=<PREFIX>-<ENV>-data:<LOCATION>:mystudies=tcp:3306",
"-credential_file=/secrets/gcloud_key/key.json"]
volumeMounts:
- name: gcloud-key-volume
mountPath: /secrets/gcloud_key
readOnly: true
volumes:
- name: gcloud-key-volume
secret:
secretName: study-datastore-gke-sa-gcloud-key