From 2d9c89e6bf374e6afac85026eb68c48a30d31bfe Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Mon, 1 Jun 2015 18:37:01 +0200 Subject: [PATCH] Update application template --- openshift/django-source-postgresql.json | 93 +++++++++++++------------ scripts/run-in-container.sh | 4 +- 2 files changed, 49 insertions(+), 48 deletions(-) diff --git a/openshift/django-source-postgresql.json b/openshift/django-source-postgresql.json index 8144e054..4d0056e9 100644 --- a/openshift/django-source-postgresql.json +++ b/openshift/django-source-postgresql.json @@ -2,15 +2,15 @@ "kind": "Template", "apiVersion": "v1", "metadata": { - "name": "django-quickstart", + "name": "django-quickstart-source-postgresql", "annotations": { - "description": "This is a Django application template that uses PostgreSQL for data storage.", + "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-sti" + "template": "django-quickstart-source-postgresql" }, "objects": [ { @@ -26,7 +26,7 @@ "ports": [ { "name": "web", - "port": 5432, + "port": 8080, "targetPort": 8080 } ], @@ -62,9 +62,6 @@ "apiVersion": "v1", "metadata": { "name": "django-quickstart", - "labels": { - "name": "django-quickstart" - }, "annotations": { "description": "Defines how to build the Django app." } @@ -89,7 +86,7 @@ "output": { "to": { "kind": "ImageStream", - "name": "django-quickstart" + "name": "django-quickstart-source" } }, "triggers": [ @@ -116,9 +113,6 @@ "apiVersion": "v1", "metadata": { "name": "${FRONTEND_SERVICE_NAME}", - "labels": { - "name": "${FRONTEND_SERVICE_NAME}" - }, "annotations": { "description": "Defines how to deploy the Django app." } @@ -144,7 +138,7 @@ "type": "ConfigChange" } ], - "replicas": 2, + "replicas": 1, "selector": { "name": "${FRONTEND_SERVICE_NAME}" }, @@ -159,7 +153,7 @@ "containers": [ { "name": "django-quickstart", - "image": "django-quickstart", + "image": "django-quickstart-source", "ports": [ { "containerPort": 8080 @@ -167,16 +161,16 @@ ], "env": [ { - "name": "APP_MODULE", - "value": "${APP_MODULE}" + "name": "DATABASE_SERVICE_NAME", + "value": "${DATABASE_SERVICE_NAME}" }, { - "name": "APP_CONFIG", - "value": "${APP_CONFIG}" + "name": "DATABASE_ENGINE", + "value": "${DATABASE_ENGINE}" }, { - "name": "DJANGO_SECRET_KEY", - "value": "${DJANGO_SECRET_KEY}" + "name": "DATABASE_NAME", + "value": "${DATABASE_NAME}" }, { "name": "DATABASE_USER", @@ -187,8 +181,16 @@ "value": "${DATABASE_PASSWORD}" }, { - "name": "DATABASE_NAME", - "value": "${DATABASE_NAME}" + "name": "APP_MODULE", + "value": "${APP_MODULE}" + }, + { + "name": "APP_CONFIG", + "value": "${APP_CONFIG}" + }, + { + "name": "DJANGO_SECRET_KEY", + "value": "${DJANGO_SECRET_KEY}" } ] } @@ -263,7 +265,7 @@ "kind": "ImageStream", "apiVersion": "v1", "metadata": { - "name": "django-quickstart", + "name": "django-quickstart-source", "annotations": { "description": "Keeps track of changes in the Django app image." } @@ -287,54 +289,53 @@ { "name": "GIT_REPOSITORY", "description": "Change this to match your project's Git repository", - "value": "git://github.com/rhcarvalho/openshift-django-quickstart.git" + "value": "git://github.com/openshift/django-ex.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" + "description": "Set this to the relative path to your project if it is not in the root of your repository" }, { - "name": "APP_CONFIG", - "description": "Relative path to Gunicorn configuration file (optional)", - "value": "gunicorn_conf.py" + "name": "FRONTEND_SERVICE_NAME", + "description": "Frontend service name", + "value": "django" }, { - "name": "DJANGO_SECRET_KEY", - "description": "Django secret key", - "generate": "expression", - "from": "[\\w]{50}" + "name": "DATABASE_SERVICE_NAME", + "description": "Database service name (PostgreSQL)", + "value": "database" }, { - "description": "Database name", "name": "DATABASE_NAME", + "description": "Database name", "value": "default" }, { - "description": "Database user name", "name": "DATABASE_USER", + "description": "Database user name", "value": "django" }, { - "description": "Database user password", "name": "DATABASE_PASSWORD", + "description": "Database user password", "generate": "expression", "from": "[a-zA-Z0-9]{16}" }, { - "description": "Frontend service name (Django)", - "name": "FRONTEND_SERVICE_NAME", - "value": "web" + "name": "APP_MODULE", + "description": "Python dotted path to your Django WSGI application", + "value": "project.wsgi" }, { - "description": "Database service name (PostgreSQL)", - "name": "DATABASE_SERVICE_NAME", - "value": "database" + "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}" } ] } diff --git a/scripts/run-in-container.sh b/scripts/run-in-container.sh index 964e4317..4eda1e1c 100755 --- a/scripts/run-in-container.sh +++ b/scripts/run-in-container.sh @@ -43,7 +43,7 @@ # ./run-in-container.sh ./manage.py createsuperuser # ./run-in-container.sh tail -f access.log # -# If your Python pods are labeled with a name other than "web", you can use: +# If your Python pods are labeled with a name other than "django", you can use: # # POD_NAME=something ./run-in-container.sh ./manage.py check # @@ -58,7 +58,7 @@ # Get name of a currently deployed pod by label and index POD_INSTANCE_NAME=`osc get pods \ - -l "name=${POD_NAME:-web}" \ + -l "name=${POD_NAME:-django}" \ -t "{{ with index .items ${POD_INDEX:-0} }}{{ .metadata.name }}{{ end }}"` # Run command in a container of the specified pod: