Skip to content

Instantly share code, notes, and snippets.

@Maarc
Last active April 12, 2017 13:25
Show Gist options
  • Save Maarc/8a390fb09d5980500b19dadb53ad6c6b to your computer and use it in GitHub Desktop.
Save Maarc/8a390fb09d5980500b19dadb53ad6c6b to your computer and use it in GitHub Desktop.
template.json
{
"kind": "Template",
"apiVersion": "v1",
"metadata": {
"annotations": {
"description": "Brownie, the brownfield application",
"iconClass": "icon-jboss",
"tags": "eap,postgresql,javaee,java,database,jboss,xpaas",
"version": "1.0.0",
"openshift.io/display-name": "Brownie, the brownfield application"
},
"name": "brownie"
},
"labels": {
"template": "brownie"
},
"message": "The resources (build config, deploy config, service, imagestreams, etc) for running the Brownie has been created in your project. To deploy the application go to your source directoy and build that code using mvn -Popenshift package and then start the build using oc start-build brownie --from-file=deployments/brownie.ear.",
"parameters": [
{
"displayName": "Database JNDI Name",
"description": "Database JNDI name used by application to resolve the datasource, e.g. java:/jboss/datasources/postgresql",
"name": "DB_JNDI",
"value": "java:/jdbc/brownie",
"required": false
},
{
"displayName": "Database Name",
"description": "Database name",
"name": "DB_DATABASE",
"value": "BrownieDS",
"required": true
},
{
"displayName": "Datasource Minimum Pool Size",
"description": "Sets xa-pool/min-pool-size for the configured datasource.",
"name": "DB_MIN_POOL_SIZE",
"required": false
},
{
"displayName": "Datasource Maximum Pool Size",
"description": "Sets xa-pool/max-pool-size for the configured datasource.",
"name": "DB_MAX_POOL_SIZE",
"required": false
},
{
"displayName": "Datasource Transaction Isolation",
"description": "Sets transaction-isolation for the configured datasource.",
"name": "DB_TX_ISOLATION",
"required": false
},
{
"displayName": "PostgreSQL Maximum number of connections",
"description": "The maximum number of client connections allowed. This also sets the maximum number of prepared transactions.",
"name": "POSTGRESQL_MAX_CONNECTIONS",
"required": false
},
{
"displayName": "PostgreSQL Shared Buffers",
"description": "Configures how much memory is dedicated to PostgreSQL for caching data.",
"name": "POSTGRESQL_SHARED_BUFFERS",
"required": false
},
{
"displayName": "A-MQ cluster password",
"description": "A-MQ cluster admin password",
"name": "MQ_CLUSTER_PASSWORD",
"from": "[a-zA-Z0-9]{8}",
"generate": "expression",
"required": true
},
{
"displayName": "Database Username",
"description": "Database user name",
"name": "DB_USERNAME",
"from": "user[a-zA-Z0-9]{3}",
"generate": "expression",
"required": true
},
{
"displayName": "Database Password",
"description": "Database user password",
"name": "DB_PASSWORD",
"from": "[a-zA-Z0-9]{8}",
"generate": "expression",
"required": true
},
{
"displayName": "Github Webhook Secret",
"description": "GitHub trigger secret",
"name": "GITHUB_WEBHOOK_SECRET",
"from": "[a-zA-Z0-9]{8}",
"generate": "expression",
"required": true
},
{
"displayName": "Generic Webhook Secret",
"description": "Generic build trigger secret",
"name": "GENERIC_WEBHOOK_SECRET",
"from": "[a-zA-Z0-9]{8}",
"generate": "expression",
"required": true
},
{
"displayName": "ImageStream Namespace",
"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
},
{
"displayName": "JGroups Cluster Password",
"description": "JGroups cluster password",
"name": "JGROUPS_CLUSTER_PASSWORD",
"from": "[a-zA-Z0-9]{8}",
"generate": "expression",
"required": true
},
{
"displayName": "Deploy Exploded Archives",
"description": "Controls whether exploded deployment content should be automatically deployed",
"name": "AUTO_DEPLOY_EXPLODED",
"value": "false",
"required": false
}
],
"objects": [
{
"kind": "Service",
"apiVersion": "v1",
"spec": {
"ports": [{
"port": 8080,
"targetPort": 8080
}],
"selector": {
"deploymentConfig": "brownie"
}
},
"metadata": {
"name": "brownie",
"labels": {
"application": "brownie"
},
"annotations": {
"description": "The web server's http port.",
"service.alpha.openshift.io/dependencies": "[{\"name\":\"brownie-postgresql\",\"namespace\":\"\",\"kind\":\"Service\"}]"
}
}
},
{
"kind": "Service",
"apiVersion": "v1",
"spec": {
"ports": [{
"port": 5432,
"targetPort": 5432
}],
"selector": {
"deploymentConfig": "brownie-postgresql"
}
},
"metadata": {
"name": "brownie-postgresql",
"labels": {
"application": "brownie"
},
"annotations": {
"description": "The database server's port."
}
}
},
{
"kind": "Route",
"apiVersion": "v1",
"id": "brownie-http",
"metadata": {
"name": "brownie",
"namespace": "brownie",
"labels": {
"application": "brownie"
},
"annotations": {
"description": "Route for application's http service."
}
},
"spec": {
"path": "/brownie",
"to": {
"name": "brownie",
"kind": "Service"
}
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "brownie",
"labels": {
"application": "brownie",
"build": "brownie"
}
}
},
{
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
"name": "brownie",
"labels": {
"application": "brownie"
}
},
"spec": {
"source": {
"type": "Binary",
"binary": {}
},
"strategy": {
"type": "Source",
"sourceStrategy": {
"from": {
"kind": "ImageStreamTag",
"namespace": "${IMAGE_STREAM_NAMESPACE}",
"name": "jboss-eap70-openshift:1.4"
}
}
},
"output": {
"to": {
"kind": "ImageStreamTag",
"name": "brownie:latest"
}
},
"triggers": [{
"type": "GitHub",
"github": {
"secret": "${GITHUB_WEBHOOK_SECRET}"
}
},
{
"type": "Generic",
"generic": {
"secret": "${GENERIC_WEBHOOK_SECRET}"
}
}
]
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "brownie",
"labels": {
"application": "brownie"
}
},
"spec": {
"strategy": {
"type": "Rolling",
"rollingParams": {
"updatePeriodSeconds": 1,
"intervalSeconds": 1,
"timeoutSeconds": 600,
"maxUnavailable": "25%",
"maxSurge": "25%"
},
"resources": {}
},
"triggers": [{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"brownie"
],
"from": {
"kind": "ImageStreamTag",
"name": "brownie:latest"
}
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"deploymentConfig": "brownie"
},
"template": {
"metadata": {
"name": "brownie",
"labels": {
"deploymentConfig": "brownie",
"application": "brownie"
}
},
"spec": {
"serviceAccountName": "brownie-serviceaccount",
"terminationGracePeriodSeconds": 75,
"containers": [{
"name": "brownie",
"image": "brownie",
"imagePullPolicy": "Always",
"volumeMounts": [{
"name": "eap-keystore-volume",
"mountPath": "/etc/eap-secret-volume",
"readOnly": true
},
{
"name": "eap-jgroups-keystore-volume",
"mountPath": "/etc/jgroups-encrypt-secret-volume",
"readOnly": true
}
],
"lifecycle": {
"preStop": {
"exec": {
"command": [
"/opt/eap/bin/jboss-cli.sh",
"-c",
":shutdown(timeout=60)"
]
}
}
},
"livenessProbe": {
"exec": {
"command": [
"/bin/bash",
"-c",
"/opt/eap/bin/livenessProbe.sh"
]
}
},
"ports": [{
"name": "jolokia",
"containerPort": 8778,
"protocol": "TCP"
},
{
"name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
"name": "https",
"containerPort": 8443,
"protocol": "TCP"
},
{
"name": "ping",
"containerPort": 8888,
"protocol": "TCP"
}
],
"env": [
{
"name": "DB_SERVICE_PREFIX_MAPPING",
"value": "brownie-postgresql=DB"
},
{
"name": "DB_JNDI",
"value": "${DB_JNDI}"
},
{
"name": "DB_USERNAME",
"value": "${DB_USERNAME}"
},
{
"name": "DB_PASSWORD",
"value": "${DB_PASSWORD}"
},
{
"name": "DB_DATABASE",
"value": "${DB_DATABASE}"
},
{
"name": "TX_DATABASE_PREFIX_MAPPING",
"value": "brownie-postgresql=DB"
},
{
"name": "DB_MIN_POOL_SIZE",
"value": "${DB_MIN_POOL_SIZE}"
},
{
"name": "DB_MAX_POOL_SIZE",
"value": "${DB_MAX_POOL_SIZE}"
},
{
"name": "DB_TX_ISOLATION",
"value": "${DB_TX_ISOLATION}"
},
{
"name": "OPENSHIFT_KUBE_PING_LABELS",
"value": "application=brownie"
},
{
"name": "OPENSHIFT_KUBE_PING_NAMESPACE",
"valueFrom": {
"fieldRef": {
"fieldPath": "metadata.namespace"
}
}
},
{
"name": "HTTPS_KEYSTORE_DIR",
"value": "/etc/eap-secret-volume"
},
{
"name": "HTTPS_KEYSTORE",
"value": "keystore.jks"
},
{
"name": "HTTPS_KEYSTORE_TYPE",
"value": "JKS"
},
{
"name": "HTTPS_NAME",
"value": "jboss"
},
{
"name": "HTTPS_PASSWORD",
"value": "mykeystorepass"
},
{
"name": "MQ_CLUSTER_PASSWORD",
"value": "${MQ_CLUSTER_PASSWORD}"
},
{
"name": "JGROUPS_ENCRYPT_SECRET",
"value": "brownie-secret"
},
{
"name": "JGROUPS_ENCRYPT_KEYSTORE_DIR",
"value": "/etc/jgroups-encrypt-secret-volume"
},
{
"name": "JGROUPS_ENCRYPT_KEYSTORE",
"value": "jgroups.jceks"
},
{
"name": "JGROUPS_ENCRYPT_NAME",
"value": "secret-key"
},
{
"name": "JGROUPS_ENCRYPT_PASSWORD",
"value": "password"
},
{
"name": "JGROUPS_CLUSTER_PASSWORD",
"value": "${JGROUPS_CLUSTER_PASSWORD}"
},
{
"name": "AUTO_DEPLOY_EXPLODED",
"value": "${AUTO_DEPLOY_EXPLODED}"
},
{
"name": "DEFAULT_JOB_REPOSITORY",
"value": "brownie-postgresql"
},
{
"name": "TIMER_SERVICE_DATA_STORE",
"value": "brownie-postgresql"
}
]
}],
"volumes": [{
"name": "eap-keystore-volume",
"secret": {
"secretName": "brownie-secret"
}
},
{
"name": "eap-jgroups-keystore-volume",
"secret": {
"secretName": "brownie-secret"
}
}
]
}
}
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "brownie-postgresql",
"labels": {
"application": "brownie"
}
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"brownie-postgresql"
],
"from": {
"kind": "ImageStreamTag",
"namespace": "${IMAGE_STREAM_NAMESPACE}",
"name": "postgresql:latest"
}
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"deploymentConfig": "brownie-postgresql"
},
"template": {
"metadata": {
"name": "brownie-postgresql",
"labels": {
"deploymentConfig": "brownie-postgresql",
"application": "brownie"
}
},
"spec": {
"terminationGracePeriodSeconds": 60,
"containers": [{
"name": "brownie-postgresql",
"image": "postgresql",
"imagePullPolicy": "Always",
"readinessProbe": {
"exec": {
"command": [
"/bin/sh",
"-i",
"-c",
"psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d $POSTGRESQL_DATABASE -c 'SELECT 1'"
]
},
"initialDelaySeconds": 5,
"timeoutSeconds": 1,
"periodSeconds": 10,
"successThreshold": 1,
"failureThreshold": 3
},
"livenessProbe": {
"tcpSocket": {
"port": 5432
},
"initialDelaySeconds": 30,
"timeoutSeconds": 1,
"periodSeconds": 10,
"successThreshold": 1,
"failureThreshold": 3
},
"ports": [{
"containerPort": 5432,
"protocol": "TCP"
}],
"env": [{
"name": "POSTGRESQL_USER",
"value": "${DB_USERNAME}"
},
{
"name": "POSTGRESQL_PASSWORD",
"value": "${DB_PASSWORD}"
},
{
"name": "POSTGRESQL_DATABASE",
"value": "${DB_DATABASE}"
},
{
"name": "POSTGRESQL_MAX_CONNECTIONS",
"value": "${POSTGRESQL_MAX_CONNECTIONS}"
},
{
"name": "POSTGRESQL_MAX_PREPARED_TRANSACTIONS",
"value": "${POSTGRESQL_MAX_CONNECTIONS}"
},
{
"name": "POSTGRESQL_SHARED_BUFFERS",
"value": "${POSTGRESQL_SHARED_BUFFERS}"
}
]
}]
}
}
}
},
{
"kind": "ServiceAccount",
"apiVersion": "v1",
"metadata": {
"name": "brownie-serviceaccount"
},
"secrets": [
{
"name": "brownie-secret"
}
]
},
{
"kind": "RoleBinding",
"apiVersion": "v1",
"groupNames": null,
"metadata": {
"name": "brownie-serviceaccount_view"
},
"roleRef": {
"name": "view"
},
"subjects": [{
"kind": "ServiceAccount",
"name": "brownie-serviceaccount"
}]
},
{
"kind": "RoleBinding",
"apiVersion": "v1",
"metadata": {
"name": "ci_admin"
},
"groupNames": [
"system:serviceaccounts:ci"
],
"subjects": [
{
"kind": "SystemGroup",
"name": "system:serviceaccounts:ci"
}
],
"roleRef": {
"name": "admin"
}
},
{
"kind": "Secret",
"apiVersion": "v1",
"metadata": {
"annotations": {
"description": "Default HTTPS keystore (keystore.jks) with name 'jboss' and password 'mykeystorepass' and JGoups keystore (jgroups.jceks) with name 'secret-key' and password 'password'"
},
"name": "brownie-secret"
},
"data": {
"keystore.jks": "/u3+7QAAAAIAAAABAAAAAQAFamJvc3MAAAFVFbYp5AAABQIwggT+MA4GCisGAQQBKgIRAQEFAASCBOqe/lTeehnds9ffJp/EYKY2K7o9CvvyvgiqvdaGqiZxwWjmoYBEuBxJBUkr7uyYr2g3Viui18djJh9paWdBfPRCEWsLxbMBmig+5OXe1U536PTNZlzkdrwSJpusiwwWLiog/kQ+Gp82VzHxsueNVkewKZ6LvdAq+5Pw7148cxgfnm+2j0La1YnX4/TAtY6A33HjU3HxPxpkLCBP66THxjJvm+n5xg+6eAPu6n/c3mWShhudf0k7FAHLgqMqZt22GMlIv73azdz5kf+opcF8nHN/SDnrgmBbX+GBFvMQ64a3zfLGMnCH8R7L2v5K0uH4AvOHHU9+g7KGk/obPOFyqjloPGIGwzyX4UhxsxP9+wU45RVg02SdoOsqsKYeF7JV1t+uj1+WXDkEaxGYx9u5bFIpkQOuuh6kyf6P6MK8gP6u8cRJeLU/LZCkNMSHq6afbgu/Uu0ZlPFKMLBiX6aKYO0nhp/h3QBzLOVCrWB5nnj90WnZ6Ug8bUjozTTKcdOu8oU47cOesSxPsZzs/KXEuqNP+T34fb4iOKjDXpTZDhIDYanfXb+GMHi/XdY5Q5Xu5w+6ES4ue9grlqfXtMa3G/FgUuJ6dLIXCDAHtS6nxvN3VBd3+pkQKG3iiBMbmBSg03bau5stsD8ol6NGQkoqIhvr1cxFHz+wVzh3UE6FOF+T96rqSuK17UNWnNTSFntHpMYUq+CbD1sTsAmaZ1tIbWBVYEw9G0hpzfFgIqndnEOJ2hD1Z30cStVvSamTlY1hYwxw9/qVUGxzRyQF1a4U8wuYyJNSLZmLwF4jmtkP/kvzhOJ9nr9ZHpuZcW8v5O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ABXNyADNjb20uc3VuLmNyeXB0by5wcm92aWRlci5TZWFsZWRPYmplY3RGb3JLZXlQcm90ZWN0b3LNV8pZ5zC7UwIAAHhyABlqYXZheC5jcnlwdG8uU2VhbGVkT2JqZWN0PjY9psO3VHACAARbAA1lbmNvZGVkUGFyYW1zdAACW0JbABBlbmNyeXB0ZWRDb250ZW50cQB+AAJMAAlwYXJhbXNBbGd0ABJMamF2YS9sYW5nL1N0cmluZztMAAdzZWFsQWxncQB+AAN4cHVyAAJbQqzzF/gGCFTgAgAAeHAAAAAPMA0ECHcwLGK6EDyLAgEUdXEAfgAFAAAAmCu9wRKf1aYYUOEWe406ncPtIdm3147G7MJyWUu2kJVY15a2QxeZi9w5J3AF6T64CvylUuQjpcC4DWXwVn9BefntkBR8CzTiH7VxEqVOQ/OkFS29Inoq8t7/NBaTgTdmMkb4ETV1gIsy/+W6kk7QTqxItCkdKKGFE90Be/7yL3tG16TCy/ABKl7CO6PHa44CqK2PUE1oaJ+WdAAWUEJFV2l0aE1ENUFuZFRyaXBsZURFU3QAFlBCRVdpdGhNRDVBbmRUcmlwbGVERVMN658veJP01V2j9y8bQCYIzViutw=="
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment