diff --git a/conf/docker/dataverse-glassfish/default.config b/conf/docker/dataverse-glassfish/default.config index c9a7279742d..7af10336f30 100644 --- a/conf/docker/dataverse-glassfish/default.config +++ b/conf/docker/dataverse-glassfish/default.config @@ -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 diff --git a/conf/openshift/openshift.json b/conf/openshift/openshift.json index 330fc8914ae..5926ee2864c 100644 --- a/conf/openshift/openshift.json +++ b/conf/openshift/openshift.json @@ -42,6 +42,7 @@ "selector": { "name": "iqss-dataverse-postgresql" }, + "clusterIP": "None", "ports": [ { "name": "database", @@ -150,6 +151,10 @@ } ], "env": [ + { + "name": "POSTGRES_SERVER", + "value": "dataverse-postgresql-0" + }, { "name": "POSTGRES_SERVICE_HOST", "value": "dataverse-postgresql-service" @@ -222,8 +227,8 @@ } }, { - "kind": "DeploymentConfig", - "apiVersion": "v1", + "kind": "StatefulSet", + "apiVersion": "apps/v1beta1", "metadata": { "name": "dataverse-postgresql", "annotations": { @@ -231,6 +236,8 @@ } }, "spec": { + "serviceName" : "dataverse-postgresql-service", + "replicas" : 3, "template": { "metadata": { "labels": { @@ -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, @@ -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" @@ -281,6 +315,7 @@ ] } }, + "strategy": { "type": "Rolling", "rollingParams": { @@ -300,7 +335,7 @@ ], "from": { "kind": "ImageStreamTag", - "name": "centos-postgresql-94-centos7:latest" + "name": "centos/postgresql-94-centos7:latest" } } }, @@ -308,9 +343,11 @@ "type": "ConfigChange" } ], - "replicas": 1, "selector": { - "name": "iqss-dataverse-postgresql" + "name": "iqss-dataverse-postgresql", + "matchLabels" : { + "name" : "iqss-dataverse-postgresql" + } } } },