diff --git a/openshift/django-source.json b/openshift/django-source.json new file mode 100644 index 0000000..7306e33 --- /dev/null +++ b/openshift/django-source.json @@ -0,0 +1,248 @@ +{ + "kind": "Template", + "apiVersion": "v1", + "metadata": { + "name": "django-quickstart-source", + "annotations": { + "description": "Django application template that uses the Source build strategy.", + "tags": "instant-app,python,django", + "iconClass" : "icon-python" + } + }, + "labels": { + "template": "django-quickstart-source" + }, + "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": "BuildConfig", + "apiVersion": "v1", + "metadata": { + "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": "${BUILDER_IMAGE_STREAM}" + } + } + }, + "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: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": "ImageStream", + "apiVersion": "v1", + "metadata": { + "name": "django-quickstart-source", + "annotations": { + "description": "Keeps track of changes in the Django app image." + } + } + }, + ], + "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" + }, + { + "name": "DATABASE_ENGINE", + "description": "Database engine: postgresql, mysql or sqlite (default)" + }, + { + "name": "DATABASE_NAME", + "description": "Database name" + }, + { + "name": "DATABASE_USER", + "description": "Database user name" + }, + { + "name": "DATABASE_PASSWORD", + "description": "Database user password" + }, + { + "name": "BUILDER_IMAGE_STREAM", + "description": "Image Stream of the builder image", + "value": "python-33-centos7" + }, + { + "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}" + } + ] +}