299 lines
7.8 KiB
JSON
299 lines
7.8 KiB
JSON
{
|
|
"kind": "Template",
|
|
"apiVersion": "v1",
|
|
"metadata": {
|
|
"name": "django-example",
|
|
"annotations": {
|
|
"description": "An example Django application with no database",
|
|
"tags": "quickstart,python,django",
|
|
"iconClass": "icon-python"
|
|
}
|
|
},
|
|
"labels": {
|
|
"template": "django-example"
|
|
},
|
|
"objects": [
|
|
{
|
|
"kind": "Service",
|
|
"apiVersion": "v1",
|
|
"metadata": {
|
|
"name": "django-example",
|
|
"annotations": {
|
|
"description": "Exposes and load balances the application pods"
|
|
}
|
|
},
|
|
"spec": {
|
|
"ports": [
|
|
{
|
|
"name": "web",
|
|
"port": 8080,
|
|
"targetPort": 8080
|
|
}
|
|
],
|
|
"selector": {
|
|
"name": "django-example"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"kind": "Route",
|
|
"apiVersion": "v1",
|
|
"metadata": {
|
|
"name": "django-example"
|
|
},
|
|
"spec": {
|
|
"host": "${APPLICATION_DOMAIN}",
|
|
"to": {
|
|
"kind": "Service",
|
|
"name": "django-example"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"kind": "ImageStream",
|
|
"apiVersion": "v1",
|
|
"metadata": {
|
|
"name": "django-example",
|
|
"annotations": {
|
|
"description": "Keeps track of changes in the application image"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"kind": "BuildConfig",
|
|
"apiVersion": "v1",
|
|
"metadata": {
|
|
"name": "django-example",
|
|
"annotations": {
|
|
"description": "Defines how to build the application"
|
|
}
|
|
},
|
|
"spec": {
|
|
"source": {
|
|
"type": "Git",
|
|
"git": {
|
|
"uri": "${SOURCE_REPOSITORY_URL}",
|
|
"ref": "${SOURCE_REPOSITORY_REF}"
|
|
},
|
|
"contextDir": "${CONTEXT_DIR}"
|
|
},
|
|
"strategy": {
|
|
"type": "Source",
|
|
"sourceStrategy": {
|
|
"from": {
|
|
"kind": "ImageStreamTag",
|
|
"namespace": "openshift",
|
|
"name": "python:3.4"
|
|
}
|
|
}
|
|
},
|
|
"output": {
|
|
"to": {
|
|
"kind": "ImageStreamTag",
|
|
"name": "django-example:latest"
|
|
}
|
|
},
|
|
"triggers": [
|
|
{
|
|
"type": "ImageChange"
|
|
},
|
|
{
|
|
"type": "ConfigChange"
|
|
},
|
|
{
|
|
"type": "GitHub",
|
|
"github": {
|
|
"secret": "${GITHUB_WEBHOOK_SECRET}"
|
|
}
|
|
}
|
|
],
|
|
"postCommit": {
|
|
"script": "./manage.py test"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"kind": "DeploymentConfig",
|
|
"apiVersion": "v1",
|
|
"metadata": {
|
|
"name": "django-example",
|
|
"annotations": {
|
|
"description": "Defines how to deploy the application server"
|
|
}
|
|
},
|
|
"spec": {
|
|
"strategy": {
|
|
"type": "Rolling"
|
|
},
|
|
"triggers": [
|
|
{
|
|
"type": "ImageChange",
|
|
"imageChangeParams": {
|
|
"automatic": true,
|
|
"containerNames": [
|
|
"django-example"
|
|
],
|
|
"from": {
|
|
"kind": "ImageStreamTag",
|
|
"name": "django-example:latest"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "ConfigChange"
|
|
}
|
|
],
|
|
"replicas": 1,
|
|
"selector": {
|
|
"name": "django-example"
|
|
},
|
|
"template": {
|
|
"metadata": {
|
|
"name": "django-example",
|
|
"labels": {
|
|
"name": "django-example"
|
|
}
|
|
},
|
|
"spec": {
|
|
"containers": [
|
|
{
|
|
"name": "django-example",
|
|
"image": "django-example",
|
|
"ports": [
|
|
{
|
|
"containerPort": 8080
|
|
}
|
|
],
|
|
"readinessProbe": {
|
|
"timeoutSeconds": 3,
|
|
"initialDelaySeconds": 3,
|
|
"httpGet": {
|
|
"path": "/",
|
|
"port": 8080
|
|
}
|
|
},
|
|
"livenessProbe": {
|
|
"timeoutSeconds": 3,
|
|
"initialDelaySeconds": 30,
|
|
"httpGet": {
|
|
"path": "/",
|
|
"port": 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_CONFIG",
|
|
"value": "${APP_CONFIG}"
|
|
},
|
|
{
|
|
"name": "DJANGO_SECRET_KEY",
|
|
"value": "${DJANGO_SECRET_KEY}"
|
|
}
|
|
],
|
|
"resources": {
|
|
"limits": {
|
|
"memory": "${MEMORY_LIMIT}"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "MEMORY_LIMIT",
|
|
"displayName": "Memory limit",
|
|
"description": "Maximum amount of memory the container can use",
|
|
"value": "128Mi"
|
|
},
|
|
{
|
|
"name": "SOURCE_REPOSITORY_URL",
|
|
"displayName": "Source repository URL",
|
|
"description": "The URL of the repository with your application source code",
|
|
"value": "https://github.com/openshift/django-ex.git"
|
|
},
|
|
{
|
|
"name": "SOURCE_REPOSITORY_REF",
|
|
"displayName": "Source repository reference",
|
|
"description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch"
|
|
},
|
|
{
|
|
"name": "CONTEXT_DIR",
|
|
"displayName": "Context directory",
|
|
"description": "Set this to the relative path to your project if it is not in the root of your repository"
|
|
},
|
|
{
|
|
"name": "APPLICATION_DOMAIN",
|
|
"displayName": "Application hostname",
|
|
"description": "The exposed hostname that will route to the Django service, if left blank a value will be defaulted.",
|
|
"value": ""
|
|
},
|
|
{
|
|
"name": "GITHUB_WEBHOOK_SECRET",
|
|
"displayName": "GitHub webhook secret",
|
|
"description": "A secret string used to configure the GitHub webhook",
|
|
"generate": "expression",
|
|
"from": "[a-zA-Z0-9]{40}"
|
|
},
|
|
{
|
|
"name": "DATABASE_SERVICE_NAME",
|
|
"displayName": "Database service name",
|
|
"description": "Database service name"
|
|
},
|
|
{
|
|
"name": "DATABASE_ENGINE",
|
|
"displayName": "Database engine",
|
|
"description": "Database engine: postgresql, mysql or sqlite (default)"
|
|
},
|
|
{
|
|
"name": "DATABASE_NAME",
|
|
"displayName": "Database name",
|
|
"description": "Database name"
|
|
},
|
|
{
|
|
"name": "DATABASE_USER",
|
|
"displayName": "Database user name",
|
|
"description": "Database user name"
|
|
},
|
|
{
|
|
"name": "DATABASE_PASSWORD",
|
|
"displayName": "Database user password",
|
|
"description": "Database user password"
|
|
},
|
|
{
|
|
"name": "APP_CONFIG",
|
|
"displayName": "Application configuration file path",
|
|
"description": "Relative path to Gunicorn configuration file (optional)"
|
|
},
|
|
{
|
|
"name": "DJANGO_SECRET_KEY",
|
|
"displayName": "Djange secret key",
|
|
"description": "Set this to a long random string",
|
|
"generate": "expression",
|
|
"from": "[\\w]{50}"
|
|
}
|
|
]
|
|
}
|