123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402 |
- {
- "kind": "Template",
- "apiVersion": "v1",
- "metadata": {
- "name": "rails-postgresql-example",
- "annotations": {
- "description": "An example Rails application with a PostgreSQL database",
- "tags": "instant-app,ruby,rails,postgresql",
- "iconClass": "icon-ruby"
- }
- },
- "labels": {
- "template": "rails-postgresql-example"
- },
- "objects": [
- {
- "kind": "Service",
- "apiVersion": "v1",
- "metadata": {
- "name": "rails-postgresql-example",
- "annotations": {
- "description": "Exposes and load balances the application pods"
- }
- },
- "spec": {
- "ports": [
- {
- "name": "web",
- "port": 8080,
- "targetPort": 8080
- }
- ],
- "selector": {
- "name": "rails-postgresql-example"
- }
- }
- },
- {
- "kind": "Route",
- "apiVersion": "v1",
- "metadata": {
- "name": "rails-postgresql-example"
- },
- "spec": {
- "host": "${APPLICATION_DOMAIN}",
- "to": {
- "kind": "Service",
- "name": "rails-postgresql-example"
- }
- }
- },
- {
- "kind": "ImageStream",
- "apiVersion": "v1",
- "metadata": {
- "name": "rails-postgresql-example",
- "annotations": {
- "description": "Keeps track of changes in the application image"
- }
- }
- },
- {
- "kind": "BuildConfig",
- "apiVersion": "v1",
- "metadata": {
- "name": "rails-postgresql-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": "ruby:2.0"
- }
- }
- },
- "output": {
- "to": {
- "kind": "ImageStreamTag",
- "name": "rails-postgresql-example:latest"
- }
- },
- "triggers": [
- {
- "type": "ImageChange"
- },
- {
- "type": "GitHub",
- "github": {
- "secret": "${GITHUB_WEBHOOK_SECRET}"
- }
- }
- ]
- }
- },
- {
- "kind": "DeploymentConfig",
- "apiVersion": "v1",
- "metadata": {
- "name": "rails-postgresql-example",
- "annotations": {
- "description": "Defines how to deploy the application server"
- }
- },
- "spec": {
- "strategy": {
- "type": "Recreate",
- "recreateParams": {
- "pre": {
- "failurePolicy": "Abort",
- "execNewPod": {
- "command": [
- "./migrate-database.sh"
- ],
- "containerName": "rails-postgresql-example"
- }
- }
- }
- },
- "triggers": [
- {
- "type": "ImageChange",
- "imageChangeParams": {
- "automatic": true,
- "containerNames": [
- "rails-postgresql-example"
- ],
- "from": {
- "kind": "ImageStreamTag",
- "name": "rails-postgresql-example:latest"
- }
- }
- },
- {
- "type": "ConfigChange"
- }
- ],
- "replicas": 1,
- "selector": {
- "name": "rails-postgresql-example"
- },
- "template": {
- "metadata": {
- "name": "rails-postgresql-example",
- "labels": {
- "name": "rails-postgresql-example"
- }
- },
- "spec": {
- "containers": [
- {
- "name": "rails-postgresql-example",
- "image": "rails-postgresql-example",
- "ports": [
- {
- "containerPort": 8080
- }
- ],
- "env": [
- {
- "name": "DATABASE_SERVICE_NAME",
- "value": "${DATABASE_SERVICE_NAME}"
- },
- {
- "name": "POSTGRESQL_USER",
- "value": "${DATABASE_USER}"
- },
- {
- "name": "POSTGRESQL_PASSWORD",
- "value": "${DATABASE_PASSWORD}"
- },
- {
- "name": "POSTGRESQL_DATABASE",
- "value": "${DATABASE_NAME}"
- },
- {
- "name": "SECRET_KEY_BASE",
- "value": "${SECRET_KEY_BASE}"
- },
- {
- "name": "POSTGRESQL_MAX_CONNECTIONS",
- "value": "${POSTGRESQL_MAX_CONNECTIONS}"
- },
- {
- "name": "POSTGRESQL_SHARED_BUFFERS",
- "value": "${POSTGRESQL_SHARED_BUFFERS}"
- },
- {
- "name": "SECRET_KEY_BASE",
- "value": "${SECRET_KEY_BASE}"
- },
- {
- "name": "APPLICATION_DOMAIN",
- "value": "${APPLICATION_DOMAIN}"
- },
- {
- "name": "APPLICATION_USER",
- "value": "${APPLICATION_USER}"
- },
- {
- "name": "APPLICATION_PASSWORD",
- "value": "${APPLICATION_PASSWORD}"
- },
- {
- "name": "RAILS_ENV",
- "value": "${RAILS_ENV}"
- }
- ]
- }
- ]
- }
- }
- }
- },
- {
- "kind": "Service",
- "apiVersion": "v1",
- "metadata": {
- "name": "${DATABASE_SERVICE_NAME}",
- "annotations": {
- "description": "Exposes the database server"
- }
- },
- "spec": {
- "ports": [
- {
- "name": "postgresql",
- "port": 5432,
- "targetPort": 5432
- }
- ],
- "selector": {
- "name": "${DATABASE_SERVICE_NAME}"
- }
- }
- },
- {
- "kind": "DeploymentConfig",
- "apiVersion": "v1",
- "metadata": {
- "name": "${DATABASE_SERVICE_NAME}",
- "annotations": {
- "description": "Defines how to deploy the database"
- }
- },
- "spec": {
- "strategy": {
- "type": "Recreate"
- },
- "triggers": [
- {
- "type": "ConfigChange"
- }
- ],
- "replicas": 1,
- "selector": {
- "name": "${DATABASE_SERVICE_NAME}"
- },
- "template": {
- "metadata": {
- "name": "${DATABASE_SERVICE_NAME}",
- "labels": {
- "name": "${DATABASE_SERVICE_NAME}"
- }
- },
- "spec": {
- "containers": [
- {
- "name": "postgresql",
- "image": "${POSTGRESQL_IMAGE}",
- "ports": [
- {
- "containerPort": 5432
- }
- ],
- "env": [
- {
- "name": "POSTGRESQL_USER",
- "value": "${DATABASE_USER}"
- },
- {
- "name": "POSTGRESQL_PASSWORD",
- "value": "${DATABASE_PASSWORD}"
- },
- {
- "name": "POSTGRESQL_DATABASE",
- "value": "${DATABASE_NAME}"
- },
- {
- "name": "POSTGRESQL_MAX_CONNECTIONS",
- "value": "${POSTGRESQL_MAX_CONNECTIONS}"
- },
- {
- "name": "POSTGRESQL_SHARED_BUFFERS",
- "value": "${POSTGRESQL_SHARED_BUFFERS}"
- }
- ]
- }
- ]
- }
- }
- }
- }
- ],
- "parameters": [
- {
- "name": "SOURCE_REPOSITORY_URL",
- "description": "The URL of the repository with your application source code",
- "value": "https://github.com/openshift/rails-ex.git"
- },
- {
- "name": "SOURCE_REPOSITORY_REF",
- "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",
- "description": "Set this to the relative path to your project if it is not in the root of your repository"
- },
- {
- "name": "APPLICATION_DOMAIN",
- "description": "The exposed hostname that will route to the Rails service, if left blank a value will be defaulted.",
- "value": ""
- },
- {
- "name": "GITHUB_WEBHOOK_SECRET",
- "description": "A secret string used to configure the GitHub webhook",
- "generate": "expression",
- "from": "[a-zA-Z0-9]{40}"
- },
- {
- "name": "SECRET_KEY_BASE",
- "description": "Your secret key for verifying the integrity of signed cookies",
- "generate": "expression",
- "from": "[a-z0-9]{127}"
- },
- {
- "name": "APPLICATION_USER",
- "description": "The application user that is used within the sample application to authorize access on pages",
- "value": "openshift"
- },
- {
- "name": "APPLICATION_PASSWORD",
- "description": "The application password that is used within the sample application to authorize access on pages",
- "value": "secret"
- },
- {
- "name": "RAILS_ENV",
- "description": "Environment under which the sample application will run. Could be set to production, development or test",
- "value": "production"
- },
- {
- "name": "DATABASE_SERVICE_NAME",
- "description": "Database service name",
- "value": "postgresql"
- },
- {
- "name": "DATABASE_USER",
- "description": "database username",
- "generate": "expression",
- "from": "user[A-Z0-9]{3}"
- },
- {
- "name": "DATABASE_PASSWORD",
- "description": "database password",
- "generate": "expression",
- "from": "[a-zA-Z0-9]{8}"
- },
- {
- "name": "DATABASE_NAME",
- "description": "database name",
- "value": "root"
- },
- {
- "name": "POSTGRESQL_IMAGE",
- "description": "Image to use for postgresql",
- "value": "openshift/postgresql-92-centos7"
- },
- {
- "name": "POSTGRESQL_MAX_CONNECTIONS",
- "description": "database max connections",
- "value": "10"
- },
- {
- "name": "POSTGRESQL_SHARED_BUFFERS",
- "description": "database shared buffers",
- "value": "12MB"
- }
- ]
- }
|