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,133 +1,154 @@
{ {
"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": { "annotations": {
"description": "Defines how to build the Django app." "description": "Defines how to build the Django app."
} }
}, },
"parameters": { "spec": {
"strategy": {
"type": "STI",
"stiStrategy": {
"image": "openshift/python-33-centos7"
}
},
"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": [ "triggers": [
{ {
"type": "imageChange", "type": "ImageChange"
"imageChange": {
"from": {
"name": "python-33-centos7"
},
"image": "openshift/python-33-centos7",
"tag": "latest"
}
}, },
{ {
"type": "github", "type": "GitHub",
"github": { "github": {
"secret": "secret123" "secret": "secret123"
} }
}, },
{ {
"type": "generic", "type": "Generic",
"generic": { "generic": {
"secret": "secret123" "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."
} }
}, },
"spec": {
"strategy": {
"type": "Rolling"
},
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"django-quickstart"
],
"from": {
"name": "django-quickstart"
}
}
}
],
"replicas": 2,
"selector": {
"name": "${FRONTEND_SERVICE_NAME}"
},
"template": { "template": {
"controllerTemplate": { "spec": {
"replicaSelector": {
"name": "web"
},
"replicas": 1,
"podTemplate": {
"labels": {
"name": "web"
},
"desiredState": {
"manifest": {
"version": "v1beta1",
"containers": [ "containers": [
{ {
"name": "django", "name": "django-quickstart",
"image": "django-app", "image": "django-quickstart",
"ports": [ "ports": [
{ {
"containerPort": 8080 "containerPort": 8080
@ -138,6 +159,14 @@
"name": "APP_MODULE", "name": "APP_MODULE",
"value": "${APP_MODULE}" "value": "${APP_MODULE}"
}, },
{
"name": "DJANGO_ADMIN_USER",
"value": "${DJANGO_SECRET_KEY}"
},
{
"name": "DJANGO_ADMIN_PASSWORD",
"value": "${DJANGO_SECRET_KEY}"
},
{ {
"name": "DJANGO_SECRET_KEY", "name": "DJANGO_SECRET_KEY",
"value": "${DJANGO_SECRET_KEY}" "value": "${DJANGO_SECRET_KEY}"
@ -153,62 +182,36 @@
} }
} }
}, },
"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": [
{
"type": "ConfigChange"
}
],
"replicas": 1, "replicas": 1,
"podTemplate": { "selector": {
"labels": { "name": "${DATABASE_SERVICE_NAME}"
"name": "database"
}, },
"desiredState": { "template": {
"manifest": { "spec": {
"version": "v1beta1",
"containers": [ "containers": [
{ {
"name": "database", "name": "postgresql",
"image": "openshift/postgresql-92-centos7", "image": "openshift/postgresql-92-centos7",
"ports": [ "ports": [
{ {
@ -235,33 +238,23 @@
} }
} }
}, },
"strategy": {
"type": "Recreate"
}
},
"triggers": [
{
"type": "ConfigChange"
}
]
},
{ {
"kind": "ImageStream", "kind": "ImageStream",
"apiVersion": "v1beta1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "django-app", "name": "django-quickstart",
"annotations": { "annotations": {
"description": "Augments the Docker registry, keeps track of image changes for the Django app." "description": "Keeps track of changes in the Django app image."
} }
} }
}, },
{ {
"kind": "ImageStream", "kind": "ImageStream",
"apiVersion": "v1beta1", "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"
} }
] ]
} }