django-ex/openshift/templates/django-postgresql.json

517 lines
15 KiB
JSON
Raw Normal View History

2015-04-29 17:56:59 +02:00
{
"kind": "Template",
2015-06-11 17:19:47 +02:00
"apiVersion": "v1",
2015-04-29 17:56:59 +02:00
"metadata": {
"name": "django-psql-example",
2015-04-29 17:56:59 +02:00
"annotations": {
"openshift.io/display-name": "Django + PostgreSQL (Ephemeral)",
"description": "An example Django application with a PostgreSQL database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/django-ex/blob/master/README.md.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing.",
"tags": "quickstart,python,django",
"iconClass": "icon-python",
"openshift.io/long-description": "This template defines resources needed to develop a Django based 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/django-ex",
"openshift.io/support-url": "https://access.redhat.com"
2015-04-29 17:56:59 +02: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/django-ex/blob/master/README.md.",
2015-05-22 13:31:14 +02:00
"labels": {
"template": "django-psql-example"
2015-05-22 13:31:14 +02:00
},
"objects": [
2016-11-29 17:18:03 +01:00
{
"kind": "Secret",
"apiVersion": "v1",
"metadata": {
"name": "${NAME}"
},
"stringData" : {
2017-01-17 20:03:48 +01:00
"database-user" : "${DATABASE_USER}",
2017-01-18 18:13:16 +01:00
"database-password" : "${DATABASE_PASSWORD}",
"django-secret-key" : "${DJANGO_SECRET_KEY}"
2016-11-29 17:18:03 +01:00
}
},
2015-04-29 17:56:59 +02:00
{
"kind": "Service",
2015-06-11 17:19:47 +02:00
"apiVersion": "v1",
2015-04-29 17:56:59 +02:00
"metadata": {
2016-03-10 22:59:16 +01:00
"name": "${NAME}",
2015-04-29 17:56:59 +02:00
"annotations": {
2016-10-19 19:30:27 +02:00
"description": "Exposes and load balances the application pods",
"service.alpha.openshift.io/dependencies": "[{\"name\": \"${DATABASE_SERVICE_NAME}\", \"kind\": \"Service\"}]"
2015-04-29 17:56:59 +02:00
}
2015-05-22 13:31:14 +02:00
},
"spec": {
"ports": [
{
"name": "web",
2015-06-01 18:37:01 +02:00
"port": 8080,
2015-05-22 13:31:14 +02:00
"targetPort": 8080
}
],
"selector": {
2016-03-10 22:59:16 +01:00
"name": "${NAME}"
2015-05-22 13:31:14 +02:00
}
2015-04-29 17:56:59 +02:00
}
},
{
2015-06-11 21:05:29 +02:00
"kind": "Route",
2015-06-11 17:19:47 +02:00
"apiVersion": "v1",
2015-04-29 17:56:59 +02:00
"metadata": {
"name": "${NAME}",
"annotations": {
"template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}"
}
2015-05-22 13:31:14 +02:00
},
"spec": {
"host": "${APPLICATION_DOMAIN}",
2015-06-11 21:05:29 +02:00
"to": {
"kind": "Service",
2016-03-10 22:59:16 +01:00
"name": "${NAME}"
2015-05-22 13:31:14 +02:00
}
2015-04-29 17:56:59 +02:00
}
},
2015-06-08 21:31:12 +02:00
{
2015-06-11 21:05:29 +02:00
"kind": "ImageStream",
2015-06-11 17:19:47 +02:00
"apiVersion": "v1",
2015-06-08 21:31:12 +02:00
"metadata": {
2016-03-10 22:59:16 +01:00
"name": "${NAME}",
2015-06-11 21:05:29 +02:00
"annotations": {
"description": "Keeps track of changes in the application image"
}
2015-06-08 21:31:12 +02:00
}
},
2015-04-29 17:56:59 +02:00
{
"kind": "BuildConfig",
2015-06-11 17:19:47 +02:00
"apiVersion": "v1",
2015-04-29 17:56:59 +02:00
"metadata": {
2016-03-10 22:59:16 +01:00
"name": "${NAME}",
2015-05-22 13:31:14 +02:00
"annotations": {
2017-08-11 18:38:32 +02:00
"description": "Defines how to build the application",
"template.alpha.openshift.io/wait-for-ready": "true"
2015-05-22 13:31:14 +02:00
}
},
"spec": {
2015-04-29 17:56:59 +02:00
"source": {
"type": "Git",
"git": {
2015-06-16 12:07:49 +02:00
"uri": "${SOURCE_REPOSITORY_URL}",
"ref": "${SOURCE_REPOSITORY_REF}"
2015-05-22 13:31:14 +02:00
},
"contextDir": "${CONTEXT_DIR}"
2015-04-29 17:56:59 +02:00
},
2015-05-22 13:31:14 +02:00
"strategy": {
"type": "Source",
2015-05-24 21:07:24 +02:00
"sourceStrategy": {
2015-04-29 17:56:59 +02:00
"from": {
2015-06-11 21:05:29 +02:00
"kind": "ImageStreamTag",
2016-03-14 22:23:01 +01:00
"namespace": "${NAMESPACE}",
2016-07-13 19:26:20 +02:00
"name": "python:3.5"
},
"env": [
{
"name": "PIP_INDEX_URL",
"value": "${PIP_INDEX_URL}"
}
]
2015-04-29 17:56:59 +02:00
}
},
2015-05-22 13:31:14 +02:00
"output": {
"to": {
"kind": "ImageStreamTag",
2016-03-10 22:59:16 +01:00
"name": "${NAME}:latest"
2015-04-29 17:56:59 +02:00
}
},
2015-05-22 13:31:14 +02:00
"triggers": [
{
2015-06-11 17:19:47 +02:00
"type": "ImageChange"
2015-05-22 13:31:14 +02:00
},
2015-11-21 00:26:32 +01:00
{
"type": "ConfigChange"
},
2015-05-22 13:31:14 +02:00
{
2015-06-11 17:19:47 +02:00
"type": "GitHub",
2015-05-22 13:31:14 +02:00
"github": {
2015-06-11 21:05:29 +02:00
"secret": "${GITHUB_WEBHOOK_SECRET}"
2015-05-22 13:31:14 +02:00
}
2015-04-29 17:56:59 +02:00
}
],
"postCommit": {
"script": "./manage.py test"
}
2015-05-22 13:31:14 +02:00
}
2015-04-29 17:56:59 +02:00
},
{
"kind": "DeploymentConfig",
2015-06-11 17:19:47 +02:00
"apiVersion": "v1",
2015-04-29 17:56:59 +02:00
"metadata": {
2016-03-10 22:59:16 +01:00
"name": "${NAME}",
2015-04-29 17:56:59 +02:00
"annotations": {
2017-08-11 18:38:32 +02:00
"description": "Defines how to deploy the application server",
"template.alpha.openshift.io/wait-for-ready": "true"
2015-04-29 17:56:59 +02:00
}
},
2015-05-22 13:31:14 +02:00
"spec": {
"strategy": {
"type": "Recreate"
2015-05-22 13:31:14 +02:00
},
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"django-psql-example"
2015-05-22 13:31:14 +02:00
],
"from": {
2015-06-11 21:05:29 +02:00
"kind": "ImageStreamTag",
2016-03-10 22:59:16 +01:00
"name": "${NAME}:latest"
2015-04-29 17:56:59 +02:00
}
}
2015-05-25 22:31:57 +02:00
},
{
"type": "ConfigChange"
2015-04-29 17:56:59 +02:00
}
2015-05-22 13:31:14 +02:00
],
2015-06-01 18:37:01 +02:00
"replicas": 1,
2015-05-22 13:31:14 +02:00
"selector": {
2016-03-10 22:59:16 +01:00
"name": "${NAME}"
2015-04-29 17:56:59 +02:00
},
2015-05-22 13:31:14 +02:00
"template": {
2015-05-22 15:33:35 +02:00
"metadata": {
2016-03-10 22:59:16 +01:00
"name": "${NAME}",
2015-05-22 15:33:35 +02:00
"labels": {
2016-03-10 22:59:16 +01:00
"name": "${NAME}"
2015-05-22 15:33:35 +02:00
}
},
2015-05-22 13:31:14 +02:00
"spec": {
"containers": [
{
"name": "django-psql-example",
"image": " ",
2015-05-22 13:31:14 +02:00
"ports": [
{
"containerPort": 8080
}
],
2016-02-29 16:19:42 +01:00
"readinessProbe": {
"timeoutSeconds": 3,
"initialDelaySeconds": 3,
"httpGet": {
"path": "/health",
"port": 8080
}
},
"livenessProbe": {
"timeoutSeconds": 3,
"initialDelaySeconds": 30,
"httpGet": {
"path": "/health",
"port": 8080
}
},
2015-05-22 13:31:14 +02:00
"env": [
{
2015-06-01 18:37:01 +02:00
"name": "DATABASE_SERVICE_NAME",
"value": "${DATABASE_SERVICE_NAME}"
2015-05-22 13:31:14 +02:00
},
2015-05-22 16:38:15 +02:00
{
2015-06-01 18:37:01 +02:00
"name": "DATABASE_ENGINE",
"value": "${DATABASE_ENGINE}"
2015-05-22 16:38:15 +02:00
},
2015-05-22 13:31:14 +02:00
{
2015-06-01 18:37:01 +02:00
"name": "DATABASE_NAME",
"value": "${DATABASE_NAME}"
2015-05-22 13:31:14 +02:00
},
{
2015-05-22 15:34:11 +02:00
"name": "DATABASE_USER",
2016-11-29 17:18:03 +01:00
"valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
2017-01-17 20:03:48 +01:00
"key" : "database-user"
2016-11-29 17:18:03 +01:00
}
}
2015-05-22 15:34:11 +02:00
},
{
"name": "DATABASE_PASSWORD",
2016-11-29 17:18:03 +01:00
"valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
2017-01-17 20:03:48 +01:00
"key" : "database-password"
2016-11-29 17:18:03 +01:00
}
}
2015-05-22 15:34:11 +02:00
},
2015-06-01 18:37:01 +02:00
{
"name": "APP_CONFIG",
"value": "${APP_CONFIG}"
},
{
"name": "DJANGO_SECRET_KEY",
2017-01-18 18:13:16 +01:00
"valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "django-secret-key"
}
}
2015-05-22 13:31:14 +02:00
}
2016-02-25 00:28:13 +01:00
],
"resources": {
2016-02-29 16:19:42 +01:00
"limits": {
"memory": "${MEMORY_LIMIT}"
}
2016-02-25 00:28:13 +01:00
}
2015-04-29 17:56:59 +02:00
}
2015-05-22 13:31:14 +02:00
]
2015-04-29 17:56:59 +02:00
}
}
2015-05-22 13:31:14 +02:00
}
2015-04-29 17:56:59 +02:00
},
{
2015-06-11 21:05:29 +02:00
"kind": "Service",
2015-06-11 17:19:47 +02:00
"apiVersion": "v1",
2015-04-29 17:56:59 +02:00
"metadata": {
2015-05-22 13:31:14 +02:00
"name": "${DATABASE_SERVICE_NAME}",
2015-06-11 21:05:29 +02:00
"annotations": {
"description": "Exposes the database server"
}
},
"spec": {
"ports": [
{
"name": "postgresql",
"port": 5432,
"targetPort": 5432
}
],
"selector": {
2015-05-22 13:31:14 +02:00
"name": "${DATABASE_SERVICE_NAME}"
2015-06-11 21:05:29 +02:00
}
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "${DATABASE_SERVICE_NAME}",
2015-04-29 17:56:59 +02:00
"annotations": {
"description": "Defines how to deploy the database",
"template.alpha.openshift.io/wait-for-ready": "true"
2015-04-29 17:56:59 +02:00
}
},
2015-05-22 13:31:14 +02:00
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [
2015-11-21 00:26:32 +01:00
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
2015-11-21 00:26:32 +01:00
"containerNames": [
"postgresql"
],
"from": {
"kind": "ImageStreamTag",
2016-03-14 22:23:01 +01:00
"namespace": "${NAMESPACE}",
2016-07-13 19:26:20 +02:00
"name": "postgresql:9.5"
2015-11-21 00:26:32 +01:00
}
}
},
2015-05-22 13:31:14 +02:00
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"name": "${DATABASE_SERVICE_NAME}"
},
"template": {
2015-05-22 15:33:35 +02:00
"metadata": {
"name": "${DATABASE_SERVICE_NAME}",
"labels": {
"name": "${DATABASE_SERVICE_NAME}"
}
},
2015-05-22 13:31:14 +02:00
"spec": {
2016-05-12 18:59:41 +02:00
"volumes": [
{
"name": "data",
"emptyDir": {}
}
],
2015-05-22 13:31:14 +02:00
"containers": [
{
"name": "postgresql",
"image": " ",
2015-05-22 13:31:14 +02:00
"ports": [
2015-04-29 17:56:59 +02:00
{
2015-05-22 13:31:14 +02:00
"containerPort": 5432
}
],
"env": [
{
"name": "POSTGRESQL_USER",
2016-11-29 17:18:03 +01:00
"valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
2017-01-17 20:03:48 +01:00
"key" : "database-user"
2016-11-29 17:18:03 +01:00
}
}
2015-05-22 13:31:14 +02:00
},
{
"name": "POSTGRESQL_PASSWORD",
2016-11-29 17:18:03 +01:00
"valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
2017-01-17 20:03:48 +01:00
"key" : "database-password"
2016-11-29 17:18:03 +01:00
}
}
2015-05-22 13:31:14 +02:00
},
{
"name": "POSTGRESQL_DATABASE",
"value": "${DATABASE_NAME}"
2015-04-29 17:56:59 +02:00
}
2016-02-25 00:28:13 +01:00
],
2016-05-12 18:59:41 +02:00
"volumeMounts": [
{
"name": "data",
"mountPath": "/var/lib/pgsql/data"
}
],
2016-02-29 16:19:42 +01:00
"readinessProbe": {
"timeoutSeconds": 1,
"initialDelaySeconds": 5,
"exec": {
"command": [ "/bin/sh", "-i", "-c", "psql -h 127.0.0.1 -U ${POSTGRESQL_USER} -q -d ${POSTGRESQL_DATABASE} -c 'SELECT 1'"]
}
},
"livenessProbe": {
"timeoutSeconds": 1,
"initialDelaySeconds": 30,
"tcpSocket": {
"port": 5432
}
},
2016-02-25 00:28:13 +01:00
"resources": {
2016-02-29 16:19:42 +01:00
"limits": {
"memory": "${MEMORY_POSTGRESQL_LIMIT}"
}
2016-02-25 00:28:13 +01:00
}
2015-04-29 17:56:59 +02:00
}
2015-05-22 13:31:14 +02:00
]
2015-04-29 17:56:59 +02:00
}
}
2015-05-22 13:31:14 +02:00
}
2015-04-29 17:56:59 +02:00
}
],
"parameters": [
2016-03-10 22:59:16 +01:00
{
"name": "NAME",
"displayName": "Name",
"description": "The name assigned to all of the frontend objects defined in this template.",
"required": true,
"value": "django-psql-example"
},
2016-03-14 22:23:01 +01:00
{
"name": "NAMESPACE",
"displayName": "Namespace",
"required": true,
2016-03-14 22:23:01 +01:00
"description": "The OpenShift Namespace where the ImageStream resides.",
"value": "openshift"
},
2016-02-25 00:28:13 +01:00
{
"name": "MEMORY_LIMIT",
2016-03-07 17:12:12 +01:00
"displayName": "Memory Limit",
"required": true,
2016-03-07 17:12:12 +01:00
"description": "Maximum amount of memory the Django container can use.",
2016-03-01 04:09:26 +01:00
"value": "512Mi"
2016-02-25 00:28:13 +01:00
},
{
"name": "MEMORY_POSTGRESQL_LIMIT",
2016-03-07 17:12:12 +01:00
"displayName": "Memory Limit (PostgreSQL)",
"required": true,
2016-03-07 17:12:12 +01:00
"description": "Maximum amount of memory the PostgreSQL container can use.",
2016-03-01 04:09:26 +01:00
"value": "512Mi"
2016-02-25 00:28:13 +01:00
},
2015-04-29 17:56:59 +02:00
{
2015-06-11 21:05:29 +02:00
"name": "SOURCE_REPOSITORY_URL",
2016-03-07 17:12:12 +01:00
"displayName": "Git Repository URL",
"required": true,
2016-03-07 17:12:12 +01:00
"description": "The URL of the repository with your application source code.",
2015-06-11 21:05:29 +02:00
"value": "https://github.com/openshift/django-ex.git"
2015-04-29 17:56:59 +02:00
},
2015-06-16 12:07:49 +02:00
{
"name": "SOURCE_REPOSITORY_REF",
2016-03-07 17:12:12 +01: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-16 12:07:49 +02:00
},
2015-04-29 17:56:59 +02:00
{
2015-05-22 13:31:14 +02:00
"name": "CONTEXT_DIR",
2016-03-07 17:12:12 +01: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-04-29 17:56:59 +02:00
},
2015-05-22 16:38:15 +02:00
{
"name": "APPLICATION_DOMAIN",
2016-03-07 17:12:12 +01:00
"displayName": "Application Hostname",
2015-08-18 19:19:30 +02:00
"description": "The exposed hostname that will route to the Django service, if left blank a value will be defaulted.",
"value": ""
2015-05-22 16:38:15 +02:00
},
2015-06-08 21:31:12 +02:00
{
2015-06-11 21:05:29 +02:00
"name": "GITHUB_WEBHOOK_SECRET",
2016-03-07 17:12:12 +01:00
"displayName": "GitHub Webhook Secret",
"description": "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted.",
2015-06-11 21:05:29 +02:00
"generate": "expression",
"from": "[a-zA-Z0-9]{40}"
2015-06-08 21:31:12 +02:00
},
2015-05-22 13:31:14 +02:00
{
2015-06-01 18:37:01 +02:00
"name": "DATABASE_SERVICE_NAME",
2016-03-07 17:12:12 +01:00
"displayName": "Database Service Name",
"required": true,
"value": "postgresql"
2015-04-29 17:56:59 +02:00
},
2015-06-02 16:19:11 +02:00
{
"name": "DATABASE_ENGINE",
2016-03-07 17:12:12 +01:00
"displayName": "Database Engine",
"required": true,
2016-03-07 17:12:12 +01:00
"description": "Database engine: postgresql, mysql or sqlite (default).",
2015-06-02 16:19:11 +02:00
"value": "postgresql"
},
2015-04-29 17:56:59 +02:00
{
"name": "DATABASE_NAME",
2016-03-07 17:12:12 +01:00
"displayName": "Database Name",
"required": true,
2015-04-29 17:56:59 +02:00
"value": "default"
},
{
"name": "DATABASE_USER",
2016-03-07 17:12:12 +01:00
"displayName": "Database Username",
"required": true,
2015-05-22 13:31:14 +02:00
"value": "django"
2015-04-29 17:56:59 +02:00
},
{
"name": "DATABASE_PASSWORD",
2016-03-07 17:12:12 +01:00
"displayName": "Database User Password",
2015-04-29 17:56:59 +02:00
"generate": "expression",
"from": "[a-zA-Z0-9]{16}"
2015-05-22 13:31:14 +02:00
},
{
2015-06-01 18:37:01 +02:00
"name": "APP_CONFIG",
2016-03-07 17:12:12 +01:00
"displayName": "Application Configuration File Path",
"description": "Relative path to Gunicorn configuration file (optional)."
2015-06-01 18:37:01 +02:00
},
{
"name": "DJANGO_SECRET_KEY",
2016-06-09 14:59:13 +02:00
"displayName": "Django Secret Key",
2016-03-07 17:12:12 +01:00
"description": "Set this to a long random string.",
2015-06-01 18:37:01 +02:00
"generate": "expression",
"from": "[\\w]{50}"
},
{
"name": "PIP_INDEX_URL",
"displayName": "Custom PyPi Index URL",
"description": "The custom PyPi index URL",
"value": ""
2015-04-29 17:56:59 +02:00
}
]
}