{ "kind": "Template", "apiVersion": "v1", "metadata": { "name": "django-quickstart", "annotations": { "description": "This is a Django application template that uses PostgreSQL for data storage.", "tags": "instant-app,python,django,postgresql", "iconClass" : "icon-python" } }, "labels": { "template": "django-quickstart-sti" }, "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": 5432, "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", "labels": { "name": "django-quickstart" }, "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" } }, "triggers": [ { "type": "imageChange", "imageChange": {} }, { "type": "github", "github": { "secret": "secret123" } }, { "type": "generic", "generic": { "secret": "secret123" } } ] } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "${FRONTEND_SERVICE_NAME}", "labels": { "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" } } } ], "replicas": 2, "selector": { "name": "${FRONTEND_SERVICE_NAME}" }, "template": { "spec": { "containers": [ { "name": "django-quickstart", "image": "django-quickstart", "ports": [ { "containerPort": 8080 } ], "env": [ { "name": "APP_MODULE", "value": "${APP_MODULE}" }, { "name": "DJANGO_SECRET_KEY", "value": "${DJANGO_SECRET_KEY}" }, { "name": "DATABASE_URL", "value": "postgres://${DATABASE_USER}:${DATABASE_PASSWORD}@$DATABASE_SERVICE_HOST:$DATABASE_SERVICE_PORT/${DATABASE_NAME}" } ] } ] } } } }, { "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": { "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", "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/rhcarvalho/openshift-django-quickstart.git" }, { "name": "CONTEXT_DIR", "description": "Change this to the relative path to your project if it is not in the root of your repository", "value": "" }, { "name": "APP_MODULE", "description": "Python dotted path to your Django WSGI application", "value": "project.wsgi" }, { "name": "DJANGO_SECRET_KEY", "description": "Django secret key", "generate": "expression", "from": "[\\w]{50}" }, { "description": "Database name", "name": "DATABASE_NAME", "value": "default" }, { "description": "Database user name", "name": "DATABASE_USER", "value": "django" }, { "description": "Database user password", "name": "DATABASE_PASSWORD", "generate": "expression", "from": "[a-zA-Z0-9]{16}" }, { "description": "Frontend service name (Django)", "name": "FRONTEND_SERVICE_NAME", "value": "web" }, { "description": "Database service name (PostgreSQL)", "name": "DATABASE_SERVICE_NAME", "value": "database" } ] }