2016-09-13 15:44:51 +02:00
{
"kind" : "Template" ,
"apiVersion" : "v1" ,
"metadata" : {
"name" : "django-psql-persistent" ,
"annotations" : {
2017-11-09 17:06:49 +01:00
"openshift.io/display-name" : "Django + PostgreSQL" ,
2018-07-24 17:39:33 +02:00
"description" : "An example Django application with a PostgreSQL database. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/django-ex/blob/master/README.md." ,
2016-10-24 22:33:48 +02:00
"tags" : "quickstart,python,django" ,
2017-02-14 20:41:32 +01:00
"iconClass" : "icon-python" ,
2017-10-19 14:42:05 +02:00
"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." ,
"openshift.io/provider-display-name" : "Red Hat, Inc." ,
2018-07-24 17:39:33 +02:00
"openshift.io/documentation-url" : "https://github.com/sclorg/django-ex" ,
2017-11-07 20:03:41 +01:00
"openshift.io/support-url" : "https://access.redhat.com" ,
"template.openshift.io/bindable" : "false"
2016-09-13 15:44:51 +02:00
}
} ,
2018-07-24 17:39:33 +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/sclorg/django-ex/blob/master/README.md." ,
2016-09-13 15:44:51 +02:00
"labels" : {
2017-11-09 17:06:49 +01:00
"template" : "django-psql-persistent" ,
"app" : "django-psql-persistent"
2016-09-13 15:44:51 +02:00
} ,
"objects" : [
2016-11-29 17:18:03 +01:00
{
"kind" : "Secret" ,
"apiVersion" : "v1" ,
"metadata" : {
"name" : "${NAME}"
} ,
"stringData" : {
2017-01-18 18:13:16 +01:00
"database-user" : "${DATABASE_USER}" ,
"database-password" : "${DATABASE_PASSWORD}" ,
"django-secret-key" : "${DJANGO_SECRET_KEY}"
2016-11-29 17:18:03 +01:00
}
} ,
2016-09-13 15:44:51 +02:00
{
"kind" : "Service" ,
"apiVersion" : "v1" ,
"metadata" : {
"name" : "${NAME}" ,
"annotations" : {
2016-10-19 19:30:27 +02:00
"description" : "Exposes and load balances the application pods" ,
2016-10-24 22:33:48 +02:00
"service.alpha.openshift.io/dependencies" : "[{\"name\": \"${DATABASE_SERVICE_NAME}\", \"kind\": \"Service\"}]"
2016-09-13 15:44:51 +02:00
}
} ,
"spec" : {
"ports" : [
{
"name" : "web" ,
"port" : 8080 ,
"targetPort" : 8080
}
] ,
"selector" : {
"name" : "${NAME}"
}
}
} ,
{
"kind" : "Route" ,
"apiVersion" : "v1" ,
"metadata" : {
2017-11-07 20:03:41 +01:00
"name" : "${NAME}"
2016-09-13 15:44:51 +02:00
} ,
"spec" : {
"host" : "${APPLICATION_DOMAIN}" ,
"to" : {
"kind" : "Service" ,
"name" : "${NAME}"
}
}
} ,
{
"kind" : "ImageStream" ,
"apiVersion" : "v1" ,
"metadata" : {
"name" : "${NAME}" ,
"annotations" : {
"description" : "Keeps track of changes in the application image"
}
}
} ,
{
"kind" : "BuildConfig" ,
"apiVersion" : "v1" ,
"metadata" : {
"name" : "${NAME}" ,
"annotations" : {
2017-08-11 18:38:32 +02:00
"description" : "Defines how to build the application" ,
"template.alpha.openshift.io/wait-for-ready" : "true"
2016-09-13 15:44:51 +02:00
}
} ,
"spec" : {
"source" : {
"type" : "Git" ,
"git" : {
"uri" : "${SOURCE_REPOSITORY_URL}" ,
"ref" : "${SOURCE_REPOSITORY_REF}"
} ,
"contextDir" : "${CONTEXT_DIR}"
} ,
"strategy" : {
"type" : "Source" ,
"sourceStrategy" : {
"from" : {
"kind" : "ImageStreamTag" ,
"namespace" : "${NAMESPACE}" ,
2017-12-22 11:05:59 +01:00
"name" : "python:${PYTHON_VERSION}"
2016-09-13 15:44:51 +02:00
} ,
"env" : [
{
"name" : "PIP_INDEX_URL" ,
"value" : "${PIP_INDEX_URL}"
}
]
}
} ,
"output" : {
"to" : {
"kind" : "ImageStreamTag" ,
"name" : "${NAME}:latest"
}
} ,
"triggers" : [
{
"type" : "ImageChange"
} ,
{
"type" : "ConfigChange"
} ,
{
"type" : "GitHub" ,
"github" : {
"secret" : "${GITHUB_WEBHOOK_SECRET}"
}
}
] ,
"postCommit" : {
"script" : "./manage.py test"
}
}
} ,
{
"kind" : "DeploymentConfig" ,
"apiVersion" : "v1" ,
"metadata" : {
"name" : "${NAME}" ,
"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"
2016-09-13 15:44:51 +02:00
}
} ,
"spec" : {
"strategy" : {
2017-04-25 22:52:07 +02:00
"type" : "Recreate"
2016-09-13 15:44:51 +02:00
} ,
"triggers" : [
{
"type" : "ImageChange" ,
"imageChangeParams" : {
"automatic" : true ,
"containerNames" : [
"django-psql-persistent"
] ,
"from" : {
"kind" : "ImageStreamTag" ,
"name" : "${NAME}:latest"
}
}
} ,
{
"type" : "ConfigChange"
}
] ,
"replicas" : 1 ,
"selector" : {
"name" : "${NAME}"
} ,
"template" : {
"metadata" : {
"name" : "${NAME}" ,
"labels" : {
"name" : "${NAME}"
}
} ,
"spec" : {
"containers" : [
{
"name" : "django-psql-persistent" ,
"image" : " " ,
"ports" : [
{
"containerPort" : 8080
}
] ,
"readinessProbe" : {
"timeoutSeconds" : 3 ,
"initialDelaySeconds" : 3 ,
"httpGet" : {
"path" : "/health" ,
"port" : 8080
}
} ,
"livenessProbe" : {
"timeoutSeconds" : 3 ,
"initialDelaySeconds" : 30 ,
"httpGet" : {
"path" : "/health" ,
"port" : 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" ,
2016-11-29 17:18:03 +01:00
"valueFrom" : {
"secretKeyRef" : {
"name" : "${NAME}" ,
2017-01-18 18:13:16 +01:00
"key" : "database-user"
2016-11-29 17:18:03 +01:00
}
}
2016-09-13 15:44:51 +02:00
} ,
{
"name" : "DATABASE_PASSWORD" ,
2016-11-29 17:18:03 +01:00
"valueFrom" : {
"secretKeyRef" : {
"name" : "${NAME}" ,
2017-01-18 18:13:16 +01:00
"key" : "database-password"
2016-11-29 17:18:03 +01:00
}
}
2016-09-13 15:44:51 +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"
}
}
2016-09-13 15:44:51 +02:00
}
] ,
"resources" : {
"limits" : {
"memory" : "${MEMORY_LIMIT}"
}
}
}
]
}
}
}
} ,
{
"kind" : "PersistentVolumeClaim" ,
"apiVersion" : "v1" ,
"metadata" : {
"name" : "${DATABASE_SERVICE_NAME}"
} ,
"spec" : {
"accessModes" : [
"ReadWriteOnce"
] ,
"resources" : {
"requests" : {
"storage" : "${VOLUME_CAPACITY}"
}
}
}
} ,
{
"kind" : "Service" ,
"apiVersion" : "v1" ,
"metadata" : {
"name" : "${DATABASE_SERVICE_NAME}" ,
"annotations" : {
"description" : "Exposes the database server"
}
} ,
"spec" : {
"ports" : [
{
"name" : "postgresql" ,
"port" : 5432 ,
"targetPort" : 5432
}
] ,
"selector" : {
"name" : "${DATABASE_SERVICE_NAME}"
}
}
} ,
{
"kind" : "DeploymentConfig" ,
"apiVersion" : "v1" ,
"metadata" : {
"name" : "${DATABASE_SERVICE_NAME}" ,
"annotations" : {
2017-08-18 19:14:10 +02:00
"description" : "Defines how to deploy the database" ,
"template.alpha.openshift.io/wait-for-ready" : "true"
2016-09-13 15:44:51 +02:00
}
} ,
"spec" : {
"strategy" : {
"type" : "Recreate"
} ,
"triggers" : [
{
"type" : "ImageChange" ,
"imageChangeParams" : {
"automatic" : true ,
"containerNames" : [
"postgresql"
] ,
"from" : {
"kind" : "ImageStreamTag" ,
"namespace" : "${NAMESPACE}" ,
2017-12-22 13:12:41 +01:00
"name" : "postgresql:${POSTGRESQL_VERSION}"
2016-09-13 15:44:51 +02:00
}
}
} ,
{
"type" : "ConfigChange"
}
] ,
"replicas" : 1 ,
"selector" : {
"name" : "${DATABASE_SERVICE_NAME}"
} ,
"template" : {
"metadata" : {
"name" : "${DATABASE_SERVICE_NAME}" ,
"labels" : {
"name" : "${DATABASE_SERVICE_NAME}"
}
} ,
"spec" : {
"volumes" : [
{
"name" : "${DATABASE_SERVICE_NAME}-data" ,
"persistentVolumeClaim" : {
"claimName" : "${DATABASE_SERVICE_NAME}"
}
}
] ,
"containers" : [
{
"name" : "postgresql" ,
"image" : " " ,
"ports" : [
{
"containerPort" : 5432
}
] ,
"env" : [
{
"name" : "POSTGRESQL_USER" ,
2016-11-29 17:18:03 +01:00
"valueFrom" : {
"secretKeyRef" : {
"name" : "${NAME}" ,
2017-01-18 19:47:08 +01:00
"key" : "database-user"
2016-11-29 17:18:03 +01:00
}
}
2016-09-13 15:44:51 +02:00
} ,
{
"name" : "POSTGRESQL_PASSWORD" ,
2016-11-29 17:18:03 +01:00
"valueFrom" : {
"secretKeyRef" : {
"name" : "${NAME}" ,
2017-01-18 19:47:08 +01:00
"key" : "database-password"
2016-11-29 17:18:03 +01:00
}
}
2016-09-13 15:44:51 +02:00
} ,
{
"name" : "POSTGRESQL_DATABASE" ,
"value" : "${DATABASE_NAME}"
}
] ,
"volumeMounts" : [
{
"name" : "${DATABASE_SERVICE_NAME}-data" ,
"mountPath" : "/var/lib/pgsql/data"
}
] ,
"readinessProbe" : {
"timeoutSeconds" : 1 ,
"initialDelaySeconds" : 5 ,
"exec" : {
2018-02-28 15:58:41 +01:00
"command" : [ "/usr/libexec/check-container" ]
2016-09-13 15:44:51 +02:00
}
} ,
"livenessProbe" : {
2018-02-28 15:58:41 +01:00
"timeoutSeconds" : 10 ,
"initialDelaySeconds" : 120 ,
"exec" : {
"command" : [ "/usr/libexec/check-container" , "--live" ]
2016-09-13 15:44:51 +02:00
}
} ,
"resources" : {
"limits" : {
"memory" : "${MEMORY_POSTGRESQL_LIMIT}"
}
}
}
]
}
}
}
}
] ,
"parameters" : [
{
"name" : "NAME" ,
"displayName" : "Name" ,
"description" : "The name assigned to all of the frontend objects defined in this template." ,
"required" : true ,
"value" : "django-psql-persistent"
} ,
{
"name" : "NAMESPACE" ,
"displayName" : "Namespace" ,
"required" : true ,
"description" : "The OpenShift Namespace where the ImageStream resides." ,
"value" : "openshift"
} ,
2017-12-22 11:05:59 +01:00
{
"name" : "PYTHON_VERSION" ,
"displayName" : "Version of Python Image" ,
"description" : "Version of Python image to be used (3.4, 3.5, 3.6 or latest)." ,
"value" : "3.6" ,
"required" : true
} ,
2017-12-22 13:12:41 +01:00
{
"name" : "POSTGRESQL_VERSION" ,
"displayName" : "Version of PostgreSQL Image" ,
"description" : "Version of PostgreSQL image to be used (9.4, 9.5, 9.6 or latest)." ,
"value" : "9.6" ,
"required" : true
} ,
2016-09-13 15:44:51 +02:00
{
"name" : "MEMORY_LIMIT" ,
"displayName" : "Memory Limit" ,
"required" : true ,
"description" : "Maximum amount of memory the Django container can use." ,
"value" : "512Mi"
} ,
{
"name" : "MEMORY_POSTGRESQL_LIMIT" ,
"displayName" : "Memory Limit (PostgreSQL)" ,
"required" : true ,
"description" : "Maximum amount of memory the PostgreSQL container can use." ,
"value" : "512Mi"
} ,
{
"name" : "VOLUME_CAPACITY" ,
"displayName" : "Volume Capacity" ,
"description" : "Volume space available for data, e.g. 512Mi, 2Gi" ,
"value" : "1Gi" ,
"required" : true
} ,
{
"name" : "SOURCE_REPOSITORY_URL" ,
"displayName" : "Git Repository URL" ,
"required" : true ,
"description" : "The URL of the repository with your application source code." ,
2018-07-24 17:39:33 +02:00
"value" : "https://github.com/sclorg/django-ex.git"
2016-09-13 15:44:51 +02:00
} ,
{
"name" : "SOURCE_REPOSITORY_REF" ,
"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."
} ,
{
"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 Hostname" ,
"description" : "The exposed hostname that will route to the Django service, if left blank a value will be defaulted." ,
"value" : ""
} ,
{
"name" : "GITHUB_WEBHOOK_SECRET" ,
"displayName" : "GitHub Webhook Secret" ,
2017-06-26 05:05:35 +02:00
"description" : "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted." ,
2016-09-13 15:44:51 +02:00
"generate" : "expression" ,
"from" : "[a-zA-Z0-9]{40}"
} ,
{
"name" : "DATABASE_SERVICE_NAME" ,
"displayName" : "Database Service Name" ,
"required" : true ,
"value" : "postgresql"
} ,
{
"name" : "DATABASE_ENGINE" ,
"displayName" : "Database Engine" ,
"required" : true ,
"description" : "Database engine: postgresql, mysql or sqlite (default)." ,
"value" : "postgresql"
} ,
{
"name" : "DATABASE_NAME" ,
"displayName" : "Database Name" ,
"required" : true ,
"value" : "default"
} ,
{
"name" : "DATABASE_USER" ,
"displayName" : "Database Username" ,
"required" : true ,
"value" : "django"
} ,
{
"name" : "DATABASE_PASSWORD" ,
"displayName" : "Database User Password" ,
"generate" : "expression" ,
"from" : "[a-zA-Z0-9]{16}"
} ,
{
"name" : "APP_CONFIG" ,
"displayName" : "Application Configuration File Path" ,
"description" : "Relative path to Gunicorn configuration file (optional)."
} ,
{
"name" : "DJANGO_SECRET_KEY" ,
"displayName" : "Django Secret Key" ,
"description" : "Set this to a long random string." ,
"generate" : "expression" ,
"from" : "[\\w]{50}"
} ,
{
"name" : "PIP_INDEX_URL" ,
"displayName" : "Custom PyPi Index URL" ,
"description" : "The custom PyPi index URL" ,
"value" : ""
}
]
}