2015-06-17 15:45:09 +00:00
{
"kind" : "Template" ,
"apiVersion" : "v1" ,
"metadata" : {
"name" : "nodejs-mongodb-example" ,
"annotations" : {
2016-10-24 20:34:46 +00:00
"openshift.io/display-name" : "Node.js + MongoDB (Ephemeral)" ,
"description" : "An example Node.js application with a MongoDB database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing." ,
"tags" : "quickstart,nodejs" ,
2017-02-14 19:44:26 +00:00
"iconClass" : "icon-nodejs" ,
2017-10-19 12:42:43 +00:00
"openshift.io/long-description" : "This template defines resources needed to develop a NodeJS application, including a build configuration, application deployment configuration, and database deployment configuration. The database is stored in non-persistent storage, so this configuration should be used for experimental purposes only." ,
"openshift.io/provider-display-name" : "Red Hat, Inc." ,
"openshift.io/documentation-url" : "https://github.com/openshift/nodejs-ex" ,
2017-11-07 19:03:41 +00:00
"openshift.io/support-url" : "https://access.redhat.com" ,
"template.openshift.io/bindable" : "false"
2015-06-17 15:45:09 +00:00
}
} ,
2016-10-24 20:34:46 +00:00
"message" : "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md." ,
2015-06-17 15:45:09 +00:00
"labels" : {
2017-11-09 16:10:12 +00:00
"template" : "nodejs-mongodb-example" ,
"app" : "nodejs-mongodb-example"
2015-06-17 15:45:09 +00:00
} ,
"objects" : [
2016-11-29 16:18:16 +00:00
{
"kind" : "Secret" ,
"apiVersion" : "v1" ,
"metadata" : {
"name" : "${NAME}"
} ,
"stringData" : {
2017-01-17 19:05:05 +00:00
"database-user" : "${DATABASE_USER}" ,
"database-password" : "${DATABASE_PASSWORD}" ,
"database-admin-password" : "${DATABASE_ADMIN_PASSWORD}"
2016-11-29 16:18:16 +00:00
}
} ,
2015-06-17 15:45:09 +00:00
{
"kind" : "Service" ,
"apiVersion" : "v1" ,
"metadata" : {
2016-03-10 22:08:43 +00:00
"name" : "${NAME}" ,
2015-06-17 15:45:09 +00:00
"annotations" : {
2016-10-19 17:39:23 +00:00
"description" : "Exposes and load balances the application pods" ,
2016-10-24 20:34:46 +00:00
"service.alpha.openshift.io/dependencies" : "[{\"name\": \"${DATABASE_SERVICE_NAME}\", \"kind\": \"Service\"}]"
2015-06-17 15:45:09 +00:00
}
} ,
"spec" : {
"ports" : [
{
"name" : "web" ,
"port" : 8080 ,
"targetPort" : 8080
}
] ,
"selector" : {
2016-03-10 22:08:43 +00:00
"name" : "${NAME}"
2015-06-17 15:45:09 +00:00
}
}
} ,
{
"kind" : "Route" ,
"apiVersion" : "v1" ,
"metadata" : {
2017-11-07 19:03:41 +00:00
"name" : "${NAME}"
2015-06-17 15:45:09 +00:00
} ,
"spec" : {
"host" : "${APPLICATION_DOMAIN}" ,
"to" : {
"kind" : "Service" ,
2016-03-10 22:08:43 +00:00
"name" : "${NAME}"
2015-06-17 15:45:09 +00:00
}
}
} ,
{
"kind" : "ImageStream" ,
"apiVersion" : "v1" ,
"metadata" : {
2016-03-10 22:08:43 +00:00
"name" : "${NAME}" ,
2015-06-17 15:45:09 +00:00
"annotations" : {
"description" : "Keeps track of changes in the application image"
}
}
} ,
{
"kind" : "BuildConfig" ,
"apiVersion" : "v1" ,
"metadata" : {
2016-03-10 22:08:43 +00:00
"name" : "${NAME}" ,
2015-06-17 15:45:09 +00:00
"annotations" : {
2017-08-11 16:38:32 +00:00
"description" : "Defines how to build the application" ,
"template.alpha.openshift.io/wait-for-ready" : "true"
2015-06-17 15:45:09 +00:00
}
} ,
"spec" : {
"source" : {
"type" : "Git" ,
"git" : {
"uri" : "${SOURCE_REPOSITORY_URL}" ,
"ref" : "${SOURCE_REPOSITORY_REF}"
} ,
"contextDir" : "${CONTEXT_DIR}"
} ,
"strategy" : {
"type" : "Source" ,
"sourceStrategy" : {
"from" : {
"kind" : "ImageStreamTag" ,
2016-03-15 01:16:16 +00:00
"namespace" : "${NAMESPACE}" ,
2018-04-26 17:59:59 +00:00
"name" : "nodejs:${NODEJS_VERSION}"
2016-07-06 17:51:15 +00:00
} ,
2016-11-29 16:18:16 +00:00
"env" : [
2016-07-06 17:51:15 +00:00
{
2016-11-29 16:18:16 +00:00
"name" : "NPM_MIRROR" ,
"value" : "${NPM_MIRROR}"
2016-07-06 17:51:15 +00:00
}
]
2015-06-17 15:45:09 +00:00
}
} ,
"output" : {
"to" : {
"kind" : "ImageStreamTag" ,
2016-03-10 22:08:43 +00:00
"name" : "${NAME}:latest"
2015-06-17 15:45:09 +00:00
}
} ,
"triggers" : [
{
"type" : "ImageChange"
} ,
2015-11-20 23:24:46 +00:00
{
"type" : "ConfigChange"
} ,
2015-06-17 15:45:09 +00:00
{
"type" : "GitHub" ,
"github" : {
"secret" : "${GITHUB_WEBHOOK_SECRET}"
}
2015-10-05 19:16:22 +00:00
} ,
{
"type" : "Generic" ,
"generic" : {
"secret" : "${GENERIC_WEBHOOK_SECRET}"
}
2015-06-17 15:45:09 +00:00
}
2016-04-11 18:52:20 +00:00
] ,
"postCommit" : {
"script" : "npm test"
2016-04-12 02:01:26 +00:00
}
2015-06-17 15:45:09 +00:00
}
} ,
{
"kind" : "DeploymentConfig" ,
"apiVersion" : "v1" ,
"metadata" : {
2016-03-10 22:08:43 +00:00
"name" : "${NAME}" ,
2015-06-17 15:45:09 +00:00
"annotations" : {
2017-08-11 16:38:32 +00:00
"description" : "Defines how to deploy the application server" ,
"template.alpha.openshift.io/wait-for-ready" : "true"
2015-06-17 15:45:09 +00:00
}
} ,
"spec" : {
"strategy" : {
2017-04-25 20:47:41 +00:00
"type" : "Recreate"
2015-06-17 15:45:09 +00:00
} ,
"triggers" : [
{
"type" : "ImageChange" ,
"imageChangeParams" : {
"automatic" : true ,
"containerNames" : [
2015-06-30 21:09:23 +00:00
"nodejs-mongodb-example"
2015-06-17 15:45:09 +00:00
] ,
"from" : {
"kind" : "ImageStreamTag" ,
2016-03-10 22:08:43 +00:00
"name" : "${NAME}:latest"
2015-06-17 15:45:09 +00:00
}
}
} ,
{
"type" : "ConfigChange"
}
] ,
"replicas" : 1 ,
"selector" : {
2016-03-10 22:08:43 +00:00
"name" : "${NAME}"
2015-06-17 15:45:09 +00:00
} ,
"template" : {
"metadata" : {
2016-03-10 22:08:43 +00:00
"name" : "${NAME}" ,
2015-06-17 15:45:09 +00:00
"labels" : {
2016-03-10 22:08:43 +00:00
"name" : "${NAME}"
2015-06-17 15:45:09 +00:00
}
} ,
"spec" : {
"containers" : [
{
2015-06-30 21:09:23 +00:00
"name" : "nodejs-mongodb-example" ,
2016-05-13 16:03:44 +00:00
"image" : " " ,
2015-06-17 15:45:09 +00:00
"ports" : [
{
"containerPort" : 8080
}
] ,
"env" : [
2015-06-19 09:22:02 +00:00
{
"name" : "DATABASE_SERVICE_NAME" ,
"value" : "${DATABASE_SERVICE_NAME}"
} ,
2015-06-17 15:45:09 +00:00
{
"name" : "MONGODB_USER" ,
2016-11-29 16:18:16 +00:00
"valueFrom" : {
"secretKeyRef" : {
"name" : "${NAME}" ,
2017-01-17 19:05:05 +00:00
"key" : "database-user"
2016-11-29 16:18:16 +00:00
}
}
2015-06-17 15:45:09 +00:00
} ,
{
"name" : "MONGODB_PASSWORD" ,
2016-11-29 16:18:16 +00:00
"valueFrom" : {
"secretKeyRef" : {
"name" : "${NAME}" ,
2017-01-17 19:05:05 +00:00
"key" : "database-password"
2016-11-29 16:18:16 +00:00
}
}
2015-06-17 15:45:09 +00:00
} ,
{
"name" : "MONGODB_DATABASE" ,
2015-07-31 18:18:23 +00:00
"value" : "${DATABASE_NAME}"
2015-06-17 15:45:09 +00:00
} ,
{
"name" : "MONGODB_ADMIN_PASSWORD" ,
2016-11-29 16:18:16 +00:00
"valueFrom" : {
"secretKeyRef" : {
"name" : "${NAME}" ,
2017-01-17 19:05:05 +00:00
"key" : "database-admin-password"
2016-11-29 16:18:16 +00:00
}
}
2015-06-17 15:45:09 +00:00
}
2016-02-25 04:01:42 +00:00
] ,
2016-02-29 16:12:14 +00:00
"readinessProbe" : {
"timeoutSeconds" : 3 ,
"initialDelaySeconds" : 3 ,
"httpGet" : {
"path" : "/pagecount" ,
"port" : 8080
}
} ,
"livenessProbe" : {
2016-11-29 16:18:16 +00:00
"timeoutSeconds" : 3 ,
"initialDelaySeconds" : 30 ,
"httpGet" : {
"path" : "/pagecount" ,
"port" : 8080
}
2016-02-29 16:12:14 +00:00
} ,
2016-02-25 04:01:42 +00:00
"resources" : {
2016-11-29 16:18:16 +00:00
"limits" : {
"memory" : "${MEMORY_LIMIT}"
}
2016-02-25 04:01:42 +00:00
}
2015-06-17 15:45:09 +00:00
}
]
}
}
}
} ,
{
"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" : "DeploymentConfig" ,
"apiVersion" : "v1" ,
"metadata" : {
"name" : "${DATABASE_SERVICE_NAME}" ,
"annotations" : {
2017-08-18 17:14:14 +00:00
"description" : "Defines how to deploy the database" ,
"template.alpha.openshift.io/wait-for-ready" : "true"
2015-06-17 15:45:09 +00:00
}
} ,
"spec" : {
"strategy" : {
"type" : "Recreate"
} ,
"triggers" : [
2015-11-20 23:24:46 +00:00
{
"type" : "ImageChange" ,
"imageChangeParams" : {
2016-05-12 14:28:32 +00:00
"automatic" : true ,
2015-11-20 23:24:46 +00:00
"containerNames" : [
"mongodb"
] ,
"from" : {
"kind" : "ImageStreamTag" ,
2016-03-15 01:16:16 +00:00
"namespace" : "${NAMESPACE}" ,
2018-04-26 17:59:59 +00:00
"name" : "mongodb:${MONGODB_VERSION}"
2015-11-20 23:24:46 +00:00
}
}
} ,
2015-06-17 15:45:09 +00:00
{
"type" : "ConfigChange"
}
] ,
"replicas" : 1 ,
"selector" : {
"name" : "${DATABASE_SERVICE_NAME}"
} ,
"template" : {
"metadata" : {
"name" : "${DATABASE_SERVICE_NAME}" ,
"labels" : {
"name" : "${DATABASE_SERVICE_NAME}"
}
} ,
"spec" : {
"containers" : [
{
"name" : "mongodb" ,
2016-05-13 16:03:44 +00:00
"image" : " " ,
2015-06-17 15:45:09 +00:00
"ports" : [
{
"containerPort" : 27017
}
] ,
"env" : [
{
"name" : "MONGODB_USER" ,
2016-11-29 16:18:16 +00:00
"valueFrom" : {
"secretKeyRef" : {
"name" : "${NAME}" ,
2017-01-17 19:05:05 +00:00
"key" : "database-user"
2016-11-29 16:18:16 +00:00
}
}
2015-06-17 15:45:09 +00:00
} ,
{
"name" : "MONGODB_PASSWORD" ,
2016-11-29 16:18:16 +00:00
"valueFrom" : {
"secretKeyRef" : {
"name" : "${NAME}" ,
2017-01-17 19:05:05 +00:00
"key" : "database-password"
2016-11-29 16:18:16 +00:00
}
}
2015-06-17 15:45:09 +00:00
} ,
{
"name" : "MONGODB_DATABASE" ,
2015-07-31 18:18:23 +00:00
"value" : "${DATABASE_NAME}"
2015-06-17 15:45:09 +00:00
} ,
{
"name" : "MONGODB_ADMIN_PASSWORD" ,
2016-11-29 16:18:16 +00:00
"valueFrom" : {
"secretKeyRef" : {
"name" : "${NAME}" ,
2017-01-17 19:05:05 +00:00
"key" : "database-admin-password"
2016-11-29 16:18:16 +00:00
}
}
2015-06-17 15:45:09 +00:00
}
2016-02-25 04:01:42 +00:00
] ,
2016-02-29 16:12:14 +00:00
"readinessProbe" : {
"timeoutSeconds" : 1 ,
"initialDelaySeconds" : 3 ,
"exec" : {
2016-11-29 16:18:16 +00:00
"command" : [
"/bin/sh" ,
"-i" ,
"-c" ,
"mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""
]
2016-02-29 16:12:14 +00:00
}
} ,
"livenessProbe" : {
"timeoutSeconds" : 1 ,
"initialDelaySeconds" : 30 ,
"tcpSocket" : {
"port" : 27017
}
} ,
2016-02-25 04:01:42 +00:00
"resources" : {
2016-11-29 16:18:16 +00:00
"limits" : {
"memory" : "${MEMORY_MONGODB_LIMIT}"
}
2016-04-26 19:39:57 +00:00
} ,
"volumeMounts" : [
{
"name" : "${DATABASE_SERVICE_NAME}-data" ,
"mountPath" : "/var/lib/mongodb/data"
}
]
}
] ,
"volumes" : [
{
"name" : "${DATABASE_SERVICE_NAME}-data" ,
"emptyDir" : {
"medium" : ""
2016-02-25 04:01:42 +00:00
}
2015-06-17 15:45:09 +00:00
}
]
}
}
}
}
] ,
"parameters" : [
2016-03-10 22:08:43 +00:00
{
"name" : "NAME" ,
"displayName" : "Name" ,
"description" : "The name assigned to all of the frontend objects defined in this template." ,
"required" : true ,
"value" : "nodejs-mongodb-example"
} ,
2016-03-15 01:16:16 +00:00
{
"name" : "NAMESPACE" ,
"displayName" : "Namespace" ,
"description" : "The OpenShift Namespace where the ImageStream resides." ,
2016-07-06 17:51:15 +00:00
"required" : true ,
2016-03-15 01:16:16 +00:00
"value" : "openshift"
} ,
2018-04-26 17:59:59 +00:00
{
"name" : "NODEJS_VERSION" ,
"displayName" : "Version of NodeJS Image" ,
"description" : "Version of NodeJS image to be used (6, 8, or latest)." ,
"value" : "8" ,
"required" : true
} ,
{
"name" : "MONGODB_VERSION" ,
"displayName" : "Version of MongoDB Image" ,
"description" : "Version of MongoDB image to be used (3.2, 3.4, or latest)." ,
"value" : "3.4" ,
"required" : true
} ,
2016-02-25 04:01:42 +00:00
{
"name" : "MEMORY_LIMIT" ,
2016-03-07 19:05:27 +00:00
"displayName" : "Memory Limit" ,
"description" : "Maximum amount of memory the Node.js container can use." ,
2016-07-06 17:51:15 +00:00
"required" : true ,
2016-03-01 03:11:07 +00:00
"value" : "512Mi"
2016-02-25 04:01:42 +00:00
} ,
{
"name" : "MEMORY_MONGODB_LIMIT" ,
2016-03-07 19:05:27 +00:00
"displayName" : "Memory Limit (MongoDB)" ,
"description" : "Maximum amount of memory the MongoDB container can use." ,
2016-07-06 17:51:15 +00:00
"required" : true ,
2016-03-01 03:11:07 +00:00
"value" : "512Mi"
2016-02-25 04:01:42 +00:00
} ,
2015-06-17 15:45:09 +00:00
{
"name" : "SOURCE_REPOSITORY_URL" ,
2016-03-07 19:05:27 +00:00
"displayName" : "Git Repository URL" ,
"description" : "The URL of the repository with your application source code." ,
2016-07-06 17:51:15 +00:00
"required" : true ,
2015-06-17 15:45:09 +00:00
"value" : "https://github.com/openshift/nodejs-ex.git"
} ,
{
"name" : "SOURCE_REPOSITORY_REF" ,
2016-03-07 19:05:27 +00:00
"displayName" : "Git Reference" ,
"description" : "Set this to a branch name, tag or other ref of your repository if you are not using the default branch."
2015-06-17 15:45:09 +00:00
} ,
{
"name" : "CONTEXT_DIR" ,
2016-03-07 19:05:27 +00:00
"displayName" : "Context Directory" ,
"description" : "Set this to the relative path to your project if it is not in the root of your repository."
2015-06-17 15:45:09 +00:00
} ,
{
"name" : "APPLICATION_DOMAIN" ,
2016-03-07 19:05:27 +00:00
"displayName" : "Application Hostname" ,
2015-08-18 17:19:24 +00:00
"description" : "The exposed hostname that will route to the Node.js service, if left blank a value will be defaulted." ,
"value" : ""
2015-06-17 15:45:09 +00:00
} ,
{
"name" : "GITHUB_WEBHOOK_SECRET" ,
2016-03-07 19:05:27 +00:00
"displayName" : "GitHub Webhook Secret" ,
2017-06-26 03:08:48 +00:00
"description" : "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted." ,
2015-06-17 15:45:09 +00:00
"generate" : "expression" ,
"from" : "[a-zA-Z0-9]{40}"
} ,
2015-10-05 19:16:22 +00:00
{
"name" : "GENERIC_WEBHOOK_SECRET" ,
2016-03-07 19:05:27 +00:00
"displayName" : "Generic Webhook Secret" ,
"description" : "A secret string used to configure the Generic webhook." ,
2015-10-05 19:16:22 +00:00
"generate" : "expression" ,
"from" : "[a-zA-Z0-9]{40}"
} ,
2015-06-17 15:45:09 +00:00
{
"name" : "DATABASE_SERVICE_NAME" ,
2016-03-07 19:05:27 +00:00
"displayName" : "Database Service Name" ,
2016-07-06 17:51:15 +00:00
"required" : true ,
2015-06-17 15:45:09 +00:00
"value" : "mongodb"
} ,
{
2015-07-31 18:18:23 +00:00
"name" : "DATABASE_USER" ,
2016-03-07 19:05:27 +00:00
"displayName" : "MongoDB Username" ,
"description" : "Username for MongoDB user that will be used for accessing the database." ,
2015-06-17 15:45:09 +00:00
"generate" : "expression" ,
"from" : "user[A-Z0-9]{3}"
} ,
{
2015-07-31 18:18:23 +00:00
"name" : "DATABASE_PASSWORD" ,
2016-03-07 19:05:27 +00:00
"displayName" : "MongoDB Password" ,
"description" : "Password for the MongoDB user." ,
2015-06-17 15:45:09 +00:00
"generate" : "expression" ,
"from" : "[a-zA-Z0-9]{16}"
} ,
{
2015-07-31 18:18:23 +00:00
"name" : "DATABASE_NAME" ,
2016-03-07 19:05:27 +00:00
"displayName" : "Database Name" ,
2016-07-06 17:51:15 +00:00
"required" : true ,
2015-06-17 15:45:09 +00:00
"value" : "sampledb"
} ,
{
2015-07-31 18:18:23 +00:00
"name" : "DATABASE_ADMIN_PASSWORD" ,
2016-03-07 19:05:27 +00:00
"displayName" : "Database Administrator Password" ,
"description" : "Password for the database admin user." ,
2015-06-17 15:45:09 +00:00
"generate" : "expression" ,
"from" : "[a-zA-Z0-9]{16}"
2016-07-06 17:51:15 +00:00
} ,
{
"name" : "NPM_MIRROR" ,
"displayName" : "Custom NPM Mirror URL" ,
"description" : "The custom NPM mirror URL" ,
"value" : ""
2015-06-17 15:45:09 +00:00
}
]
}