{ "kind": "Template", "apiVersion": "v1", "metadata": { "name": "wordpress-mysql-example", "annotations": { "openshift.io/display-name": "WordPress + MySQL (Ephemeral)", "description": "An example WordPress application with a MySQL database.For more information about using this template, including OpenShift considerations, see https://github.com/openshift/origin/blob/master/examples/wordpress/template/README.md.\n\nNOTE: The MySQL service created by this template uses non-persistent storage. To setup persisted storage, change this template to use a persistent volume claim instead of emptydir.", "tags": "instant-app,php,wordpress", "iconClass": "icon-php" } }, "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/origin/blob/master/examples/wordpress/template/README.md.", "labels": { "template": "wordpress-mysql-example" }, "objects": [ { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "wordpress-mysql-example", "annotations": { "description": "Exposes and load balances the application pods", "service.alpha.openshift.io/dependencies": "[{\"name\": \"${DATABASE_SERVICE_NAME}\", \"kind\": \"Service\"}]" } }, "spec": { "ports": [ { "name": "web", "port": 8080, "targetPort": 8080 } ], "selector": { "name": "wordpress-mysql-example" } } }, { "kind": "Route", "apiVersion": "v1", "metadata": { "name": "wordpress-mysql-example", "annotations": { "template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}" } }, "spec": { "host": "${APPLICATION_DOMAIN}", "to": { "kind": "Service", "name": "wordpress-mysql-example" } } }, { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "wordpress-mysql-example", "annotations": { "description": "Keeps track of changes in the application image" } } }, { "kind": "BuildConfig", "apiVersion": "v1", "metadata": { "name": "wordpress-mysql-example", "annotations": { "description": "Defines how to build the application", "template.alpha.openshift.io/wait-for-ready": "true" } }, "spec": { "source": { "type": "Git", "git": { "uri": "${SOURCE_REPOSITORY_URL}", "ref": "${SOURCE_REPOSITORY_REF}" }, "contextDir": "${CONTEXT_DIR}" }, "strategy": { "type": "Source", "sourceStrategy": { "from": { "kind": "ImageStreamTag", "namespace": "openshift", "name": "php:5.5" } } }, "output": { "to": { "kind": "ImageStreamTag", "name": "wordpress-mysql-example:latest" } }, "triggers": [ { "type": "ImageChange" }, { "type": "ConfigChange" }, { "type": "GitHub", "github": { "secret": "${GITHUB_WEBHOOK_SECRET}" } } ] } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "wordpress-mysql-example", "annotations": { "description": "Defines how to deploy the application server", "template.alpha.openshift.io/wait-for-ready": "true" } }, "spec": { "strategy": { "type": "Rolling" }, "triggers": [ { "type": "ImageChange", "imageChangeParams": { "automatic": true, "containerNames": [ "wordpress-mysql-example" ], "from": { "kind": "ImageStreamTag", "name": "wordpress-mysql-example:latest" } } }, { "type": "ConfigChange" } ], "replicas": 1, "selector": { "name": "wordpress-mysql-example" }, "template": { "metadata": { "name": "wordpress-mysql-example", "labels": { "name": "wordpress-mysql-example" } }, "spec": { "containers": [ { "name": "wordpress-mysql-example", "image": "wordpress-mysql-example", "ports": [ { "containerPort": 8080 } ], "env": [ { "name": "DATABASE_SERVICE_NAME", "value": "${DATABASE_SERVICE_NAME}" }, { "name": "DATABASE_ENGINE", "value": "${DATABASE_ENGINE}" }, { "name": "DATABASE_NAME", "value": "${DATABASE_NAME}" }, { "name": "DATABASE_USER", "value": "${DATABASE_USER}" }, { "name": "DATABASE_PASSWORD", "value": "${DATABASE_PASSWORD}" } ], "volumeMounts": [ { "name": "${DATABASE_SERVICE_NAME}-data", "mountPath": "/var/lib/mysql/data" } ] } ], "volumes": [ { "name": "${DATABASE_SERVICE_NAME}-data", "emptyDir": { "medium": "" } } ] } } } }, { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "${DATABASE_SERVICE_NAME}", "annotations": { "description": "Exposes the database server" } }, "spec": { "ports": [ { "name": "mysql", "port": 3306, "targetPort": 3306 } ], "selector": { "name": "${DATABASE_SERVICE_NAME}" } } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "${DATABASE_SERVICE_NAME}", "annotations": { "description": "Defines how to deploy the database", "template.alpha.openshift.io/wait-for-ready": "true" } }, "spec": { "strategy": { "type": "Recreate" }, "triggers": [ { "type": "ConfigChange" } ], "replicas": 1, "selector": { "name": "${DATABASE_SERVICE_NAME}" }, "template": { "metadata": { "name": "${DATABASE_SERVICE_NAME}", "labels": { "name": "${DATABASE_SERVICE_NAME}" } }, "spec": { "containers": [ { "name": "mysql", "image": "${MYSQL_IMAGE}", "ports": [ { "containerPort": 3306 } ], "env": [ { "name": "MYSQL_USER", "value": "${DATABASE_USER}" }, { "name": "MYSQL_PASSWORD", "value": "${DATABASE_PASSWORD}" }, { "name": "MYSQL_DATABASE", "value": "${DATABASE_NAME}" } ] } ] } } } } ], "parameters": [ { "name": "SOURCE_REPOSITORY_URL", "description": "The URL of the repository with your application source code", "value": "https://github.com/wordpress/wordpress.git" }, { "name": "SOURCE_REPOSITORY_REF", "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch" }, { "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 wordpress service, if left blank a value will be defaulted.", "value": "" }, { "name": "GITHUB_WEBHOOK_SECRET", "description": "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted.", "generate": "expression", "from": "[a-zA-Z0-9]{40}" }, { "name": "DATABASE_SERVICE_NAME", "description": "Database service name", "value": "mysql" }, { "name": "DATABASE_NAME", "description": "Database name", "value": "wordpress" }, { "name": "DATABASE_USER", "description": "Database user name", "value": "wordpress" }, { "name": "DATABASE_PASSWORD", "description": "Database user password", "generate": "expression", "from": "[a-zA-Z0-9]{16}" }, { "name": "MYSQL_IMAGE", "description": "Image to use for mysql", "value": "openshift/mysql-55-centos7" } ] }