forked from engelsystem/engelsystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployment.tpl.yaml
206 lines (201 loc) · 4.94 KB
/
deployment.tpl.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: engelsystem-db
labels:
app: <CI_PROJECT_PATH_SLUG>
environment: <CI_ENVIRONMENT_SLUG>
spec:
accessModes:
- ReadWriteOnce
storageClassName: <CI_PVC_SC>
resources:
requests:
storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: database
labels:
app: <CI_PROJECT_PATH_SLUG>
environment: <CI_ENVIRONMENT_SLUG>
spec:
replicas: 1
selector:
matchLabels:
app: <CI_PROJECT_PATH_SLUG>
environment: <CI_ENVIRONMENT_SLUG>
template:
metadata:
labels:
app: <CI_PROJECT_PATH_SLUG>
environment: <CI_ENVIRONMENT_SLUG>
tier: database
spec:
containers:
- image: mariadb:10.2
name: database
imagePullPolicy: Always
env:
- name: MYSQL_DATABASE
value: engelsystem
- name: MYSQL_USER
value: engelsystem
- name: MYSQL_PASSWORD
value: engelsystem
- name: MYSQL_RANDOM_ROOT_PASSWORD
value: '1'
- name: MYSQL_INITDB_SKIP_TZINFO
value: 'yes'
volumeMounts:
- mountPath: /var/lib/mysql
name: data
volumes:
- name: data
persistentVolumeClaim:
claimName: engelsystem-db
---
apiVersion: v1
kind: Service
metadata:
name: database
labels:
app: <CI_PROJECT_PATH_SLUG>
environment: <CI_ENVIRONMENT_SLUG>
spec:
type: ClusterIP
ports:
- port: 3306
targetPort: 3306
name: database
selector:
app: <CI_PROJECT_PATH_SLUG>
environment: <CI_ENVIRONMENT_SLUG>
tier: database
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: engelsystem
labels:
app: <CI_PROJECT_PATH_SLUG>
environment: <CI_ENVIRONMENT_SLUG>
commit: '<CI_COMMIT_SHORT_SHA>'
spec:
replicas: <CI_REPLICAS>
selector:
matchLabels:
app: <CI_PROJECT_PATH_SLUG>
environment: <CI_ENVIRONMENT_SLUG>
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
template:
metadata:
labels:
app: <CI_PROJECT_PATH_SLUG>
environment: <CI_ENVIRONMENT_SLUG>
tier: application
commit: '<CI_COMMIT_SHORT_SHA>'
pipeline: '<CI_PIPELINE_ID>'
annotations:
app.gitlab.com/app: <CI_PROJECT_PATH_SLUG>
app.gitlab.com/env: <CI_ENVIRONMENT_SLUG>
commit: '<CI_COMMIT_SHORT_SHA>'
spec:
initContainers:
- image: <CI_IMAGE>
name: engelsystem-migrate
imagePullPolicy: Always
command:
- sh
- -c
- while ! bin/migrate up; do sleep 1; done
env:
- name: MYSQL_HOST
value: database
- name: MYSQL_DATABASE
value: engelsystem
- name: MYSQL_USER
value: engelsystem
- name: MYSQL_PASSWORD
value: engelsystem
- name: SETUP_ADMIN_PASSWORD
value: '<CI_SETUP_ADMIN_PASSWORD>'
containers:
- image: <CI_IMAGE>
name: engelsystem-server
imagePullPolicy: Always
env:
- name: MYSQL_HOST
value: database
- name: MYSQL_DATABASE
value: engelsystem
- name: MYSQL_USER
value: engelsystem
- name: MYSQL_PASSWORD
value: engelsystem
- name: APP_URL
value: <CI_ENVIRONMENT_URL>
- name: APP_NAME
value: '<CI_APP_NAME>'
livenessProbe:
httpGet:
path: /health
port: 80
---
apiVersion: v1
kind: Service
metadata:
name: engelsystem
labels:
app: <CI_PROJECT_PATH_SLUG>
environment: <CI_ENVIRONMENT_SLUG>
annotations:
prometheus.io/port: '80'
prometheus.io/scrape: 'true'
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
name: engelsystem
selector:
app: <CI_PROJECT_PATH_SLUG>
environment: <CI_ENVIRONMENT_SLUG>
tier: application
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: engelsystem-ingress
annotations:
kubernetes.io/tls-acme: 'true'
kubernetes.io/ingress.class: <CI_INGRESS_CLASS>
cert-manager.io/cluster-issuer: <CI_CLUSTER_ISSUER>
nginx.ingress.kubernetes.io/rewrite-target: /$1
traefik.ingress.kubernetes.io/router.entrypoints: <CI_INGRESS_TRAEFIK_ENTRYPOINT>
traefik.ingress.kubernetes.io/router.tls: 'true'
labels:
app: <CI_PROJECT_PATH_SLUG>
environment: <CI_ENVIRONMENT_SLUG>
spec:
tls:
- hosts:
- <CI_INGRESS_DOMAIN>
secretName: <CI_INGRESS_DOMAIN>
rules:
- host: <CI_INGRESS_DOMAIN>
http:
paths:
- path: '<CI_INGRESS_PATH><CI_INGRESS_MATCH>'
pathType: Prefix
backend:
service:
name: engelsystem
port:
number: 80