{ "kind": "Template", "apiVersion": "v1", "metadata": { "name": "django-quickstart-source-postgresql", "annotations": { "description": "Django application template that uses the Source build strategy and includes a PostgreSQL database server for storage.", "tags": "instant-app,python,django,postgresql", "iconClass" : "icon-python" } }, "labels": { "template": "django-quickstart-source-postgresql" }, "objects": [ { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "${FRONTEND_SERVICE_NAME}", "annotations": { "description": "Exposes and load balances the Django app instances." } }, "spec": { "ports": [ { "name": "web", "port": 8080, "targetPort": 8080 } ], "selector": { "name": "${FRONTEND_SERVICE_NAME}" } } }, { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "${DATABASE_SERVICE_NAME}", "annotations": { "description": "Exposes the PostgreSQL database server." } }, "spec": { "ports": [ { "name": "postgresql", "port": 5432, "targetPort": 5432 } ], "selector": { "name": "${DATABASE_SERVICE_NAME}" } } }, { "kind": "BuildConfig", "apiVersion": "v1", "metadata": { "name": "django-quickstart-source", "annotations": { "description": "Defines how to build the Django app." } }, "spec": { "source": { "type": "Git", "git": { "uri": "${GIT_REPOSITORY}" }, "contextDir": "${CONTEXT_DIR}" }, "strategy": { "type": "Source", "sourceStrategy": { "from": { "kind": "ImageStream", "name": "python-33-centos7" } } }, "output": { "to": { "kind": "ImageStream", "name": "django-quickstart-source" } }, "triggers": [ { "type": "imageChange" }, { "type": "github", "github": { "secret": "secret123" } }, { "type": "generic", "generic": { "secret": "secret123" } } ] } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "${FRONTEND_SERVICE_NAME}", "annotations": { "description": "Defines how to deploy the Django app." } }, "spec": { "strategy": { "type": "Rolling" }, "triggers": [ { "type": "ImageChange", "imageChangeParams": { "automatic": true, "containerNames": [ "django-quickstart" ], "from": { "name": "django-quickstart-source:latest" } } }, { "type": "ConfigChange" } ], "replicas": 1, "selector": { "name": "${FRONTEND_SERVICE_NAME}" }, "template": { "metadata": { "name": "${FRONTEND_SERVICE_NAME}", "labels": { "name": "${FRONTEND_SERVICE_NAME}" } }, "spec": { "containers": [ { "name": "django-quickstart", "image": "django-quickstart-source", "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": "APP_MODULE", "value": "${APP_MODULE}" }, { "name": "APP_CONFIG", "value": "${APP_CONFIG}" }, { "name": "DJANGO_SECRET_KEY", "value": "${DJANGO_SECRET_KEY}" } ] } ] } } } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "${DATABASE_SERVICE_NAME}", "labels": { "name": "${DATABASE_SERVICE_NAME}" }, "annotations": { "description": "Defines how to deploy the database." } }, "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": "postgresql", "image": "openshift/postgresql-92-centos7", "ports": [ { "containerPort": 5432 } ], "env": [ { "name": "POSTGRESQL_USER", "value": "${DATABASE_USER}" }, { "name": "POSTGRESQL_PASSWORD", "value": "${DATABASE_PASSWORD}" }, { "name": "POSTGRESQL_DATABASE", "value": "${DATABASE_NAME}" } ] } ] } } } }, { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "django-quickstart-source", "annotations": { "description": "Keeps track of changes in the Django app image." } } }, { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "python-33-centos7", "annotations": { "description": "Keeps track of changes in the Python base image." } }, "spec": { "dockerImageRepository": "openshift/python-33-centos7" } } ], "parameters": [ { "name": "GIT_REPOSITORY", "description": "Change this to match your project's Git repository", "value": "git://github.com/openshift/django-ex.git" }, { "name": "CONTEXT_DIR", "description": "Set this to the relative path to your project if it is not in the root of your repository" }, { "name": "FRONTEND_SERVICE_NAME", "description": "Frontend service name", "value": "django" }, { "name": "DATABASE_SERVICE_NAME", "description": "Database service name", "value": "postgresql" }, { "name": "DATABASE_NAME", "description": "Database name", "value": "default" }, { "name": "DATABASE_USER", "description": "Database user name", "value": "django" }, { "name": "DATABASE_PASSWORD", "description": "Database user password", "generate": "expression", "from": "[a-zA-Z0-9]{16}" }, { "name": "APP_MODULE", "description": "Python dotted path to your Django WSGI application", "value": "project.wsgi" }, { "name": "APP_CONFIG", "description": "Relative path to Gunicorn configuration file (optional)", "value": "gunicorn_conf.py" }, { "name": "DJANGO_SECRET_KEY", "description": "Django secret key", "generate": "expression", "from": "[\\w]{50}" } ] }