Add Postgresql statefulsets with master/slave replication on OpenShift.#4599
Conversation
| MAIL_SERVER mail.hmdc.harvard.edu | ||
| POSTGRES_ADMIN_PASSWORD secret | ||
| POSTGRES_SERVER 127.0.0.1 | ||
| POSTGRES_SERVER dataverse-postgresql-0.dataverse-postgresql-service |
There was a problem hiding this comment.
This changes the default behavior (and default documentation example) to openshift - this change might be better to make in conf/docker/dataverse-glassfish/default.config.
There was a problem hiding this comment.
Right, we don't want to affect the "here" link at "If desired, these default values can be configured by creating a default.config (example here) file in the installer’s working directory" at http://guides.dataverse.org/en/4.8.6/installation/installation-main.html#running-the-dataverse-installer
Good catch @pameyer
@patrickdillon can you please put the "doc" version of the file back to how it was and make the change in conf/docker/dataverse-glassfish/default.config instead? Thanks!
There was a problem hiding this comment.
I understand. I believe I have fixed this now.
conf/openshift/openshift.json
Outdated
| "selector": { | ||
| "name": "iqss-dataverse-postgresql" | ||
| }, | ||
| "clusterIP": "None", |
1228f2d to
e3924e4
Compare
e3924e4 to
0b76e1d
Compare
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. Fixing formatting issues. More formatting.
0b76e1d to
51cecfc
Compare
| }, | ||
| "spec": { | ||
| "serviceName" : "dataverse-postgresql-service", | ||
| "replicas" : 1, |
There was a problem hiding this comment.
@danmcp raised the question of whether running a setup with only a master and no slaves would have any side effects. I think there would be no side effects and it would be similar to just running a single instance Postgres setup.
Our code is based off this example, which states:
Once the master is started, it works as a standalone database server, fully independent of the slaves.
I dug in a little more to the image to see what is happening:
For the postgres image, the only side effect for running as master is that these configuration settings are copied into the main postgres config file: https://github.com/sclorg/postgresql-container/blob/master/src/root/usr/share/container-scripts/postgresql/openshift-custom-postgresql-replication.conf.template
To me, the above settings look innocuous.
For further context, here is the master-binary: https://github.com/sclorg/postgresql-container/blob/master/src/root/usr/bin/run-postgresql-master
And that environment variable is called in this common script, which just copies the first file above into the main config settings: https://github.com/sclorg/postgresql-container/blob/b737ad26db4f8769e775ca165284f62c7f2a66db/src/root/usr/share/container-scripts/postgresql/common.sh
| { | ||
| "name": "centos-postgresql-94-centos7", | ||
| "image": "centos-postgresql-94-centos7", | ||
| "image": "centos/postgresql-94-centos7", |
There was a problem hiding this comment.
By using centos/postgresql-94-centos7 instead of centos-postgresql-94-centos7 we are pointing directly to the Docker Hub repo rather than the ImageStream. The reason I changed this was because it started throwing an error after changing from a DeploymentConfig to a StatefulSet v1beta1. I just tried testing again with the image stream and it still is getting the error. Once OpenShift is updated to a newer version we can try changing it back or if there are any suggestions let me know.
| "kind": "DeploymentConfig", | ||
| "apiVersion": "v1", | ||
| "kind": "StatefulSet", | ||
| "apiVersion": "apps/v1beta1", |
There was a problem hiding this comment.
Does v1beta1 require a beta version of minishift? Or can I just use the most recent regular release of minishift?
There was a problem hiding this comment.
Regular release is fine. I was running on v1.14
This pull requests modifies openshift.json to set up a postgres statefulset with master/slave replication.
This pull request requires that the dataverse glassfish image be rebuilt with the small tweak I committed in default.config (pointing to the master postgres pod). To test, perhaps before rebuilding the image, you can point to my docker image by changing line 113 in openshift.json to
"dockerImageRepository": "patrickdillon/dataverse-glassfish"No changes have been made to run dv on openshift:
oc new-project [name]oc new-app openshift.jsonOnce you have started, you can test with the psql client in each container. From the terminal in each postgres container, you can login and check that the tables were created. That should be enough to show changes from master have been replicated:
psql -d dvndb\dtYou can also make a change, such as changing the name of the dataverse from root to something else and then checking that with
select * from dataverse;I still need to update my Dockerhub image to incorporate the fixes to solr. I will do that soon and update if there are problems.
Related Issues