Update application template

This commit is contained in:
Rodolfo Carvalho 2015-06-01 18:37:01 +02:00
parent d9c03a7b79
commit 2d9c89e6bf
2 changed files with 58 additions and 57 deletions

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,13 +153,33 @@
"containers": [ "containers": [
{ {
"name": "django-quickstart", "name": "django-quickstart",
"image": "django-quickstart", "image": "django-quickstart-source",
"ports": [ "ports": [
{ {
"containerPort": 8080 "containerPort": 8080
} }
], ],
"env": [ "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", "name": "APP_MODULE",
"value": "${APP_MODULE}" "value": "${APP_MODULE}"
@ -177,18 +191,6 @@
{ {
"name": "DJANGO_SECRET_KEY", "name": "DJANGO_SECRET_KEY",
"value": "${DJANGO_SECRET_KEY}" "value": "${DJANGO_SECRET_KEY}"
},
{
"name": "DATABASE_USER",
"value": "${DATABASE_USER}"
},
{
"name": "DATABASE_PASSWORD",
"value": "${DATABASE_PASSWORD}"
},
{
"name": "DATABASE_NAME",
"value": "${DATABASE_NAME}"
} }
] ]
} }
@ -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,12 +289,37 @@
{ {
"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", "description": "Set this to the relative path to your project if it is not in the root of your repository"
"value": "" },
{
"name": "FRONTEND_SERVICE_NAME",
"description": "Frontend service name",
"value": "django"
},
{
"name": "DATABASE_SERVICE_NAME",
"description": "Database service name (PostgreSQL)",
"value": "database"
},
{
"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", "name": "APP_MODULE",
@ -309,32 +336,6 @@
"description": "Django secret key", "description": "Django secret key",
"generate": "expression", "generate": "expression",
"from": "[\\w]{50}" "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"
} }
] ]
} }

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: