Skip to content

Commit

Permalink
Add Postgresql statefulsets with master/slave replication on OpenShift.
Browse files Browse the repository at this point in the history
Add Postgresql statefulsets with master/slave replication on OpoenShift.

Simple test. Non functional.

Adding missing semicolon.

Glassfish starts but no dataverse.

Glassfish can connect to postgres but does not save in application.

Fixing service problem with postgres stateful set.

going to try to break command over multiple lines.

WIP extending image with S2I

Replication is working. Just needs to be cleaned up.

Cleaned up.

Removing print tests.

Resetting install to upstream.

Resetting build.sh to upstream.

Fixing image pull policy.

Fixing default config.
  • Loading branch information
patrickdillon committed Apr 18, 2018
1 parent b1bc951 commit e3924e4
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
2 changes: 1 addition & 1 deletion conf/docker/dataverse-glassfish/default.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ GLASSFISH_DIRECTORY /usr/local/glassfish4
ADMIN_EMAIL
MAIL_SERVER mail.hmdc.harvard.edu
POSTGRES_ADMIN_PASSWORD secret
POSTGRES_SERVER dataverse-postgresql-service
POSTGRES_SERVER dataverse-postgresql-0.dataverse-postgresql-service
POSTGRES_PORT 5432
POSTGRES_DATABASE dvndb
POSTGRES_USER dvnapp
Expand Down
49 changes: 43 additions & 6 deletions conf/openshift/openshift.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"selector": {
"name": "iqss-dataverse-postgresql"
},
"clusterIP": "None",
"ports": [
{
"name": "database",
Expand Down Expand Up @@ -150,6 +151,10 @@
}
],
"env": [
{
"name": "POSTGRES_SERVER",
"value": "dataverse-postgresql-0"
},
{
"name": "POSTGRES_SERVICE_HOST",
"value": "dataverse-postgresql-service"
Expand Down Expand Up @@ -222,15 +227,17 @@
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"kind": "StatefulSet",
"apiVersion": "apps/v1beta1",
"metadata": {
"name": "dataverse-postgresql",
"annotations": {
"template.alpha.openshift.io/wait-for-ready": "true"
}
},
"spec": {
"serviceName" : "dataverse-postgresql-service",
"replicas" : 3,
"template": {
"metadata": {
"labels": {
Expand All @@ -241,7 +248,10 @@
"containers": [
{
"name": "centos-postgresql-94-centos7",
"image": "centos-postgresql-94-centos7",
"image": "centos/postgresql-94-centos7",
"command": [
"sh", "-c", "echo 'Setting up Postgres Master/Slave replication...'; [[ `hostname` =~ -([0-9]+)$ ]] || exit 1; ordinal=${BASH_REMATCH[1]}; if [[ $ordinal -eq 0 ]]; then run-postgresql-master; else run-postgresql-slave; fi;"
],
"ports": [
{
"containerPort": 5432,
Expand All @@ -253,10 +263,34 @@
"name": "POSTGRESQL_USER",
"value": "dvnapp"
},
{
"name": "POSTGRESQL_MASTER_USER",
"value": "master"
},
{
"name": "POSTGRESQL_PASSWORD",
"value": "secret"
},
{
"name": "POSTGRESQL_MASTER_PASSWORD",
"value": "master"
},
{
"name": "POSTGRESQL_MASTER_SERVICE_NAME",
"value": "dataverse-postgresql-service"
},
{
"name": "POSTGRESQL_MASTER_IP",
"value": "dataverse-postgresql-0.dataverse-postgresql-service"
},
{
"name": "postgresql_master_addr",
"value": "dataverse-postgresql-0.dataverse-postgresql-service"
},
{
"name": "master_fqdn",
"value": "dataverse-postgresql-0.dataverse-postgresql-service"
},
{
"name": "POSTGRESQL_DATABASE",
"value": "dvndb"
Expand All @@ -281,6 +315,7 @@
]
}
},

"strategy": {
"type": "Rolling",
"rollingParams": {
Expand All @@ -300,17 +335,19 @@
],
"from": {
"kind": "ImageStreamTag",
"name": "centos-postgresql-94-centos7:latest"
"name": "centos/postgresql-94-centos7:latest"
}
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"name": "iqss-dataverse-postgresql"
"name": "iqss-dataverse-postgresql",
"matchLabels" : {
"name" : "iqss-dataverse-postgresql"
}
}
}
},
Expand Down

0 comments on commit e3924e4

Please sign in to comment.