Browse Source

Update application template

pull/2/merge
Rodolfo Carvalho 10 years ago
parent
commit
2d9c89e6bf
2 changed files with 49 additions and 48 deletions
  1. +47
    -46
      openshift/django-source-postgresql.json
  2. +2
    -2
      scripts/run-in-container.sh

+ 47
- 46
openshift/django-source-postgresql.json View File

@ -2,15 +2,15 @@
"kind": "Template", "kind": "Template",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "django-quickstart",
"name": "django-quickstart-source-postgresql",
"annotations": { "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", "tags": "instant-app,python,django,postgresql",
"iconClass" : "icon-python" "iconClass" : "icon-python"
} }
}, },
"labels": { "labels": {
"template": "django-quickstart-sti"
"template": "django-quickstart-source-postgresql"
}, },
"objects": [ "objects": [
{ {
@ -26,7 +26,7 @@
"ports": [ "ports": [
{ {
"name": "web", "name": "web",
"port": 5432,
"port": 8080,
"targetPort": 8080 "targetPort": 8080
} }
], ],
@ -62,9 +62,6 @@
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "django-quickstart", "name": "django-quickstart",
"labels": {
"name": "django-quickstart"
},
"annotations": { "annotations": {
"description": "Defines how to build the Django app." "description": "Defines how to build the Django app."
} }
@ -89,7 +86,7 @@
"output": { "output": {
"to": { "to": {
"kind": "ImageStream", "kind": "ImageStream",
"name": "django-quickstart"
"name": "django-quickstart-source"
} }
}, },
"triggers": [ "triggers": [
@ -116,9 +113,6 @@
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "${FRONTEND_SERVICE_NAME}", "name": "${FRONTEND_SERVICE_NAME}",
"labels": {
"name": "${FRONTEND_SERVICE_NAME}"
},
"annotations": { "annotations": {
"description": "Defines how to deploy the Django app." "description": "Defines how to deploy the Django app."
} }
@ -144,7 +138,7 @@
"type": "ConfigChange" "type": "ConfigChange"
} }
], ],
"replicas": 2,
"replicas": 1,
"selector": { "selector": {
"name": "${FRONTEND_SERVICE_NAME}" "name": "${FRONTEND_SERVICE_NAME}"
}, },
@ -159,7 +153,7 @@
"containers": [ "containers": [
{ {
"name": "django-quickstart", "name": "django-quickstart",
"image": "django-quickstart",
"image": "django-quickstart-source",
"ports": [ "ports": [
{ {
"containerPort": 8080 "containerPort": 8080
@ -167,16 +161,16 @@
], ],
"env": [ "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", "name": "DATABASE_USER",
@ -187,8 +181,16 @@
"value": "${DATABASE_PASSWORD}" "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", "kind": "ImageStream",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "django-quickstart",
"name": "django-quickstart-source",
"annotations": { "annotations": {
"description": "Keeps track of changes in the Django app image." "description": "Keeps track of changes in the Django app image."
} }
@ -287,54 +289,53 @@
{ {
"name": "GIT_REPOSITORY", "name": "GIT_REPOSITORY",
"description": "Change this to match your project's 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", "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", "name": "DATABASE_NAME",
"description": "Database name",
"value": "default" "value": "default"
}, },
{ {
"description": "Database user name",
"name": "DATABASE_USER", "name": "DATABASE_USER",
"description": "Database user name",
"value": "django" "value": "django"
}, },
{ {
"description": "Database user password",
"name": "DATABASE_PASSWORD", "name": "DATABASE_PASSWORD",
"description": "Database user password",
"generate": "expression", "generate": "expression",
"from": "[a-zA-Z0-9]{16}" "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}"
} }
] ]
} }

+ 2
- 2
scripts/run-in-container.sh View File

@ -43,7 +43,7 @@
# ./run-in-container.sh ./manage.py createsuperuser # ./run-in-container.sh ./manage.py createsuperuser
# ./run-in-container.sh tail -f access.log # ./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 # 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 # Get name of a currently deployed pod by label and index
POD_INSTANCE_NAME=`osc get pods \ 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 }}"` -t "{{ with index .items ${POD_INDEX:-0} }}{{ .metadata.name }}{{ end }}"`
# Run command in a container of the specified pod: # Run command in a container of the specified pod:


Loading…
Cancel
Save