|
| 1 | +{ |
| 2 | + "kind": "Template", |
| 3 | + "apiVersion": "v1", |
| 4 | + "metadata": { |
| 5 | + "name": "nodejs-mongodb-example", |
| 6 | + "annotations": { |
| 7 | + "description": "An example Node.js application with a MongoDB database", |
| 8 | + "tags": "instant-app,nodejs,mongodb", |
| 9 | + "iconClass": "icon-nodejs" |
| 10 | + } |
| 11 | + }, |
| 12 | + "labels": { |
| 13 | + "template": "nodejs-mongodb-example" |
| 14 | + }, |
| 15 | + "objects": [ |
| 16 | + { |
| 17 | + "kind": "Service", |
| 18 | + "apiVersion": "v1", |
| 19 | + "metadata": { |
| 20 | + "name": "nodejs-frontend", |
| 21 | + "annotations": { |
| 22 | + "description": "Exposes and load balances the application pods" |
| 23 | + } |
| 24 | + }, |
| 25 | + "spec": { |
| 26 | + "ports": [ |
| 27 | + { |
| 28 | + "name": "web", |
| 29 | + "port": 8080, |
| 30 | + "targetPort": 8080 |
| 31 | + } |
| 32 | + ], |
| 33 | + "selector": { |
| 34 | + "name": "nodejs-frontend" |
| 35 | + } |
| 36 | + } |
| 37 | + }, |
| 38 | + { |
| 39 | + "kind": "Route", |
| 40 | + "apiVersion": "v1", |
| 41 | + "metadata": { |
| 42 | + "name": "nodejs-route" |
| 43 | + }, |
| 44 | + "spec": { |
| 45 | + "host": "${APPLICATION_DOMAIN}", |
| 46 | + "to": { |
| 47 | + "kind": "Service", |
| 48 | + "name": "nodejs-frontend" |
| 49 | + } |
| 50 | + } |
| 51 | + }, |
| 52 | + { |
| 53 | + "kind": "ImageStream", |
| 54 | + "apiVersion": "v1", |
| 55 | + "metadata": { |
| 56 | + "name": "nodejs-example", |
| 57 | + "annotations": { |
| 58 | + "description": "Keeps track of changes in the application image" |
| 59 | + } |
| 60 | + } |
| 61 | + }, |
| 62 | + { |
| 63 | + "kind": "BuildConfig", |
| 64 | + "apiVersion": "v1", |
| 65 | + "metadata": { |
| 66 | + "name": "nodejs-example", |
| 67 | + "annotations": { |
| 68 | + "description": "Defines how to build the application" |
| 69 | + } |
| 70 | + }, |
| 71 | + "spec": { |
| 72 | + "source": { |
| 73 | + "type": "Git", |
| 74 | + "git": { |
| 75 | + "uri": "${SOURCE_REPOSITORY_URL}", |
| 76 | + "ref": "${SOURCE_REPOSITORY_REF}" |
| 77 | + }, |
| 78 | + "contextDir": "${CONTEXT_DIR}" |
| 79 | + }, |
| 80 | + "strategy": { |
| 81 | + "type": "Source", |
| 82 | + "sourceStrategy": { |
| 83 | + "from": { |
| 84 | + "kind": "ImageStreamTag", |
| 85 | + "namespace": "openshift", |
| 86 | + "name": "nodejs:0.10" |
| 87 | + } |
| 88 | + } |
| 89 | + }, |
| 90 | + "output": { |
| 91 | + "to": { |
| 92 | + "kind": "ImageStreamTag", |
| 93 | + "name": "nodejs-example:latest" |
| 94 | + } |
| 95 | + }, |
| 96 | + "triggers": [ |
| 97 | + { |
| 98 | + "type": "ImageChange" |
| 99 | + }, |
| 100 | + { |
| 101 | + "type": "GitHub", |
| 102 | + "github": { |
| 103 | + "secret": "${GITHUB_WEBHOOK_SECRET}" |
| 104 | + } |
| 105 | + } |
| 106 | + ] |
| 107 | + } |
| 108 | + }, |
| 109 | + { |
| 110 | + "kind": "DeploymentConfig", |
| 111 | + "apiVersion": "v1", |
| 112 | + "metadata": { |
| 113 | + "name": "nodejs-frontend", |
| 114 | + "annotations": { |
| 115 | + "description": "Defines how to deploy the application server" |
| 116 | + } |
| 117 | + }, |
| 118 | + "spec": { |
| 119 | + "strategy": { |
| 120 | + "type": "Rolling" |
| 121 | + }, |
| 122 | + "triggers": [ |
| 123 | + { |
| 124 | + "type": "ImageChange", |
| 125 | + "imageChangeParams": { |
| 126 | + "automatic": true, |
| 127 | + "containerNames": [ |
| 128 | + "nodejs-example" |
| 129 | + ], |
| 130 | + "from": { |
| 131 | + "kind": "ImageStreamTag", |
| 132 | + "name": "nodejs-example:latest" |
| 133 | + } |
| 134 | + } |
| 135 | + }, |
| 136 | + { |
| 137 | + "type": "ConfigChange" |
| 138 | + } |
| 139 | + ], |
| 140 | + "replicas": 1, |
| 141 | + "selector": { |
| 142 | + "name": "nodejs-frontend" |
| 143 | + }, |
| 144 | + "template": { |
| 145 | + "metadata": { |
| 146 | + "name": "nodejs-frontend", |
| 147 | + "labels": { |
| 148 | + "name": "nodejs-frontend" |
| 149 | + } |
| 150 | + }, |
| 151 | + "spec": { |
| 152 | + "containers": [ |
| 153 | + { |
| 154 | + "name": "nodejs-example", |
| 155 | + "image": "nodejs-example", |
| 156 | + "ports": [ |
| 157 | + { |
| 158 | + "containerPort": 8080 |
| 159 | + } |
| 160 | + ], |
| 161 | + "env": [ |
| 162 | + { |
| 163 | + "name": "MONGODB_USER", |
| 164 | + "value": "${MONGODB_USER}" |
| 165 | + }, |
| 166 | + { |
| 167 | + "name": "MONGODB_PASSWORD", |
| 168 | + "value": "${MONGODB_PASSWORD}" |
| 169 | + }, |
| 170 | + { |
| 171 | + "name": "MONGODB_DATABASE", |
| 172 | + "value": "${MONGODB_DATABASE}" |
| 173 | + }, |
| 174 | + { |
| 175 | + "name": "MONGODB_ADMIN_PASSWORD", |
| 176 | + "value": "${MONGODB_ADMIN_PASSWORD}" |
| 177 | + } |
| 178 | + ] |
| 179 | + } |
| 180 | + ] |
| 181 | + } |
| 182 | + } |
| 183 | + } |
| 184 | + }, |
| 185 | + { |
| 186 | + "kind": "Service", |
| 187 | + "apiVersion": "v1", |
| 188 | + "metadata": { |
| 189 | + "name": "${DATABASE_SERVICE_NAME}", |
| 190 | + "annotations": { |
| 191 | + "description": "Exposes the database server" |
| 192 | + } |
| 193 | + }, |
| 194 | + "spec": { |
| 195 | + "ports": [ |
| 196 | + { |
| 197 | + "name": "mongodb", |
| 198 | + "port": 27017, |
| 199 | + "targetPort": 27017 |
| 200 | + } |
| 201 | + ], |
| 202 | + "selector": { |
| 203 | + "name": "${DATABASE_SERVICE_NAME}" |
| 204 | + } |
| 205 | + } |
| 206 | + }, |
| 207 | + { |
| 208 | + "kind": "DeploymentConfig", |
| 209 | + "apiVersion": "v1", |
| 210 | + "metadata": { |
| 211 | + "name": "${DATABASE_SERVICE_NAME}", |
| 212 | + "annotations": { |
| 213 | + "description": "Defines how to deploy the database" |
| 214 | + } |
| 215 | + }, |
| 216 | + "spec": { |
| 217 | + "strategy": { |
| 218 | + "type": "Recreate" |
| 219 | + }, |
| 220 | + "triggers": [ |
| 221 | + { |
| 222 | + "type": "ConfigChange" |
| 223 | + } |
| 224 | + ], |
| 225 | + "replicas": 1, |
| 226 | + "selector": { |
| 227 | + "name": "${DATABASE_SERVICE_NAME}" |
| 228 | + }, |
| 229 | + "template": { |
| 230 | + "metadata": { |
| 231 | + "name": "${DATABASE_SERVICE_NAME}", |
| 232 | + "labels": { |
| 233 | + "name": "${DATABASE_SERVICE_NAME}" |
| 234 | + } |
| 235 | + }, |
| 236 | + "spec": { |
| 237 | + "containers": [ |
| 238 | + { |
| 239 | + "name": "mongodb", |
| 240 | + "image": "openshift/mongodb-24-centos7", |
| 241 | + "ports": [ |
| 242 | + { |
| 243 | + "containerPort": 27017 |
| 244 | + } |
| 245 | + ], |
| 246 | + "env": [ |
| 247 | + { |
| 248 | + "name": "MONGODB_USER", |
| 249 | + "value": "${MONGODB_USER}" |
| 250 | + }, |
| 251 | + { |
| 252 | + "name": "MONGODB_PASSWORD", |
| 253 | + "value": "${MONGODB_PASSWORD}" |
| 254 | + }, |
| 255 | + { |
| 256 | + "name": "MONGODB_DATABASE", |
| 257 | + "value": "${MONGODB_DATABASE}" |
| 258 | + }, |
| 259 | + { |
| 260 | + "name": "MONGODB_ADMIN_PASSWORD", |
| 261 | + "value": "${MONGODB_ADMIN_PASSWORD}" |
| 262 | + } |
| 263 | + ] |
| 264 | + } |
| 265 | + ] |
| 266 | + } |
| 267 | + } |
| 268 | + } |
| 269 | + } |
| 270 | + ], |
| 271 | + "parameters": [ |
| 272 | + { |
| 273 | + "name": "SOURCE_REPOSITORY_URL", |
| 274 | + "description": "The URL of the repository with your application source code", |
| 275 | + "value": "https://github.com/openshift/nodejs-ex.git" |
| 276 | + }, |
| 277 | + { |
| 278 | + "name": "SOURCE_REPOSITORY_REF", |
| 279 | + "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch" |
| 280 | + }, |
| 281 | + { |
| 282 | + "name": "CONTEXT_DIR", |
| 283 | + "description": "Set this to the relative path to your project if it is not in the root of your repository" |
| 284 | + }, |
| 285 | + { |
| 286 | + "name": "APPLICATION_DOMAIN", |
| 287 | + "description": "The exposed hostname that will route to the Node.js service", |
| 288 | + "value": "nodejs-example.openshiftapps.com" |
| 289 | + }, |
| 290 | + { |
| 291 | + "name": "GITHUB_WEBHOOK_SECRET", |
| 292 | + "description": "A secret string used to configure the GitHub webhook", |
| 293 | + "generate": "expression", |
| 294 | + "from": "[a-zA-Z0-9]{40}" |
| 295 | + }, |
| 296 | + { |
| 297 | + "name": "DATABASE_SERVICE_NAME", |
| 298 | + "description": "Database service name", |
| 299 | + "value": "mongodb" |
| 300 | + }, |
| 301 | + { |
| 302 | + "name": "MONGODB_USER", |
| 303 | + "description": "Username for MongoDB user that will be used for accessing the database", |
| 304 | + "generate": "expression", |
| 305 | + "from": "user[A-Z0-9]{3}" |
| 306 | + }, |
| 307 | + { |
| 308 | + "name": "MONGODB_PASSWORD", |
| 309 | + "description": "Password for the MongoDB user", |
| 310 | + "generate": "expression", |
| 311 | + "from": "[a-zA-Z0-9]{16}" |
| 312 | + }, |
| 313 | + { |
| 314 | + "name": "MONGODB_DATABASE", |
| 315 | + "description": "Database name", |
| 316 | + "value": "sampledb" |
| 317 | + }, |
| 318 | + { |
| 319 | + "name": "MONGODB_ADMIN_PASSWORD", |
| 320 | + "description": "Password for the database admin user", |
| 321 | + "generate": "expression", |
| 322 | + "from": "[a-zA-Z0-9]{16}" |
| 323 | + } |
| 324 | + ] |
| 325 | +} |
0 commit comments