{ "kind": "Template", "apiVersion": "v1", "metadata": { "name": "mlbparks-wildfly", "annotations": { "iconClass": "icon-jboss", "description": "Application template for MLB Parks application on WildFly & MongoDB built using STI" } }, "labels": { "application": "mlbparks", "createdBy": "template-mlbparks-wildfly" }, "parameters": [ { "description": "The name for the application.", "name": "APPLICATION_NAME", "value": "mlbparks" }, { "description": "Custom hostname for service routes. Leave blank for default hostname, e.g.: ..", "name": "APPLICATION_HOSTNAME" }, { "description": "Git source URI for application", "name": "GIT_URI", "value": "https://github.com/jorgemoralespou/openshift3mlbparks.git" }, { "description": "Git branch/tag reference", "name": "GIT_REF", "value": "master" }, { "description": "Maven mirror url. If nexus is deployed locally, use nexus url (e.g. http://nexus.ci.apps.10.2.2.2.xip.io/content/groups/public/)", "name": "MAVEN_MIRROR_URL", "displayName": "Maven mirror url", "required": false }, { "description": "Database name", "name": "MONGODB_DATABASE", "value": "root" }, { "description": "Disable data file preallocation.", "name": "MONGODB_NOPREALLOC" }, { "description": "Set MongoDB to use a smaller default data file size.", "name": "MONGODB_SMALLFILES" }, { "description": "Runs MongoDB in a quiet mode that attempts to limit the amount of output.", "name": "MONGODB_QUIET" }, { "description": "Database user name", "name": "MONGODB_USER", "from": "user[a-zA-Z0-9]{3}", "generate": "expression" }, { "description": "Database user password", "name": "MONGODB_PASSWORD", "from": "[a-zA-Z0-9]{8}", "generate": "expression" }, { "description": "Database admin password", "name": "MONGODB_ADMIN_PASSWORD", "from": "[a-zA-Z0-9]{8}", "generate": "expression" }, { "description": "Github trigger secret", "name": "GITHUB_TRIGGER_SECRET", "from": "[a-zA-Z0-9]{8}", "generate": "expression" }, { "description": "Generic build trigger secret", "name": "GENERIC_TRIGGER_SECRET", "from": "[a-zA-Z0-9]{8}", "generate": "expression" } ], "objects": [ { "kind": "BuildConfig", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}" }, "spec": { "triggers": [ { "type": "Generic", "generic": { "secret": "${GENERIC_TRIGGER_SECRET}" } }, { "type": "GitHub", "github": { "secret": "${GITHUB_TRIGGER_SECRET}" } }, { "type": "ImageChange", "imageChange": {} } ], "source": { "type": "Git", "git": { "uri": "${GIT_URI}", "ref": "${GIT_REF}" } }, "strategy": { "type": "Source", "sourceStrategy": { "from": { "kind": "ImageStreamTag", "namespace": "openshift", "name": "wildfly:latest" }, "env": [ { "name": "MAVEN_MIRROR_URL", "value": "${MAVEN_MIRROR_URL}" } ] } }, "output": { "to": { "kind": "ImageStreamTag", "name": "${APPLICATION_NAME}:latest" } } } }, { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}" }, "spec": { "dockerImageRepository": "", "tags": [ { "name": "latest" } ] } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-mongodb" }, "spec": { "strategy": { "type": "Recreate" }, "triggers": [ { "type": "ImageChange", "imageChangeParams": { "automatic": true, "containerNames": [ "${APPLICATION_NAME}-mongodb" ], "from": { "kind": "ImageStreamTag", "namespace": "openshift", "name": "mongodb:2.6" } } }, { "type": "ConfigChange" } ], "replicas": 1, "selector": { "deploymentConfig": "${APPLICATION_NAME}-mongodb" }, "template": { "metadata": { "name": "${APPLICATION_NAME}-mongodb", "labels": { "deploymentConfig": "${APPLICATION_NAME}-mongodb" } }, "spec": { "volumes": [ { "name": "${APPLICATION_NAME}-mongodb-data", "emptyDir": {} } ], "containers": [ { "name": "${APPLICATION_NAME}-mongodb", "image": "mongodb", "ports": [ { "containerPort": 27017, "protocol": "TCP" } ], "env": [ { "name": "MONGODB_USER", "value": "${MONGODB_USER}" }, { "name": "MONGODB_PASSWORD", "value": "${MONGODB_PASSWORD}" }, { "name": "MONGODB_DATABASE", "value": "${MONGODB_DATABASE}" }, { "name": "MONGODB_ADMIN_PASSWORD", "value": "${MONGODB_ADMIN_PASSWORD}" }, { "name": "MONGODB_NOPREALLOC", "value": "${MONGODB_NOPREALLOC}" }, { "name": "MONGODB_SMALLFILES", "value": "${MONGODB_SMALLFILES}" }, { "name": "MONGODB_QUIET", "value": "${MONGODB_QUIET}" } ], "resources": {}, "volumeMounts": [ { "name": "${APPLICATION_NAME}-mongodb-data", "mountPath": "/var/lib/mongodb/data" } ], "terminationMessagePath": "/dev/termination-log", "imagePullPolicy": "IfNotPresent", "securityContext": { "capabilities": {}, "privileged": false } } ], "restartPolicy": "Always", "dnsPolicy": "ClusterFirst" } } } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}", "labels": { "deploymentConfig": "${APPLICATION_NAME}" } }, "spec": { "strategy": { "type": "Recreate" }, "triggers": [ { "type": "ImageChange", "imageChangeParams": { "automatic": true, "containerNames": [ "${APPLICATION_NAME}" ], "from": { "kind": "ImageStreamTag", "name": "${APPLICATION_NAME}:latest" } } }, { "type": "ConfigChange" } ], "replicas": 1, "selector": { "deploymentConfig": "${APPLICATION_NAME}" }, "template": { "metadata": { "labels": { "deploymentConfig": "${APPLICATION_NAME}" } }, "spec": { "containers": [ { "name": "${APPLICATION_NAME}", "image": "${APPLICATION_NAME}", "ports": [ { "name": "${APPLICATION_NAME}-http", "containerPort": 8080, "protocol": "TCP" } ], "readinessProbe": { "httpGet": { "path": "/", "port": 8080 } }, "env": [ { "name": "MONGODB_USER", "value": "${MONGODB_USER}" }, { "name": "MONGODB_PASSWORD", "value": "${MONGODB_PASSWORD}" }, { "name": "MONGODB_DATABASE", "value": "${MONGODB_DATABASE}" }, { "name": "MONGODB_ADMIN_PASSWORD", "value": "${MONGODB_ADMIN_PASSWORD}" } ], "resources": {}, "terminationMessagePath": "/dev/termination-log", "imagePullPolicy": "Always", "securityContext": { "capabilities": {}, "privileged": false } } ], "restartPolicy": "Always", "dnsPolicy": "ClusterFirst" } } } }, { "kind": "Route", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}", "annotations": { "description": "Route for application's http service" } }, "spec": { "host": "${APPLICATION_HOSTNAME}", "to": { "kind": "Service", "name": "${APPLICATION_NAME}" } } }, { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "mongodb" }, "spec": { "ports": [ { "port": 27017, "targetPort": 27017 } ], "selector": { "deploymentConfig": "${APPLICATION_NAME}-mongodb" } } }, { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}", "annotations": { "description": "The web server's http port" } }, "spec": { "ports": [ { "protocol": "TCP", "port": 8080, "targetPort": 8080 } ], "selector": { "deploymentConfig": "${APPLICATION_NAME}" } } } ] }