Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release of GeoNetwork 4.0.0-alpha.2 #8731

Closed

Conversation

juanluisrp
Copy link
Contributor

Release of GeoNetwork 4.0.0-alpha.2
geonetwork/docker-geonetwork#53

@github-actions
Copy link

Diff for fb2ae7c:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index 182d688..1b55280 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -17,6 +17,6 @@ Tags: 3.10.3-postgres, 3.10-postgres, postgres
 GitCommit: 2c9bc51a681916fba85dd84b0e278c1c608d7d56
 Directory: 3.10.3/postgres
 
-Tags: 4.0.0-alpha.1, 4.0.0-alpha, 4.0-alpha, 4-alpha
-GitCommit: 4b3fa67a1869eb82609f4117bfe39ccfdd6b2387
-Directory: 4.0.0-alpha.1
+Tags: 4.0.0-alpha.2, 4.0.0-alpha, 4.0-alpha, 4-alpha
+GitCommit: 7e5d8c3c362360b4b62812e5ebe5591c9e22badd
+Directory: 4.0.0-alpha.2
diff --git a/_bashbrew-list b/_bashbrew-list
index de2342f..0165c85 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -9,6 +9,6 @@ geonetwork:3.10.3-postgres
 geonetwork:4-alpha
 geonetwork:4.0-alpha
 geonetwork:4.0.0-alpha
-geonetwork:4.0.0-alpha.1
+geonetwork:4.0.0-alpha.2
 geonetwork:latest
 geonetwork:postgres
