Skip to content

Instantly share code, notes, and snippets.

@l0rd
Last active October 10, 2016 15:31
Show Gist options
  • Save l0rd/cb09f332d9592655d353a208fc85e79c to your computer and use it in GitHub Desktop.
Save l0rd/cb09f332d9592655d353a208fc85e79c to your computer and use it in GitHub Desktop.
OpenShift template to deploy Che
{
"kind": "Template",
"apiVersion": "v1",
"metadata": {
"annotations": {
"description": "Application template for Eclipse Che",
"iconClass" : "icon-che",
"tags" : "eclipse,che,java,angular,ide",
"version" : "4.6.0"
},
"name": "eclipse-che"
},
"labels": {
"template": "eclipse-che",
"xpaas" : "4.6.0"
},
"parameters": [
{
"description": "The name for the application.",
"name": "APPLICATION_NAME",
"value": "che-server",
"required": true
},
{
"description": "Custom hostname for http service route. Leave blank for default hostname, e.g.: <application-name>.<project>.<default-domain-suffix>",
"name": "HOSTNAME_HTTP",
"value": "",
"required": false
},
{
"description": "Namespace in which the ImageStreams for Red Hat Middleware images are installed. These ImageStreams are normally installed in the openshift namespace. You should only need to modify this if you've installed the ImageStreams in a different namespace/project.",
"name": "IMAGE_STREAM_NAMESPACE",
"value": "openshift",
"required": true
},
{
"description": "Name of the che-server Docker image.",
"name": "CHE_SERVER_DOCKER_IMAGE",
"value": "registry.centos.org/eclipse/che-server:latest",
"required": true
},
{
"description": "IP of the host docker0 bridge. This IP is used by che-server to communicate with che workspaces",
"name": "DOCKER0_BRIDGE_IP",
"value": "172.17.0.1",
"required": true
}
],
"objects": [
{
"kind": "Service",
"apiVersion": "v1",
"spec": {
"ports": [
{
"port": 8080,
"targetPort": 8080
}
],
"selector": {
"deploymentConfig": "${APPLICATION_NAME}"
}
},
"metadata": {
"name": "${APPLICATION_NAME}",
"labels": {
"application": "${APPLICATION_NAME}"
},
"annotations": {
"description": "Che http port."
}
}
},
{
"kind": "Route",
"apiVersion": "v1",
"id": "${APPLICATION_NAME}-http",
"metadata": {
"name": "${APPLICATION_NAME}",
"labels": {
"application": "${APPLICATION_NAME}"
},
"annotations": {
"description": "Route for application's http service."
}
},
"spec": {
"host": "${HOSTNAME_HTTP}",
"to": {
"name": "${APPLICATION_NAME}"
}
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}",
"labels": {
"application": "${APPLICATION_NAME}"
}
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"${APPLICATION_NAME}"
],
"from": {
"kind": "ImageStreamTag",
"namespace": "${IMAGE_STREAM_NAMESPACE}",
"name": "che-server:4.6"
}
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"deploymentConfig": "${APPLICATION_NAME}"
},
"template": {
"metadata": {
"name": "${APPLICATION_NAME}",
"labels": {
"deploymentConfig": "${APPLICATION_NAME}",
"application": "${APPLICATION_NAME}"
}
},
"spec": {
"terminationGracePeriodSeconds": 75,
"containers": [
{
"name": "${APPLICATION_NAME}",
"image": "${CHE_SERVER_DOCKER_IMAGE}",
"imagePullPolicy": "Always",
"privileged": true,
"livenessProbe": {
"tcpSocket": {
"port": 8080
},
"initialDelaySeconds": 5,
"timeoutSeconds": 1
},
"readinessProbe": {
"tcpSocket": {
"port": 8080
},
"initialDelaySeconds": 5,
"timeoutSeconds": 1
},
"volumeMounts": [
{
"name": "che-conf-volume",
"mountPath": "/etc/conf",
"readOnly": false
},
{
"name": "docker-socket-volume",
"mountPath": "/var/run/docker.sock",
"readOnly": false
},
{
"name": "che-lib-volume",
"mountPath": "/home/user/che/lib-copy"
},
{
"name": "che-workspaces-volume",
"mountPath": "/home/user/che/workspaces"
},
{
"name": "che-storage-volume",
"mountPath": "/home/user/che/storage"
}
],
"ports": [
{
"name": "http",
"containerPort": 8080,
"protocol": "TCP"
}
],
"env": [
{
"name": "CHE_DOCKER_MACHINE_HOST_EXTERNAL",
"value": "${HOSTNAME_HTTP}"
},
{
"name": "CHE_WORKSPACE_STORAGE",
"value": "/home/user/che/workspaces"
},
{
"name": "CHE_WORKSPACE_STORAGE_CREATE_FOLDERS",
"value": "false"
},
{
"name": "CHE_LOCAL_CONF_DIR",
"value": "/conf"
}
],
"args": [
"--remote:${DOCKER0_BRIDGE_IP}",
"-s:uid",
"-s:client",
"run"
],
"securityContext": {
"privileged": true,
"runAsUser": 0
}
}
],
"volumes": [
{
"name": "che-conf-volume",
"hostPath": {
"path": "/etc/conf"
}
},
{
"name": "docker-socket-volume",
"hostPath": {
"path": "/var/run/docker.sock"
}
},
{
"name": "che-lib-volume",
"hostPath": {
"path": "/home/user/che/lib"
}
},
{
"name": "che-workspaces-volume",
"hostPath": {
"path": "/home/user/che/workspaces"
}
},
{
"name": "che-storage-volume",
"hostPath": {
"path": "/home/user/che/storage"
}
}
],
"serviceAccountName": "cheserviceaccount"
}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment