Skip to content

Commit

Permalink
Merge pull request #178 from metlos/fix-rails-postgresql
Browse files Browse the repository at this point in the history
Fix the openshift templates
  • Loading branch information
phracek authored Sep 24, 2024
2 parents c968771 + 6c29e30 commit 28f2fe3
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 15 deletions.
2 changes: 1 addition & 1 deletion openshift/templates/rails-postgresql-persistent.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@
"annotations": {
"description": "Defines how to deploy the database",
"template.alpha.openshift.io/wait-for-ready": "true",
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"postgresql:${POSTGRESQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"postgresql:${POSTGRESQL_VERSION}\", \"namespace\": \"${NAMESPACE}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
}
},
"spec": {
Expand Down
104 changes: 90 additions & 14 deletions openshift/templates/rails-postgresql.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,12 @@
"annotations": {
"description": "Defines how to deploy the application server",
"template.alpha.openshift.io/wait-for-ready": "true",
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"${NAME}:latest\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"${NAME}:latest\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"},{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"${NAME}:latest\"},\"fieldPath\": \"spec.template.spec.initContainers[0].image\"}]"
}
},
"spec": {
"strategy": {
"type": "Recreate",
"recreateParams": {
"pre": {
"failurePolicy": "Abort",
"execNewPod": {
"command": [
"./migrate-database.sh"
],
"containerName": "${NAME}"
}
}
}
"type": "Recreate"
},
"replicas": 1,
"selector": {
Expand All @@ -179,6 +168,86 @@
}
},
"spec": {
"initContainers": [
{
"name": "ruby-init-container",
"image": " ",
"command": [
"./migrate-database.sh"
],
"env": [
{
"name": "DATABASE_SERVICE_NAME",
"value": "${DATABASE_SERVICE_NAME}"
},
{
"name": "POSTGRESQL_USER",
"valueFrom": {
"secretKeyRef": {
"name": "${NAME}",
"key": "database-user"
}
}
},
{
"name": "POSTGRESQL_PASSWORD",
"valueFrom": {
"secretKeyRef": {
"name": "${NAME}",
"key": "database-password"
}
}
},
{
"name": "SECRET_KEY_BASE",
"valueFrom": {
"secretKeyRef": {
"name": "${NAME}",
"key": "keybase"
}
}
},
{
"name": "POSTGRESQL_DATABASE",
"value": "${DATABASE_NAME}"
},
{
"name": "POSTGRESQL_MAX_CONNECTIONS",
"value": "${POSTGRESQL_MAX_CONNECTIONS}"
},
{
"name": "POSTGRESQL_SHARED_BUFFERS",
"value": "${POSTGRESQL_SHARED_BUFFERS}"
},
{
"name": "APPLICATION_DOMAIN",
"value": "${APPLICATION_DOMAIN}"
},
{
"name": "APPLICATION_USER",
"valueFrom": {
"secretKeyRef": {
"name": "${NAME}",
"key": "application-user"
}
}
},
{
"name": "APPLICATION_PASSWORD",
"valueFrom": {
"secretKeyRef": {
"name": "${NAME}",
"key": "application-password"
}
}
},
{
"name": "RAILS_ENV",
"value": "${RAILS_ENV}"
}
]
}
],
"containers": [
{
"name": "${NAME}",
Expand Down Expand Up @@ -316,7 +385,7 @@
"annotations": {
"description": "Defines how to deploy the database",
"template.alpha.openshift.io/wait-for-ready": "true",
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"postgresql:12-el8\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"postgresql:${POSTGRESQL_VERSION}\", \"namespace\": \"${NAMESPACE}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
}
},
"spec": {
Expand Down Expand Up @@ -438,6 +507,13 @@
"required": true,
"value": "3.1-ubi8"
},
{
"name": "POSTGRESQL_VERSION",
"displayName": "Postgresql Version",
"description": "Version of Postgresql image to be used (12-el8 by default).",
"required": true,
"value": "12-el8"
},
{
"name": "MEMORY_LIMIT",
"displayName": "Memory Limit",
Expand Down

0 comments on commit 28f2fe3

Please sign in to comment.