-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeploy.yaml
212 lines (205 loc) · 4.89 KB
/
deploy.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
207
208
209
210
211
212
## Preparatory steps for installation
## Creating a database and a user
## Before these steps, the DB host must be configured
##
---
apiVersion: batch/v1
kind: Job
metadata:
name: init-db
spec:
backoffLimit: 2
template:
spec:
volumes:
- name: init-db
configMap:
name: init-db
defaultMode: 0755
containers:
- name: init-db
image: postgres
env:
- name: DB_PWD
valueFrom:
secretKeyRef:
name: postgresql
key: postgres-password
envFrom:
- secretRef:
name: init-db
volumeMounts:
- name: init-db
mountPath: /sql/init_db.sh
subPath: init_db.sh
command: ["/bin/sh", "-c"]
args: ["/sql/init_db.sh"]
restartPolicy: Never
---
apiVersion: v1
kind: ConfigMap
metadata:
name: init-db
data:
init_db.sh: |-
#!/bin/bash
PGPASSWORD=$DB_PWD psql -U postgres -h ${CONFLUENCE_DB_HOST} << EOF
create database ${CONFLUENCE_DB_NAME};
CREATE USER ${DB_USER_NAME} WITH PASSWORD '${DB_USER_PWD}';
GRANT ALL PRIVILEGES ON DATABASE "${CONFLUENCE_DB_NAME}" to ${DB_USER_NAME};
EOF
---
apiVersion: v1
kind: Secret
metadata:
name: init-db
type: Opaque
stringData:
CONFLUENCE_DB_HOST: postgresql
CONFLUENCE_DB_NAME: confluencecloud
DB_USER_NAME: confluencecloud
DB_USER_PWD: confluence_secret_password
## Deploying the connector
##
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: onlyoffice-confluence-cloud
labels:
app: onlyoffice-confluence-cloud
spec:
replicas: 2
selector:
matchLabels:
app: onlyoffice-confluence-cloud
strategy:
type: Recreate
template:
metadata:
labels:
app: onlyoffice-confluence-cloud
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- onlyoffice-confluence-cloud
topologyKey: kubernetes.io/hostname
weight: 100
containers:
- name: onlyoffice-confluence-cloud
image: onlyoffice/confluence-cloud:latest
imagePullPolicy: IfNotPresent
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "200m"
ports:
- containerPort: 3000
name: http
envFrom:
- configMapRef:
name: confluence-cloud-env
volumeMounts:
- name: confluence-cloud-config
mountPath: /usr/src/app/config.json
subPath: config.json
volumes:
- name: confluence-cloud-config
configMap:
name: confluence-cloud-config
---
apiVersion: v1
kind: ConfigMap
metadata:
name: confluence-cloud-config
data:
config.json: |-
{
"development": {
"port": "$PORT",
"errorTemplate": true,
"store": {
"adapter": "sequelize",
"dialect": "sqlite3",
"logging": false,
"type": "memory"
},
},
"production": {
"port": "$PORT",
"errorTemplate": true,
"localBaseUrl": "$AC_LOCAL_BASE_URL",
"store": {
"adapter": "sequelize",
"type": "postgres",
"url": "$DATABASE_URL"
},
"whitelist": [
"*.jira-dev.com",
"*.atlassian.net",
"*.atlassian.com",
"*.jira.com"
]
},
"product": "confluence",
"docServer": {
"default": {
"adress": "https://docserver-example.com/",
"secret": "secret",
"authorizationHeader": "Authorization"
}
}
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: confluence-cloud-env
data:
AC_OPTS: no-reg
NODE_ENV: production
AC_LOCAL_BASE_URL: https://onlyoffice-confluence-cloud.example.com
DATABASE_URL: postgres://user:password@postgresql:5432/db_name
---
apiVersion: v1
kind: Service
metadata:
name: onlyoffice-confluence-cloud
spec:
ports:
- port: 3000
name: http
targetPort: 3000
selector:
app: onlyoffice-confluence-cloud
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: onlyoffice-confluence-cloud
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/proxy-body-size: 100m
spec:
rules:
- host: onlyoffice-confluence-cloud.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: onlyoffice-confluence-cloud
port:
number: 3000