{ "kind": "Template", "apiVersion": "v1", "metadata": { "name": "cakephp-mysql-example", "annotations": { "description": "An example CakePHP application with a MySQL database", "tags": "quickstart,php,cakephp,mysql", "iconClass": "icon-php" } }, "labels": { "template": "cakephp-mysql-example" }, "objects": [ { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "cakephp-mysql-example", "annotations": { "description": "Exposes and load balances the application pods" } }, "spec": { "ports": [ { "name": "web", "port": 8080, "targetPort": 8080 } ], "selector": { "name": "cakephp-mysql-example" } } }, { "kind": "Route", "apiVersion": "v1", "metadata": { "name": "cakephp-mysql-example" }, "spec": { "host": "${APPLICATION_DOMAIN}", "to": { "kind": "Service", "name": "cakephp-mysql-example" } } }, { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "cakephp-mysql-example", "annotations": { "description": "Keeps track of changes in the application image" } } }, { "kind": "BuildConfig", "apiVersion": "v1", "metadata": { "name": "cakephp-mysql-example", "annotations": { "description": "Defines how to build the application" } }, "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.6" } } }, "output": { "to": { "kind": "ImageStreamTag", "name": "cakephp-mysql-example:latest" } }, "triggers": [ { "type": "ImageChange" }, { "type": "ConfigChange" }, { "type": "GitHub", "github": { "secret": "${GITHUB_WEBHOOK_SECRET}" } } ] } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "cakephp-mysql-example", "annotations": { "description": "Defines how to deploy the application server" } }, "spec": { "strategy": { "type": "Rolling", "recreateParams": { "pre": { "failurePolicy": "Abort", "execNewPod": { "command": [ "./migrate-database.sh" ], "containerName": "cakephp-mysql-example" } } } }, "triggers": [ { "type": "ImageChange", "imageChangeParams": { "automatic": true, "containerNames": [ "cakephp-mysql-example" ], "from": { "kind": "ImageStreamTag", "name": "cakephp-mysql-example:latest" } } }, { "type": "ConfigChange" } ], "replicas": 1, "selector": { "name": "cakephp-mysql-example" }, "template": { "metadata": { "name": "cakephp-mysql-example", "labels": { "name": "cakephp-mysql-example" } }, "spec": { "containers": [ { "name": "cakephp-mysql-example", "image": "cakephp-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}" }, { "name": "CAKEPHP_SECRET_TOKEN", "value": "${CAKEPHP_SECRET_TOKEN}" }, { "name": "CAKEPHP_SECURITY_SALT", "value": "${CAKEPHP_SECURITY_SALT}" }, { "name": "CAKEPHP_SECURITY_CIPHER_SEED", "value": "${CAKEPHP_SECURITY_CIPHER_SEED}" }, { "name": "OPCACHE_REVALIDATE_FREQ", "value": "${OPCACHE_REVALIDATE_FREQ}" } ], "resources": { "limits": { "memory": "${MEMORY_LIMIT}" } } } ] } } } }, { "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" } }, "spec": { "strategy": { "type": "Recreate" }, "triggers": [ { "type": "ImageChange", "imageChangeParams": { "automatic": false, "containerNames": [ "mysql" ], "from": { "kind": "ImageStreamTag", "namespace": "openshift", "name": "mysql:5.6" } } }, { "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", "ports": [ { "containerPort": 3306 } ], "env": [ { "name": "MYSQL_USER", "value": "${DATABASE_USER}" }, { "name": "MYSQL_PASSWORD", "value": "${DATABASE_PASSWORD}" }, { "name": "MYSQL_DATABASE", "value": "${DATABASE_NAME}" } ], "resources": { "limits": { "memory": "${MEMORY_MYSQL_LIMIT}" } } } ] } } } } ], "parameters": [ { "name": "MEMORY_LIMIT", "displayName": "Memory limit", "description": "Maximum amount of memory the CakePHP container can use", "value": "512Mi" }, { "name": "MEMORY_MYSQL_LIMIT", "displayName": "Memory limit", "description": "Maximum amount of memory the MySQL container can use", "value": "512Mi" }, { "name": "SOURCE_REPOSITORY_URL", "displayName": "Source repository URL", "description": "The URL of the repository with your application source code", "value": "https://github.com/openshift/cakephp-ex.git" }, { "name": "SOURCE_REPOSITORY_REF", "displayName": "Source repository reference", "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", "displayName": "Context directory", "description": "Set this to the relative path to your project if it is not in the root of your repository" }, { "name": "APPLICATION_DOMAIN", "displayName": "Application domain", "description": "The exposed hostname that will route to the CakePHP service, if left blank a value will be defaulted.", "value": "" }, { "name": "GITHUB_WEBHOOK_SECRET", "displayName": "GitHub webhook secret", "description": "A secret string used to configure the GitHub webhook", "generate": "expression", "from": "[a-zA-Z0-9]{40}" }, { "name": "DATABASE_SERVICE_NAME", "displayName": "Database service name", "description": "Database service name", "value": "mysql" }, { "name": "DATABASE_ENGINE", "displayName": "Database engine", "description": "Database engine: postgresql, mysql or sqlite (default)", "value": "mysql" }, { "name": "DATABASE_NAME", "displayName": "Database name", "description": "Database name", "value": "default" }, { "name": "DATABASE_USER", "displayName": "Database user", "description": "Database user name", "value": "cakephp" }, { "name": "DATABASE_PASSWORD", "displayName": "Database password", "description": "Database user password", "generate": "expression", "from": "[a-zA-Z0-9]{16}" }, { "name": "CAKEPHP_SECRET_TOKEN", "displayName": "CakePHP secret token", "description": "Set this to a long random string", "generate": "expression", "from": "[\\w]{50}" }, { "name": "CAKEPHP_SECURITY_SALT", "displayName": "CakePHP security salt", "description": "Security salt for session hash", "generate": "expression", "from": "[a-zA-Z0-9]{40}" }, { "name": "CAKEPHP_SECURITY_CIPHER_SEED", "displayName": "CakePHP security cipher seed", "description": "Security cipher seed for session hash", "generate": "expression", "from": "[0-9]{30}" }, { "name": "OPCACHE_REVALIDATE_FREQ", "displayName": "OPcache revalidation frequency", "description": "How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.", "value": "2" } ] }