diff --git a/geonetwork_4-alpha/Dockerfile b/geonetwork_4-alpha/Dockerfile
index 39c0c24..2b76c74 100644
--- a/geonetwork_4-alpha/Dockerfile
+++ b/geonetwork_4-alpha/Dockerfile
@@ -1,31 +1,26 @@
-FROM tomcat:8.5-jdk8
-
-ENV GN_FILE geonetwork.war
-ENV GN_VERSION 4.0.0-alpha.1
-ENV GN_DOWNLOAD_MD5 cbdd928213eb2afedf2a5d3891463c29
-
-ENV DATA_DIR=$CATALINA_HOME/webapps/geonetwork/WEB-INF/data
-ENV JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -server -Xms512m -Xmx2024m -XX:NewSize=512m -XX:MaxNewSize=1024m -XX:+UseConcMarkSweepGC -Dspring.profiles.active=es"
-
-ENV ES_HOST localhost
-ENV ES_PROTOCOL http
-ENV ES_PORT 9200
-ENV ES_USERNAME ""
-ENV ES_PASSWORD ""
-ENV KB_URL http://localhost:5601
-
-WORKDIR $CATALINA_HOME/webapps
-
-#COPY geonetwork.war ./geonetwork.war
-RUN curl -fSL -o $GN_FILE \
-     https://sourceforge.net/projects/geonetwork/files/GeoNetwork_unstable_development_versions/${GN_VERSION}/geonetwork.war/download && \
-     echo "$GN_DOWNLOAD_MD5 *${GN_FILE}" | md5sum -c && \
-     mkdir -p geonetwork && \
-     unzip -e $GN_FILE -d geonetwork && \
-     rm $GN_FILE
-
+FROM jetty:9-jre8
+
+ENV GN_FILE GeoNetwork-4.0.0-alpha.2.war
+ENV GN_VERSION 4.0.0-alpha.2
+ENV GN_DOWNLOAD_MD5 f6090659f67b313637760882e256c23b
+
+USER root
+RUN apt-get -y update && \
+    apt-get -y install curl && \
+    rm -rf /var/lib/apt/lists/* && \
+    mkdir -p /catalogue-data && \
+    chown -R jetty:jetty /catalogue-data && \
+    mkdir -p /var/lib/jetty/webapps/geonetwork && \
+    chown -R jetty:jetty /var/lib/jetty/webapps/geonetwork
+
+USER jetty
+RUN cd /var/lib/jetty/webapps/geonetwork/ && \
+    curl -fSL -o geonetwork.war \
+     https://sourceforge.net/projects/geonetwork/files/GeoNetwork_unstable_development_versions/${GN_VERSION}/$GN_FILE/download && \
+     echo "$GN_DOWNLOAD_MD5 *geonetwork.war" | md5sum -c && \
+     unzip geonetwork.war && \
+     rm geonetwork.war
 
 COPY ./docker-entrypoint.sh /entrypoint.sh
 ENTRYPOINT ["/entrypoint.sh"]
-
-CMD ["catalina.sh", "run"]
+CMD ["jetty.start"]
diff --git a/geonetwork_4-alpha/docker-entrypoint.sh b/geonetwork_4-alpha/docker-entrypoint.sh
index 21f3ee1..7b8d3be 100755
--- a/geonetwork_4-alpha/docker-entrypoint.sh
+++ b/geonetwork_4-alpha/docker-entrypoint.sh
@@ -1,72 +1,34 @@
 #!/bin/bash
 set -e
 
-if [ "$1" = 'catalina.sh' ]; then
-
-    mkdir -p "$DATA_DIR"
-
-    #Set geonetwork data dir
-    export CATALINA_OPTS="$CATALINA_OPTS -Dgeonetwork.dir=$DATA_DIR"
-
-    # postgresql mode enabled: reconfigure the webapp to enable postgres configuration
-
-    if [ "${POSTGRES_DB_HOST}" != "" ]; then
-        #Setting host (use $POSTGRES_DB_HOST if it's set, otherwise use "postgres")
-        db_host="${POSTGRES_DB_HOST:-postgres}"
-        echo "db host: $db_host"
-
-        #Setting port
-        db_port="${POSTGRES_DB_PORT:-5432}"
-        echo "db port: $db_port"
-
-        if [ -z "${POSTGRES_DB_USERNAME}" ] || [ -z "${POSTGRES_DB_PASSWORD}" ]; then
-            echo >&2 "You must set POSTGRES_DB_USERNAME and POSTGRES_DB_PASSWORD"
-            exit 1
-        fi
-
-        db_gn="${POSTGRES_DB_NAME:-geonetwork}"
-
-        #Write connection string for GN
-        sed -ri '/^jdbc[.](username|password|database|host|port)=/d' "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
-        echo "jdbc.username=$POSTGRES_DB_USERNAME" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
-        echo "jdbc.password=$POSTGRES_DB_PASSWORD" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
-        echo "jdbc.database=$db_gn" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
-        echo "jdbc.host=$db_host" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
-        echo "jdbc.port=$db_port" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
-
-        #Fixing an hardcoded port on the connection string (bug fixed on development branch)
-        sed -i -e 's#5432#${jdbc.port}#g' $CATALINA_HOME/webapps/geonetwork/WEB-INF/config-db/postgres.xml
-
-        # reconfigure h2 -> postgres
-        sed -i -e 's#<import resource="../config-db/h2.xml"/>#<!--import resource="../config-db/h2.xml"/-->#g' $CATALINA_HOME/webapps/geonetwork/WEB-INF/config-node/srv.xml
-        sed -i -e 's#<!--<import resource="../config-db/postgres.xml"/>-->#<import resource="../config-db/postgres.xml"/>#g' $CATALINA_HOME/webapps/geonetwork/WEB-INF/config-node/srv.xml
-
-    fi
-
-    # Reconfigure Elasticsearch & Kibana if necessary
+if [ "$1" = 'jetty.start' ]; then
   if [ "$ES_HOST" != "localhost" ]; then
-        sed -i "s#http://localhost:9200#${ES_PROTOCOL}://${ES_HOST}:${ES_PORT}#g" $CATALINA_HOME/webapps/geonetwork/WEB-INF/web.xml ;
-        sed -i "s#es.host=localhost#es.host=${ES_HOST}#" $CATALINA_HOME/webapps/geonetwork/WEB-INF/config.properties ;
+      sed -i "s#http://localhost:9200#${ES_PROTOCOL}://${ES_HOST}:${ES_PORT}#g" $JETTY_BASE/webapps/geonetwork/WEB-INF/web.xml ;
+      sed -i "s#es.host=localhost#es.host=${ES_HOST}#" $JETTY_BASE/webapps/geonetwork/WEB-INF/config.properties ;
   fi;
 
   if [ "$ES_PROTOCOL" != "http" ] ; then
-        sed -i "s#es.protocol=http#es.protocol=${ES_PROTOCOL}#" $CATALINA_HOME/webapps/geonetwork/WEB-INF/config.properties ;
+      sed -i "s#es.protocol=http#es.protocol=${ES_PROTOCOL}#" $JETTY_BASE/webapps/geonetwork/WEB-INF/config.properties ;
   fi
 
   if [ "$ES_PORT" != "9200" ] ; then
-        sed -i "s#es.port=9200#es.port=${ES_PORT}#" $CATALINA_HOME/webapps/geonetwork/WEB-INF/config.properties ;
+      sed -i "s#es.port=9200#es.port=${ES_PORT}#" $JETTY_BASE/webapps/geonetwork/WEB-INF/config.properties ;
   fi
+
   if [ "$ES_USERNAME" != "" ] ; then
-        sed -i "s#es.username=#es.username=${ES_USERNAME}#" $CATALINA_HOME/webapps/geonetwork/WEB-INF/config.properties ;
+      sed -i "s#es.username=#es.username=${ES_USERNAME}#" $JETTY_BASE/webapps/geonetwork/WEB-INF/config.properties ;
   fi
+
   if [ "$ES_PASSWORD" != "" ] ; then
-        sed -i "s#es.password=#es.password=${ES_PASSWORD}#" $CATALINA_HOME/webapps/geonetwork/WEB-INF/config.properties ;
+      sed -i "s#es.password=#es.password=${ES_PASSWORD}#" $JETTY_BASE/webapps/geonetwork/WEB-INF/config.properties ;
   fi
 
   if [ "$KB_URL" != "http://localhost:5601" ]; then
-        sed -i "s#kb.url=http://localhost:5601#kb.url=${KB_URL}#" $CATALINA_HOME/webapps/geonetwork/WEB-INF/config.properties ;
-        sed -i "s#http://localhost:5601#${KB_URL}#g" $CATALINA_HOME/webapps/geonetwork/WEB-INF/web.xml ;
+      sed -i "s#kb.url=http://localhost:5601#kb.url=${KB_URL}#" $JETTY_BASE/webapps/geonetwork/WEB-INF/config.properties ;
+      sed -i "s#http://localhost:5601#${KB_URL}#g" $JETTY_BASE/webapps/geonetwork/WEB-INF/web.xml ;
   fi
-fi
 
-exec "$@"
+  java $JAVA_OPTIONS -jar /usr/local/jetty/start.jar
+else
+  exec "$@"
+fi

@yosifkit
Copy link
Member

You definitely still need exec to apply to the resident server process so that the shell doesn't stay resident.

-  java $JAVA_OPTIONS -jar /usr/local/jetty/start.jar
+  exec java $JAVA_OPTIONS -jar /usr/local/jetty/start.jar

Also, the change from JAVA_OPTS to JAVA_OPTIONS might cause some user problems on upgrade if they are overriding it?

@juanluisrp
Copy link
Contributor Author

For these new versions we have switched from Tomcat to Jetty. The option for settings JVM options in Jetty based images is to use JAVA_OPTIONS.
What have other projects in this case?
Should we keep JAVA_OPTS and assign its value to JAVA_OPTIONS in the entrypoint?

@yosifkit
Copy link
Member

For these new versions we have switched from Tomcat to Jetty. The option for settings JVM options in Jetty based images is to use JAVA_OPTIONS.
What have other projects in this case?
Should we keep JAVA_OPTS and assign its value to JAVA_OPTIONS in the entrypoint?

You can use whichever variable you want, I was just concerned for breaking users. On the other hand, I don't see a need to use/support the one from jetty, since you aren't using their scripts.

@tianon
Copy link
Member

tianon commented Sep 17, 2020

(IMO, it seems a little odd to be FROM jetty at all if you're not going to use their scripts 😅)

@juanluisrp
Copy link
Contributor Author

(IMO, it seems a little odd to be FROM jetty at all if you're not going to use their scripts 😅)

We could install Jetty ourselves but I would like to get the image rebuilt when base Jetty image is updated.

@yosifkit
Copy link
Member

closing in favor of #8969

@yosifkit yosifkit closed this Oct 27, 2020
@juanluisrp juanluisrp deleted the geonetwork-4.0.0-alpha.2 branch October 28, 2020 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants