This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodejs-mongodb-binary-src.yaml
277 lines (277 loc) · 7.54 KB
/
nodejs-mongodb-binary-src.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
kind: "Template"
apiVersion: "v1"
metadata:
name: "nodejs-mongodb-binary-src"
creationTimestamp: null
annotations:
description: "An Node.js application from binary source input with a MongoDB database"
iconClass: "icon-nodejs"
tags: "instant-app,nodejs,mongodb"
objects:
-
kind: "BuildConfig"
apiVersion: "v1"
metadata:
name: "nodejs-mongodb-binary-src"
annotations:
description: "Defines how to build the application"
spec:
source:
type: "Binary"
binary:
asFile: "webapp.tar"
contextDir: "${CONTEXT_DIR}"
strategy:
type: "Source"
sourceStrategy:
from:
kind: "ImageStreamTag"
name: "${APPLICATION_NAME}-builder-image:${NODE_VERSION}"
incremental: true
output:
to:
kind: "ImageStreamTag"
name: "nodejs-mongodb-binary-src:latest"
-
kind: "ImageStream"
apiVersion: "v1"
metadata:
name: "nodejs-mongodb-binary-src"
annotations:
description: "Keeps track of changes in the application image"
-
kind: "ImageStream"
apiVersion: "v1"
metadata:
name: "${APPLICATION_NAME}-builder-image"
spec:
dockerImageRepository: "${BUILDER_IMAGE}"
-
kind: "PersistentVolumeClaim"
apiVersion: "v1"
metadata:
name: "${DATABASE_SERVICE_NAME}"
spec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: "${VOLUME_CAPACITY}"
-
kind: "DeploymentConfig"
apiVersion: "v1"
metadata:
name: "nodejs-mongodb-binary-src"
annotations:
description: "Defines how to deploy the application server"
spec:
strategy:
type: "Rolling"
triggers:
-
type: "ImageChange"
imageChangeParams:
automatic: true
containerNames:
- "nodejs-mongodb-binary-src"
from:
kind: "ImageStreamTag"
name: "nodejs-mongodb-binary-src:latest"
-
type: "ConfigChange"
replicas: 1
selector:
name: "nodejs-mongodb-binary-src"
template:
metadata:
name: "nodejs-mongodb-binary-src"
labels:
name: "nodejs-mongodb-binary-src"
spec:
containers:
-
name: "nodejs-mongodb-binary-src"
image: "nodejs-mongodb-binary-src"
ports:
-
containerPort: 8080
env:
-
name: NODE_ENV
value: production
-
name: "DATABASE_SERVICE_NAME"
value: "${DATABASE_SERVICE_NAME}"
-
name: "MONGODB_USER"
value: "${DATABASE_USER}"
-
name: "MONGODB_PASSWORD"
value: "${DATABASE_PASSWORD}"
-
name: "MONGODB_DATABASE"
value: "${DATABASE_NAME}"
-
name: "MONGODB_ADMIN_PASSWORD"
value: "${DATABASE_ADMIN_PASSWORD}"
-
apiVersion: v1
kind: DeploymentConfig
metadata:
name: "${DATABASE_SERVICE_NAME}"
annotations:
description: "Defines how to deploy the database"
spec:
replicas: 1
selector:
name: ${DATABASE_SERVICE_NAME}
strategy:
type: Recreate
template:
metadata:
creationTimestamp: null
labels:
name: ${DATABASE_SERVICE_NAME}
spec:
containers:
- capabilities: {}
env:
- name: MONGODB_USER
value: ${DATABASE_USER}
- name: MONGODB_PASSWORD
value: ${DATABASE_PASSWORD}
- name: MONGODB_DATABASE
value: ${DATABASE_NAME}
- name: MONGODB_ADMIN_PASSWORD
value: ${DATABASE_ADMIN_PASSWORD}
image: mongodb
imagePullPolicy: IfNotPresent
name: mongodb
ports:
- containerPort: 27017
protocol: TCP
readinessProbe:
initialDelaySeconds: 15
tcpSocket:
port: 27017
timeoutSeconds: 1
securityContext:
capabilities: {}
privileged: false
terminationMessagePath: /dev/termination-log
volumeMounts:
- mountPath: /var/lib/mongodb/data
name: ${DATABASE_SERVICE_NAME}-data
dnsPolicy: ClusterFirst
restartPolicy: Always
volumes:
- name: ${DATABASE_SERVICE_NAME}-data
persistentVolumeClaim:
claimName: ${DATABASE_SERVICE_NAME}
triggers:
- imageChangeParams:
automatic: true
containerNames:
- mongodb
from:
kind: ImageStreamTag
name: mongodb:latest
namespace: openshift
lastTriggeredImage: ""
type: ImageChange
- type: ConfigChange
-
kind: "Service"
apiVersion: "v1"
metadata:
name: "${APPLICATION_NAME}"
annotations:
description: "Exposes and load balances the application pods"
spec:
ports:
-
name: "web"
port: 8080
targetPort: "${APPLICATION_INTERNAL_PORT}"
selector:
name: "nodejs-mongodb-binary-src"
-
kind: "Service"
apiVersion: "v1"
metadata:
name: "${DATABASE_SERVICE_NAME}"
annotations:
description: "Exposes the database server"
spec:
ports:
-
name: "mongodb"
port: 27017
targetPort: 27017
selector:
name: "${DATABASE_SERVICE_NAME}"
-
kind: "Route"
apiVersion: "v1"
metadata:
name: "nodejs-mongodb-binary-src"
spec:
host: "${APPLICATION_DOMAIN}"
to:
kind: "Service"
name: "nodejs-mongodb-binary-src"
parameters:
-
name: "APPLICATION_NAME"
description: "Name of the application"
required: true
-
name: "BUILDER_IMAGE"
description: "Node builder image"
value: "node"
required: true
-
name: "NODE_VERSION"
description: "Tag of node builder image. See https://hub.docker.com/_/node/"
value: "onbuild"
required: true
-
name: "CONTEXT_DIR"
description: "Set this to the relative path to your project if it is not in the root of your repository"
-
name: "APPLICATION_DOMAIN"
description: "The exposed hostname that will route to the Node.js service, if left blank a value will be defaulted."
-
name: "APPLICATION_INTERNAL_PORT"
description: "The exposed port of Node.js service."
-
name: "DATABASE_SERVICE_NAME"
description: "Database service name"
value: "mongodb"
-
name: "DATABASE_USER"
description: "Username for MongoDB user that will be used for accessing the database"
generate: "expression"
from: "user[A-Z0-9]{3}"
-
name: "DATABASE_PASSWORD"
description: "Password for the MongoDB user"
generate: "expression"
from: "[a-zA-Z0-9]{16}"
-
name: "DATABASE_NAME"
description: "Database name"
value: "sampledb"
-
name: "DATABASE_ADMIN_PASSWORD"
description: "Password for the database admin user"
generate: "expression"
from: "[a-zA-Z0-9]{16}"
-
name: "VOLUME_CAPACITY"
displayName: "Volume capacity"
description: "Volume space available for data, e.g. 512Mi, 2Gi"
value: "512Mi"
required: true
labels:
template: "nodejs-mongodb-binary-src"