diff --git a/conf/openshift/openshift.json b/conf/openshift/openshift.json index bf74631cfb1..b49f7fedf23 100644 --- a/conf/openshift/openshift.json +++ b/conf/openshift/openshift.json @@ -124,15 +124,18 @@ } }, { - "kind": "DeploymentConfig", - "apiVersion": "v1", + "kind": "StatefulSet", + "apiVersion": "apps/v1beta1", "metadata": { "name": "dataverse-glassfish", "annotations": { - "template.alpha.openshift.io/wait-for-ready": "true" + "template.alpha.openshift.io/wait-for-ready": "true", + "alpha.image.policy.openshift.io/resolve-names": "*" } }, "spec": { + "serviceName" : "dataverse-glassfish", + "replicas": 1, "template": { "metadata": { "labels": { @@ -143,14 +146,26 @@ "containers": [ { "name": "dataverse-plus-glassfish", - "image": "dataverse-plus-glassfish", + "image": "iqss/dataverse-glassfish:latest", "ports": [ { "containerPort": 8080, "protocol": "TCP" } ], + "resources": {"limits": {"memory": "3072Mi" + } + + }, "env": [ + + { "name": "MY_POD_NAME", + "valueFrom": { + "fieldRef": { + "fieldPath": "metadata.name" + } + } + }, { "name": "POSTGRES_SERVER", "value": "dataverse-postgresql-0" @@ -184,7 +199,7 @@ "value": "dvndb" } ], - "imagePullPolicy": "IfNotPresent", + "imagePullPolicy": "Always", "securityContext": { "capabilities": {}, "privileged": false @@ -200,7 +215,9 @@ "intervalSeconds": 1, "timeoutSeconds": 300 }, - "resources": {} + "resources": {"limits": { + "memory": "512Mi" + }} }, "triggers": [ { @@ -220,9 +237,11 @@ "type": "ConfigChange" } ], - "replicas": 1, "selector": { - "name": "iqss-dataverse-glassfish" + "name": "iqss-dataverse-glassfish", + "matchLabels" : { + "name": "iqss-dataverse-glassfish" + } } } }, @@ -252,6 +271,7 @@ "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, @@ -306,7 +326,7 @@ "memory": "256Mi" } }, - "imagePullPolicy": "IfNotPresent", + "imagePullPolicy": "Always", "securityContext": { "capabilities": {}, "privileged": false @@ -371,7 +391,7 @@ "containers": [ { "name": "iqss-dataverse-solr", - "image": "iqss-dataverse-solr", + "image": "iqss-dataverse-solr:latest", "ports": [ { "containerPort": 8983, @@ -380,10 +400,10 @@ ], "resources": { "limits": { - "memory": "256Mi" + "memory": "1024Mi" } }, - "imagePullPolicy": "IfNotPresent", + "imagePullPolicy": "Always", "securityContext": { "capabilities": {}, "privileged": false diff --git a/scripts/installer/glassfish-setup.sh b/scripts/installer/glassfish-setup.sh index 397cebfc7e7..3bb9f6cb892 100755 --- a/scripts/installer/glassfish-setup.sh +++ b/scripts/installer/glassfish-setup.sh @@ -191,7 +191,20 @@ fi ### # Set up the data source for the timers -./asadmin $ASADMIN_OPTS set configs.config.server-config.ejb-container.ejb-timer-service.timer-datasource=jdbc/VDCNetDS + +if [ -z "$MY_POD_NAME" ] + then + ./asadmin $ASADMIN_OPTS set configs.config.server-config.ejb-container.ejb-timer-service.timer-datasource=jdbc/VDCNetDS + + else + echo $MY_POD_NAME + if [ $MY_POD_NAME == "dataverse-glassfish-0" ] + then + ./asadmin $ASADMIN_OPTS set configs.config.server-config.ejb-container.ejb-timer-service.timer-datasource=jdbc/VDCNetDS + echo "Only I Run The Jobs" + fi + fi + ### # Add the necessary JVM options: @@ -216,7 +229,20 @@ fi ./asadmin $ASADMIN_OPTS create-jvm-options "\-Ddoi.username=apitest" ./asadmin $ASADMIN_OPTS create-jvm-options "\-Ddoi.baseurlstring=https\://ezid.cdlib.org" # "I am the timer server" option: -./asadmin $ASADMIN_OPTS create-jvm-options "-Ddataverse.timerServer=true" + +if [ -z "$MY_POD_NAME" ] + then + ./asadmin $ASADMIN_OPTS create-jvm-options "-Ddataverse.timerServer=true" + + else + if [ $MY_POD_NAME == "dataverse-glassfish-0" ] + then + ./asadmin $ASADMIN_OPTS create-jvm-options "-Ddataverse.timerServer=true" + + fi + fi + + # enable comet support ./asadmin $ASADMIN_OPTS set server-config.network-config.protocols.protocol.http-listener-1.http.comet-support-enabled="true"