Update template to v1

This commit is contained in:
Rodolfo Carvalho 2015-05-22 13:31:14 +02:00
parent a3d47d74cc
commit 5548c3ad52

View file

@ -1,267 +1,260 @@
{ {
"kind": "Template", "kind": "Template",
"apiVersion": "v1beta1", "apiVersion": "v1",
"labels": {
"template": "django-app-template-sti"
},
"metadata": { "metadata": {
"name": "django-app", "name": "Django Quickstart",
"annotations": { "annotations": {
"description": "This is a Django application template for OpenShift", "description": "This is a Django application template that uses PostgreSQL for data storage.",
"tags": "python,django,postgres", "tags": "instant-app,python,django,postgresql",
"iconClass" : "icon-python" "iconClass" : "icon-python"
} }
}, },
"items": [ "labels": {
"template": "django-quickstart-sti"
},
"objects": [
{ {
"kind": "Service", "kind": "Service",
"id": "web", "apiVersion": "v1",
"apiVersion": "v1beta1",
"port": 80,
"containerPort": 8080,
"selector": {
"name": "web"
},
"metadata": { "metadata": {
"name": "${FRONTEND_SERVICE_NAME}",
"annotations": { "annotations": {
"description": "Exposes and load balances the Django app instances." "description": "Exposes and load balances the Django app instances."
} }
},
"spec": {
"ports": [
{
"name": "web",
"port": 5432,
"targetPort": 8080
}
],
"selector": {
"name": "${FRONTEND_SERVICE_NAME}"
}
} }
}, },
{ {
"kind": "Service", "kind": "Service",
"id": "database", "apiVersion": "v1",
"apiVersion": "v1beta1",
"port": 5432,
"containerPort": 5432,
"selector": {
"name": "database"
},
"metadata": { "metadata": {
"name": "${DATABASE_SERVICE_NAME}",
"annotations": { "annotations": {
"description": "Exposes the PostgreSQL database server." "description": "Exposes the PostgreSQL database server."
} }
},
"spec": {
"ports": [
{
"name": "postgresql",
"port": 5432,
"targetPort": 5432
}
],
"selector": {
"name": "${DATABASE_SERVICE_NAME}"
}
} }
}, },
{ {
"kind": "BuildConfig", "kind": "BuildConfig",
"apiVersion": "v1beta1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "django-app", "name": "django-quickstart",
"labels": { "labels": {
"name": "django-app" "name": "django-quickstart"
},
"annotations": {
"description": "Defines how to build the Django app."
}
},
"parameters": {
"strategy": {
"type": "STI",
"stiStrategy": {
"image": "openshift/python-33-centos7"
}
}, },
"annotations": {
"description": "Defines how to build the Django app."
}
},
"spec": {
"source": { "source": {
"type": "Git", "type": "Git",
"git": { "git": {
"uri": "${PROJECT_REPO}" "uri": "${GIT_REPOSITORY}"
},
"contextDir": "${CONTEXT_DIR}"
},
"strategy": {
"type": "Source",
"SourceStrategy": {
"from": {
"name": "python-33-centos7"
}
} }
}, },
"output": { "output": {
"to": { "to": {
"name": "django-app" "name": "django-quickstart"
}
}
},
"triggers": [
{
"type": "imageChange",
"imageChange": {
"from": {
"name": "python-33-centos7"
},
"image": "openshift/python-33-centos7",
"tag": "latest"
} }
}, },
{ "triggers": [
"type": "github", {
"github": { "type": "ImageChange"
"secret": "secret123" },
{
"type": "GitHub",
"github": {
"secret": "secret123"
}
},
{
"type": "Generic",
"generic": {
"secret": "secret123"
}
} }
}, ]
{ }
"type": "generic",
"generic": {
"secret": "secret123"
}
}
]
}, },
{ {
"kind": "DeploymentConfig", "kind": "DeploymentConfig",
"apiVersion": "v1beta1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "web", "name": "${FRONTEND_SERVICE_NAME}",
"labels": { "labels": {
"name": "web" "name": "${FRONTEND_SERVICE_NAME}"
}, },
"annotations": { "annotations": {
"description": "Defines how to deploy the Django app." "description": "Defines how to deploy the Django app."
} }
}, },
"template": { "spec": {
"controllerTemplate": { "strategy": {
"replicaSelector": { "type": "Rolling"
"name": "web" },
}, "triggers": [
"replicas": 1, {
"podTemplate": { "type": "ImageChange",
"labels": { "imageChangeParams": {
"name": "web" "automatic": true,
}, "containerNames": [
"desiredState": { "django-quickstart"
"manifest": { ],
"version": "v1beta1", "from": {
"containers": [ "name": "django-quickstart"
}
}
}
],
"replicas": 2,
"selector": {
"name": "${FRONTEND_SERVICE_NAME}"
},
"template": {
"spec": {
"containers": [
{
"name": "django-quickstart",
"image": "django-quickstart",
"ports": [
{ {
"name": "django", "containerPort": 8080
"image": "django-app", }
"ports": [ ],
{ "env": [
"containerPort": 8080 {
} "name": "APP_MODULE",
], "value": "${APP_MODULE}"
"env": [ },
{ {
"name": "APP_MODULE", "name": "DJANGO_ADMIN_USER",
"value": "${APP_MODULE}" "value": "${DJANGO_SECRET_KEY}"
}, },
{ {
"name": "DJANGO_SECRET_KEY", "name": "DJANGO_ADMIN_PASSWORD",
"value": "${DJANGO_SECRET_KEY}" "value": "${DJANGO_SECRET_KEY}"
}, },
{ {
"name": "DATABASE_URL", "name": "DJANGO_SECRET_KEY",
"value": "postgres://${DATABASE_USER}:${DATABASE_PASSWORD}@$DATABASE_SERVICE_HOST:$DATABASE_SERVICE_PORT/${DATABASE_NAME}" "value": "${DJANGO_SECRET_KEY}"
} },
] {
"name": "DATABASE_URL",
"value": "postgres://${DATABASE_USER}:${DATABASE_PASSWORD}@$DATABASE_SERVICE_HOST:$DATABASE_SERVICE_PORT/${DATABASE_NAME}"
} }
] ]
} }
} ]
}
},
"strategy": {
"type": "Recreate",
"recreateParams": {
"pre": {
"failurePolicy": "Abort",
"execNewPod": {
"containerName": "django",
"command": [
"./scripts/pre_deploy.sh"
]
}
}
} }
} }
}, }
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"django"
],
"from": {
"name": "django-app"
},
"tag": "latest"
}
}
]
}, },
{ {
"kind": "DeploymentConfig", "kind": "DeploymentConfig",
"apiVersion": "v1beta1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "database", "name": "${DATABASE_SERVICE_NAME}",
"labels": {
"name": "${DATABASE_SERVICE_NAME}"
},
"annotations": { "annotations": {
"description": "Defines how to deploy the database." "description": "Defines how to deploy the database."
} }
}, },
"template": { "spec": {
"controllerTemplate": { "strategy": {
"replicaSelector": { "type": "Recreate"
"name": "database" },
}, "triggers": [
"replicas": 1, {
"podTemplate": { "type": "ConfigChange"
"labels": { }
"name": "database" ],
}, "replicas": 1,
"desiredState": { "selector": {
"manifest": { "name": "${DATABASE_SERVICE_NAME}"
"version": "v1beta1", },
"containers": [ "template": {
"spec": {
"containers": [
{
"name": "postgresql",
"image": "openshift/postgresql-92-centos7",
"ports": [
{ {
"name": "database", "containerPort": 5432
"image": "openshift/postgresql-92-centos7", }
"ports": [ ],
{ "env": [
"containerPort": 5432 {
} "name": "POSTGRESQL_USER",
], "value": "${DATABASE_USER}"
"env": [ },
{ {
"name": "POSTGRESQL_USER", "name": "POSTGRESQL_PASSWORD",
"value": "${DATABASE_USER}" "value": "${DATABASE_PASSWORD}"
}, },
{ {
"name": "POSTGRESQL_PASSWORD", "name": "POSTGRESQL_DATABASE",
"value": "${DATABASE_PASSWORD}" "value": "${DATABASE_NAME}"
},
{
"name": "POSTGRESQL_DATABASE",
"value": "${DATABASE_NAME}"
}
]
} }
] ]
} }
} ]
} }
},
"strategy": {
"type": "Recreate"
}
},
"triggers": [
{
"type": "ConfigChange"
}
]
},
{
"kind": "ImageStream",
"apiVersion": "v1beta1",
"metadata": {
"name": "django-app",
"annotations": {
"description": "Augments the Docker registry, keeps track of image changes for the Django app."
} }
} }
}, },
{ {
"kind": "ImageStream", "kind": "ImageStream",
"apiVersion": "v1beta1", "apiVersion": "v1",
"metadata": {
"name": "django-quickstart",
"annotations": {
"description": "Keeps track of changes in the Django app image."
}
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": { "metadata": {
"name": "python-33-centos7", "name": "python-33-centos7",
"annotations": { "annotations": {
"description": "Augments the Docker registry, keeps track of image changes for Python base image." "description": "Keeps track of changes in the Python base image."
} }
}, },
"spec": { "spec": {
@ -271,18 +264,33 @@
], ],
"parameters": [ "parameters": [
{ {
"name": "GIT_REPOSITORY",
"description": "Change this to match your project's Git repository", "description": "Change this to match your project's Git repository",
"name": "PROJECT_REPO",
"value": "git://github.com/rhcarvalho/openshift-django-quickstart.git" "value": "git://github.com/rhcarvalho/openshift-django-quickstart.git"
}, },
{ {
"description": "Django WSGI application", "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", "name": "APP_MODULE",
"description": "Python dotted path to your Django WSGI application",
"value": "project.wsgi" "value": "project.wsgi"
}, },
{ {
"description": "Django secret key", "name": "DJANGO_ADMIN_USER",
"description": "User name for Django Admin interface",
"value": "admin"
},
{
"name": "DJANGO_ADMIN_PASSWORD",
"description": "Password for Django Admin interface",
"value": "admin"
},
{
"name": "DJANGO_SECRET_KEY", "name": "DJANGO_SECRET_KEY",
"description": "Django secret key",
"generate": "expression", "generate": "expression",
"from": "[\\w]{50}" "from": "[\\w]{50}"
}, },
@ -294,13 +302,23 @@
{ {
"description": "Database user name", "description": "Database user name",
"name": "DATABASE_USER", "name": "DATABASE_USER",
"value": "admin" "value": "django"
}, },
{ {
"description": "Database user password", "description": "Database user password",
"name": "DATABASE_PASSWORD", "name": "DATABASE_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"
},
{
"description": "Database service name (PostgreSQL)",
"name": "DATABASE_SERVICE_NAME",
"value": "database"
} }
] ]
} }