-
Notifications
You must be signed in to change notification settings - Fork 15
/
rstudio-template.yaml
441 lines (434 loc) · 10.7 KB
/
rstudio-template.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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
apiVersion: template.openshift.io/v1
kind: Template
labels:
app: rstudio
template: rstudio
message: |-
RStudio Server has been scheduled for creation in your project, and should be soon available at: https://${NAME}.${APPLICATION_DOMAIN_SUFFIX}
* User: ${USER}
* Password: ${PASSWORD}
Building images takes some minutes to complete, so please be patient. You can follow progress on your projects overview page.
metadata:
annotations:
description: This template deploys RStudio Server with Shiny package.
iconClass: fa fa-bar-chart
openshift.io/display-name: RStudio
openshift.io/documentation-url: https://github.com/CSCfi/rstudio-openshift
openshift.io/support-url: https://www.csc.fi/contact-info
openshift.io/long-description:
openshift.io/provider-display-name: CSC
tags: rstudio
template.openshift.io/bindable: "false"
name: rstudio
objects:
- apiVersion: v1
kind: Route
metadata:
name: rstudio-route
annotations:
template.openshift.io/expose-uri: http://{.spec.host}
spec:
host: ${NAME}.${APPLICATION_DOMAIN_SUFFIX}
path: /
to:
kind: Service
name: nginx-okd
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
- apiVersion: v1
kind: Route
metadata:
name: shiny-route
annotations:
template.openshift.io/expose-uri: http://{.spec.host}
spec:
host: ${NAME}-shiny.${APPLICATION_DOMAIN_SUFFIX}
path: /
to:
kind: Service
name: shiny-server
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
- apiVersion: v1
data:
default.conf: |
server {
listen 8081;
server_name ${NAME}.${APPLICATION_DOMAIN_SUFFIX};
location / {
root /usr/share/nginx/html;
index index.html index.htm;
auth_basic \"Rstudio\";
auth_basic_user_file /etc/nginx/secret/htpasswd;
proxy_pass http://rstudio:8787/;
proxy_set_header Host $http_host;
client_max_body_size 2000M;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
kind: ConfigMap
metadata:
name: nginx-default
- apiVersion: v1
stringData:
USER: ${USER}
PASSWORD: ${PASSWORD}
kind: Secret
metadata:
name: nginx-password
type: Opaque
- apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx-okd
name: nginx-okd
spec:
selector:
matchLabels:
app: nginx-okd
deployment: nginx-okd
strategy:
type: Recreate
template:
metadata:
labels:
app: nginx-okd
deployment: nginx-okd
name: nginx-okd
spec:
containers:
- image: cscfi/nginx-okd:secret
name: nginx-okd
command:
- sh
- -xc
- >-
htpasswd -bc /etc/nginx/secret/htpasswd $USER $PASSWORD;
/docker-entrypoint.sh nginx -g "daemon off;"
env:
- name: USER
valueFrom:
secretKeyRef:
key: USER
name: nginx-password
- name: PASSWORD
valueFrom:
secretKeyRef:
key: PASSWORD
name: nginx-password
ports:
- containerPort: 8081
protocol: TCP
volumeMounts:
- mountPath: /etc/nginx/conf.d/
name: nginx-default
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- configMap:
defaultMode: 420
name: nginx-default
name: nginx-default
- name: nginx-password
secret:
defaultMode: 420
secretName: nginx-password
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
labels:
app: rstudio
name: rstudio
spec:
replicas: 1
selector:
app: rstudio
deploymentconfig: rstudio
strategy:
activeDeadlineSeconds: 21600
resources: {}
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
type: Rolling
template:
metadata:
labels:
app: rstudio
deploymentconfig: rstudio
spec:
containers:
- image: rstudio:latest
imagePullPolicy: Always
name: rstudio
ports:
- containerPort: 8787
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /srv/shiny-server
name: shiny-server
- mountPath: /home
name: rstudio-home
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: shiny-server
persistentVolumeClaim:
claimName: shiny-server
- name: rstudio-home
persistentVolumeClaim:
claimName: rstudio-home
test: false
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- rstudio
from:
kind: ImageStreamTag
name: rstudio:latest
type: ImageChange
status: {}
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
labels:
app: shiny-server
name: shiny-server
spec:
replicas: 1
selector:
app: shiny-server
deploymentconfig: shiny-server
strategy:
activeDeadlineSeconds: 21600
resources: {}
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
type: Rolling
template:
metadata:
labels:
app: shiny-server
deploymentconfig: shiny-server
spec:
containers:
- command:
- /start.sh
- shiny-server
image: rstudio:latest
imagePullPolicy: Always
name: shiny-server
ports:
- containerPort: 3838
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /srv/shiny-server
name: shiny-server
- mountPath: /home
name: rstudio-home
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: shiny-server
persistentVolumeClaim:
claimName: shiny-server
- name: rstudio-home
persistentVolumeClaim:
claimName: rstudio-home
test: false
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- shiny-server
from:
kind: ImageStreamTag
name: rstudio:latest
type: ImageChange
status: {}
- apiVersion: v1
kind: ImageStream
metadata:
annotations:
description: Keeps track of changes in the appliation image
name: rstudio
- apiVersion: v1
kind: BuildConfig
metadata:
name: rstudio
annotations:
description: Defines how to build the application
template.alpha.openshift.io/wait-for-ready: "true"
spec:
source:
type: Git
git:
uri: https://github.com/CSCfi/rstudio-openshift.git
ref: ${SOURCE_REPOSITORY_REF}
contextDir: server
strategy:
dockerStrategy:
env:
- name: "USERNAME"
value: ${USERNAME}
- name: "PASSWORD"
value: ${PASSWORD}
- name: "NAME"
value: ${NAME}
output:
to:
kind: ImageStreamTag
name: rstudio:latest
triggers:
- type: ImageChange
- type: ConfigChange
- github:
secretReference:
name: webhooksecret
type: GitHub
- apiVersion: v1
kind: Service
metadata:
labels:
app: nginx-okd
name: nginx-okd
spec:
ports:
- name: 8081-tcp
port: 8081
protocol: TCP
targetPort: 8081
selector:
deployment: nginx-okd
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
- apiVersion: v1
kind: Service
metadata:
labels:
app: rstudio
name: rstudio
spec:
ports:
- name: 8787-tcp
port: 8787
protocol: TCP
targetPort: 8787
selector:
deploymentconfig: rstudio
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
- apiVersion: v1
kind: Service
metadata:
labels:
app: shiny-server
name: shiny-server
spec:
ports:
- name: 3838-tcp
port: 3838
protocol: TCP
targetPort: 3838
selector:
deploymentconfig: shiny-server
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: shiny-server
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: ${STORAGE_SIZE}
storageClassName: glusterfs-storage
status: {}
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: rstudio-home
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: ${STORAGE_SIZE_TMP}
storageClassName: glusterfs-storage
status: {}
####################
parameters:
- description: Unique identifier for your application. Recommended value - your username
displayName: Application Name
name: NAME
required: true
- description: Username for logigng into RStudio
displayName: Username
name: USER
required: true
value: rstudio
- description: Password for logging into Rstudio
displayName: Pasword
name: PASSWORD
required: true
generate: expression
from: "[a-zA-Z0-9]{12}"
- description: Persistent Storage Size
displayName: Storage Size for Shiny
name: STORAGE_SIZE
required: true
value: 1Gi
- description: Persistent Storage Size
displayName: Storage Size for Rstudio work folder
name: STORAGE_SIZE_TMP
required: true
value: 1Gi
- description: The exposed hostname suffix that will be used to create routes for app
displayName: Application Hostname Suffix
name: APPLICATION_DOMAIN_SUFFIX
required: true
value: rahtiapp.fi
- description: The branch of the source repository (master, dev).
displayName: Source Repository Branch
name: SOURCE_REPOSITORY_REF
value: master
required: true