{ "kind": "Template", "apiVersion": "v1", "metadata": { "name": "php-helloworld-sample", "creationTimestamp": null, "annotations": { "description": "This example shows how to create a simple php application in openshift origin v3", "iconClass": "icon-php", "tags": "instant-app,php,mysql" } }, "objects": [ { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "frontend", "creationTimestamp": null }, "spec": { "ports": [ { "name": "web", "protocol": "TCP", "port": 5432, "targetPort": 8080, "nodePort": 0 } ], "selector": { "name": "frontend" }, "portalIP": "", "type": "ClusterIP", "sessionAffinity": "None" }, "status": { "loadBalancer": {} } }, { "kind": "Route", "apiVersion": "v1", "metadata": { "name": "route-edge", "creationTimestamp": null }, "spec": { "to": { "kind": "Service", "name": "frontend" }, "tls": { "termination": "edge" } }, "status": {} }, { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "origin-php-sample", "creationTimestamp": null }, "spec": {}, "status": { "dockerImageRepository": "" } }, { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "php-56-rhel7", "creationTimestamp": null }, "spec": { "dockerImageRepository": "registry.access.redhat.com/rhscl/php-56-rhel7" }, "status": { "dockerImageRepository": "" } }, { "kind": "BuildConfig", "apiVersion": "v1", "metadata": { "name": "php-sample-build", "creationTimestamp": null, "labels": { "name": "php-sample-build" } }, "spec": { "triggers": [ { "type": "GitHub", "github": { "secret": "secret101" } }, { "type": "Generic", "generic": { "secret": "secret101" } }, { "type": "ImageChange", "imageChange": {} }, { "type": "ConfigChange" } ], "source": { "type": "Git", "git": { "uri": "https://github.com/openshift-qe/php-example-app" } }, "strategy": { "type": "Source", "sourceStrategy": { "from": { "kind": "ImageStreamTag", "name": "php:latest", "namespace": "openshift" }, "env": [ { "name": "EXAMPLE", "value": "sample-app" } ] } }, "output": { "to": { "kind": "ImageStreamTag", "name": "origin-php-sample:latest" } }, "postCommit": { }, "resources": {} }, "status": { "lastVersion": 0 } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "frontend", "creationTimestamp": null }, "spec": { "strategy": { "type": "Rolling", "rollingParams": { "updatePeriodSeconds": 1, "intervalSeconds": 1, "timeoutSeconds": 120, "pre": { "failurePolicy": "Abort", "execNewPod": { "command": [ "/bin/true" ], "env": [ { "name": "CUSTOM_VAR1", "value": "custom_value1" } ], "containerName": "php-helloworld" } }, "post": { "failurePolicy": "Ignore", "execNewPod": { "command": [ "/bin/false" ], "env": [ { "name": "CUSTOM_VAR2", "value": "custom_value2" } ], "containerName": "php-helloworld" } } }, "resources": {} }, "triggers": [ { "type": "ImageChange", "imageChangeParams": { "automatic": true, "containerNames": [ "php-helloworld" ], "from": { "kind": "ImageStreamTag", "name": "origin-php-sample:latest" } } }, { "type": "ConfigChange" } ], "replicas": 2, "selector": { "name": "frontend" }, "template": { "metadata": { "creationTimestamp": null, "labels": { "name": "frontend" } }, "spec": { "containers": [ { "name": "php-helloworld", "image": "origin-php-sample", "ports": [ { "containerPort": 8080, "protocol": "TCP" } ], "env": [ { "name": "ADMIN_USERNAME", "value": "${ADMIN_USERNAME}" }, { "name": "ADMIN_PASSWORD", "value": "${ADMIN_PASSWORD}" }, { "name": "MYSQL_USER", "value": "${MYSQL_USER}" }, { "name": "MYSQL_PASSWORD", "value": "${MYSQL_PASSWORD}" }, { "name": "MYSQL_DATABASE", "value": "${MYSQL_DATABASE}" } ], "resources": {}, "terminationMessagePath": "/dev/termination-log", "imagePullPolicy": "IfNotPresent", "securityContext": { "capabilities": {}, "privileged": false } } ], "restartPolicy": "Always", "dnsPolicy": "ClusterFirst" } } }, "status": {} }, { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "database", "creationTimestamp": null }, "spec": { "ports": [ { "name": "db", "protocol": "TCP", "port": 5434, "targetPort": 3306, "nodePort": 0 } ], "selector": { "name": "database" }, "portalIP": "", "type": "ClusterIP", "sessionAffinity": "None" }, "status": { "loadBalancer": {} } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "database", "creationTimestamp": null }, "spec": { "strategy": { "type": "Recreate", "recreateParams": { "pre": { "failurePolicy": "Abort", "execNewPod": { "command": [ "/bin/true" ], "env": [ { "name": "CUSTOM_VAR1", "value": "custom_value1" } ], "containerName": "php-helloworld-database", "volumes": ["php-helloworld-data"] } }, "mid": { "failurePolicy": "Abort", "execNewPod": { "command": [ "/bin/true" ], "env": [ { "name": "CUSTOM_VAR2", "value": "custom_value2" } ], "containerName": "php-helloworld-database", "volumes": ["php-helloworld-data"] } }, "post": { "failurePolicy": "Ignore", "execNewPod": { "command": [ "/bin/false" ], "env": [ { "name": "CUSTOM_VAR2", "value": "custom_value2" } ], "containerName": "php-helloworld-database", "volumes": ["php-helloworld-data"] } } }, "resources": {} }, "triggers": [ { "type": "ConfigChange" } ], "replicas": 1, "selector": { "name": "database" }, "template": { "metadata": { "creationTimestamp": null, "labels": { "name": "database" } }, "spec": { "containers": [ { "name": "php-helloworld-database", "image": "registry.access.redhat.com/openshift3/mysql-55-rhel7:latest", "ports": [ { "containerPort": 3306, "protocol": "TCP" } ], "env": [ { "name": "MYSQL_USER", "value": "${MYSQL_USER}" }, { "name": "MYSQL_PASSWORD", "value": "${MYSQL_PASSWORD}" }, { "name": "MYSQL_DATABASE", "value": "${MYSQL_DATABASE}" } ], "resources": {}, "volumeMounts": [ { "name": "php-helloworld-data", "mountPath": "/var/lib/mysql/data" } ], "terminationMessagePath": "/dev/termination-log", "imagePullPolicy": "Always", "securityContext": { "capabilities": {}, "privileged": false } } ], "volumes": [ { "name": "php-helloworld-data", "emptyDir": { "medium": "" } } ], "restartPolicy": "Always", "dnsPolicy": "ClusterFirst" } } }, "status": {} } ], "parameters": [ { "name": "ADMIN_USERNAME", "description": "administrator username", "generate": "expression", "from": "admin[A-Z0-9]{3}" }, { "name": "ADMIN_PASSWORD", "description": "administrator password", "generate": "expression", "from": "[a-zA-Z0-9]{8}" }, { "name": "MYSQL_USER", "description": "database username", "generate": "expression", "from": "user[A-Z0-9]{3}", "required": true }, { "name": "MYSQL_PASSWORD", "description": "database password", "generate": "expression", "from": "[a-zA-Z0-9]{8}", "required": true }, { "name": "MYSQL_DATABASE", "description": "database name", "value": "root", "required": true } ], "labels": { "template": "application-template-stibuild" } }