Skip to content

Commit

Permalink
Merge pull request #42 from MaxDragonheart/bug-not-found-#41
Browse files Browse the repository at this point in the history
Bug not found #41
  • Loading branch information
MaxDragonheart authored Jan 1, 2024
2 parents 2429d58 + e70833b commit 1657fe4
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 120 deletions.
3 changes: 1 addition & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
GS_VERSION=2.20.4
GS_DEMO_DATA=False
GS_HTTP_PORT=8300
GS_INITIAL_MEMORY=1G
GS_MAXIMUM_MEMORY=4G
TOMCAT_MAJOR=9
TOMCAT_MINOR=0
TOMCAT_PATCH=79
TOMCAT_PATCH=84
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Geoserver Docker Image

[Geoserver](https://geoserver.org/) runs on port 8300 as default with minimum 2GB and maximum 4GB of RAM.
Geoserver runs on port 8080 as default and it is based on Ubuntu 20.04 [because this error](https://stackoverflow.com/questions/76913667/unable-to-locate-package-libgdal-java) reported on [issue 37](https://github.com/MaxDragonheart/docker-geoserver/issues/37). ~~The latest version of this image use the latest stable version of Geoserver and Tomcat.~~ [issue 41](https://github.com/MaxDragonheart/docker-geoserver/issues/41)

On 01-01-2024:

- Geoserver stable version: [2.24.1](https://geoserver.org/download/)
- Tomcat stable version: [9.0.84](https://dlcdn.apache.org/tomcat/)

Since 01-01-2024 the image's tag system follow the official Geoserver's versions tag.

## Credentials

Expand All @@ -18,7 +25,6 @@ Password: `geoserver`
- [Vector Tiles](https://docs.geoserver.org/latest/en/user/extensions/vectortiles/index.html)
- [Web Coverage Service 2.0 Earth Observation extensions](https://docs.geoserver.org/latest/en/user/extensions/wcs20eo/index.html)
- [WMTS Multidimensional](https://docs.geoserver.org/latest/en/user/extensions/wmts-multidimensional/install.html)
- [INSPIRE](https://docs.geoserver.org/stable/en/user/extensions/inspire/index.html)

## Run project
Use `.env` to customize your version:
Expand Down
25 changes: 0 additions & 25 deletions docker-compose-geoserver.yml

This file was deleted.

6 changes: 3 additions & 3 deletions docker-compose-staging-nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ version: '3.7'

services:
geoserver:
image: maxdragonheart/dev-geoserver:${GS_VERSION}
image: maxdragonheart/staging-geoserver:${GS_VERSION}
build:
context: ./geoserver
dockerfile: Dockerfile
args:
GS_VERSION: ${GS_VERSION}
GS_DEMO_DATA: ${GS_DEMO_DATA}
GS_HTTP_PORT: ${GS_HTTP_PORT}
# GS_HTTP_PORT: ${GS_HTTP_PORT}
GS_INITIAL_MEMORY: ${GS_INITIAL_MEMORY}
GS_MAXIMUM_MEMORY: ${GS_MAXIMUM_MEMORY}
TOMCAT_MAJOR: ${TOMCAT_MAJOR}
TOMCAT_MINOR: ${TOMCAT_MINOR}
TOMCAT_PATCH: ${TOMCAT_PATCH}
container_name: dev_geoserver
container_name: staging_geoserver
restart: always
volumes:
- tomcat:/opt/tomcat
Expand Down
8 changes: 4 additions & 4 deletions docker-compose-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ version: '3.7'

services:
geoserver:
image: maxdragonheart/dev-geoserver:${GS_VERSION}
image: maxdragonheart/staging-geoserver:${GS_VERSION}
build:
context: ./geoserver
dockerfile: Dockerfile
args:
GS_VERSION: ${GS_VERSION}
GS_DEMO_DATA: ${GS_DEMO_DATA}
GS_HTTP_PORT: ${GS_HTTP_PORT}
# GS_HTTP_PORT: ${GS_HTTP_PORT}
GS_INITIAL_MEMORY: ${GS_INITIAL_MEMORY}
GS_MAXIMUM_MEMORY: ${GS_MAXIMUM_MEMORY}
TOMCAT_MAJOR: ${TOMCAT_MAJOR}
TOMCAT_MINOR: ${TOMCAT_MINOR}
TOMCAT_PATCH: ${TOMCAT_PATCH}
container_name: dev_geoserver
container_name: staging_geoserver
restart: always
ports:
- ${GS_HTTP_PORT}:8080
- 8080:8080
volumes:
- tomcat:/opt/tomcat
- geoserver:/opt/tomcat/webapps/geoserver
Expand Down
102 changes: 27 additions & 75 deletions geoserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@
#FROM maxdragonheart/ulgis:latest as gis-os Switch to this with issue #37
FROM ubuntu:20.04 as base-os
RUN apt update -y && apt upgrade -y && apt -y autoremove
# Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive

FROM base-os as gis-os

### In use till then will solve the issue #37 ###
# Install useful packages
RUN apt install -y \
nano \
unzip \
wget \
curl \
aptitude
### ###
aptitude \
openssl \
gettext

ARG GS_VERSION=2.20.4
ARG GS_DEMO_DATA=False

ENV GS_VERSION=${GS_VERSION} \
GS_DEMO_DATA=${GS_DEMO_DATA}


FROM base-os as gis-os
WORKDIR /
# Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive
# Install JAVA and related stuffs
RUN apt install -y openjdk-11-jdk
# Install GDAL stuffs
Expand All @@ -31,17 +37,18 @@ RUN apt install -y \
systemctl \
xsltproc


# GIS-OS as Layer
FROM gis-os as tomcat
## Geoserver Web Archive Installation
## https://docs.geoserver.org/latest/en/user/installation/war.html
## Environment Variables
ARG TOMCAT_MAJOR=9
ARG TOMCAT_MINOR=0
ARG TOMCAT_PATCH=79
ARG TOMCAT_PATCH=84
ARG TOMCAT_VERSION=${TOMCAT_MAJOR}.${TOMCAT_MINOR}.${TOMCAT_PATCH}
ARG CATALINA_HOME=/opt/tomcat
ARG GS_HTTP_PORT=8300
ARG GS_HTTP_PORT=8080

ENV \
TOMCAT_VERSION=${TOMCAT_VERSION} \
Expand All @@ -51,7 +58,6 @@ ENV \
GS_HTTP_PORT=${GS_HTTP_PORT}

RUN mkdir -p ${CATALINA_HOME}

RUN mkdir ${TOMCAT_DOWNLOAD_FOLDER}
WORKDIR ${TOMCAT_DOWNLOAD_FOLDER}
RUN echo ${TOMCAT_LINK}
Expand All @@ -63,86 +69,42 @@ RUN rm -rf ${TOMCAT_DOWNLOAD_FOLDER}
COPY files/tomcat/tomcat-users.xml ${CATALINA_HOME}/conf
COPY files/tomcat/web.xml ${CATALINA_HOME}/conf

# Image useful for stuffs collection
FROM base-os as tmp_image
## Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive
## Install useful stuffs
RUN apt install -y unzip wget

ARG GS_VERSION=2.23.4
ARG GS_DEMO_DATA=False

ENV GS_VERSION=${GS_VERSION} \
GS_DEMO_DATA=${GS_DEMO_DATA}

# Image useful for stuffs collection
FROM base-os as tmp_image_geoserver
## Download Geoserver
RUN mkdir -p data/geoserver
COPY scripts/download-geoserver.sh /download-geoserver.sh
RUN chmod +x download-geoserver.sh
RUN ./download-geoserver.sh


FROM base-os as tmp_image_extensions
## Download extensions
RUN mkdir -p data/plugins
COPY scripts/download-extensions.sh /download-extensions.sh
RUN chmod +x download-extensions.sh
RUN ./download-extensions.sh


# Tomcat as Layer
FROM tomcat as geoserver
ENV LIBJPEG_VERSION=2.0.6
RUN apt install -y cmake nasm \
&& wget https://nav.dl.sourceforge.net/project/libjpeg-turbo/${LIBJPEG_VERSION}/libjpeg-turbo-${LIBJPEG_VERSION}.tar.gz \
&& tar -zxf ./libjpeg-turbo-${LIBJPEG_VERSION}.tar.gz \
&& cd libjpeg-turbo-${LIBJPEG_VERSION} && cmake -G"Unix Makefiles" && make deb \
&& dpkg -i ./libjpeg*.deb && apt -f install \
&& apt -y purge cmake nasm\
&& apt clean \
&& apt -y autoclean \
&& apt -y autoremove \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/* \
&& rm -rf /var/tmp/* \
&& rm -rf /usr/share/man/* \
&& rm -rf /usr/share/doc/*
RUN rm -rf libjpeg-turbo-${LIBJPEG_VERSION} libjpeg-turbo-${LIBJPEG_VERSION}.tar.gz

RUN mkdir ${CATALINA_HOME}/webapps/geoserver
# Copy Geoserver version and its plugins from a tmp image to main image
COPY --from=tmp_image data/geoserver ${CATALINA_HOME}/webapps/geoserver
COPY --from=tmp_image data/plugins ${CATALINA_HOME}/webapps/geoserver/WEB-INF/lib
COPY --from=tmp_image_geoserver data/geoserver ${CATALINA_HOME}/webapps/geoserver
COPY --from=tmp_image_extensions data/plugins ${CATALINA_HOME}/webapps/geoserver/WEB-INF/lib
COPY files/geoserver/web.xml ${CATALINA_HOME}/webapps/geoserver/WEB-INF

ENV GEOSERVER_HOME=${CATALINA_HOME}/webapps/geoserver

#ARG GEOSERVER_DATA_DIR=""
## Global variables affecting WMS | https://docs.geoserver.org/latest/en/user/services/wms/global.html#wms-global-variables
#ARG ENABLE_JSONP=true
ARG ENABLE_JSONP=true
ARG MAX_FILTER_RULES=20
ARG OPTIMIZE_LINE_WIDTH=false
## Proxy Base URL | https://docs.geoserver.org/latest/en/user/configuration/globalsettings.html#proxy-base-url
#ARG DALLOW_ENV_PARAMETRIZATION=false
#ARG PROXY_BASE_URL=""
## Disable the GeoServer web administration interface | https://docs.geoserver.org/latest/en/user/production/config.html#disable-the-geoserver-web-administration-interface
#ARG DISABLE_WEB_INTERFACE=false
## CSRF Protection | https://docs.geoserver.org/stable/en/user/security/webadmin/csrf.html#csrf-protection
#ARG CSRF_WHITELIST="*"

ENV MAX_FILTER_RULES=${MAX_FILTER_RULES} \
OPTIMIZE_LINE_WIDTH=${OPTIMIZE_LINE_WIDTH}
# ENABLE_JSONP=${ENABLE_JSONP}

ENV GS_OPTIONS=" \
-XX:PerfDataSamplingInterval=500 -Dorg.geotools.referencing.forceXY=true \
-DMAX_FILTER_RULES=${MAX_FILTER_RULES} \
-DOPTIMIZE_LINE_WIDTH=${OPTIMIZE_LINE_WIDTH} \
-Duser.timezone=UTC \
-Dorg.geotools.shapefile.datetime=true"
# -DENABLE_JSONP=${ENABLE_JSONP} \
# -DNETCDF_DATA_DIR=${NETCDF_DATA_DIR} \
# -DGRIB_CACHE_DIR=${GRIB_CACHE_DIR} \
# -DGEOSERVER_CSRF_WHITELIST=${CSRF_WHITELIST} \
# -DGEOSERVER_CSRF_WHITELIST=true \
OPTIMIZE_LINE_WIDTH=${OPTIMIZE_LINE_WIDTH} \
ENABLE_JSONP=${ENABLE_JSONP}

## Container Considerations | https://docs.geoserver.org/stable/en/user/production/container.html#optimize-your-jvm
ARG GS_INITIAL_MEMORY=1G
Expand All @@ -151,20 +113,10 @@ ARG GS_MAXIMUM_MEMORY=4G
ENV GS_INITIAL_MEMORY=${GS_INITIAL_MEMORY} \
GS_MAXIMUM_MEMORY=${GS_MAXIMUM_MEMORY}

ENV JAVA_OPTS="-Xms${GS_INITIAL_MEMORY} -Xmx${GS_MAXIMUM_MEMORY} \
-Djava.awt.headless=true -server \
-Dfile.encoding=UTF8 \
-Djavax.servlet.request.encoding=UTF-8 \
-Djavax.servlet.response.encoding=UTF-8 \
-XX:SoftRefLRUPolicyMSPerMB=36000 -XX:+UseG1GC \
-XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -XX:ConcGCThreads=5 \
${GS_OPTIONS}"

COPY ./scripts/start-geoserver.sh ./
RUN chmod +x start-geoserver.sh

WORKDIR ${GEOSERVER_HOME}
EXPOSE ${GS_HTTP_PORT}

CMD ["/start-geoserver.sh", "run"]

CMD ["/start-geoserver.sh", "run"]
7 changes: 3 additions & 4 deletions geoserver/files/geoserver/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@
<context-param>
<param-name>ENABLE_JSONP</param-name>
<param-value>true</param-value>
<!-- <param-value>true</param-value> -->
</context-param>
<context-param>
<param-name>PROXY_BASE_URL</param-name>
<param-value>http://example.com/geoserver</param-value>
<param-value>http://127.0.0.1:8080/geoserver</param-value>
<!-- <param-value>http://82.58.146.45/geoserver</param-value> -->
</context-param>

Expand Down Expand Up @@ -327,8 +326,8 @@

<context-param>
<param-name>GEOSERVER_CSRF_WHITELIST</param-name>
<param-value>http://example.com</param-value>
<!-- <param-value>*</param-value> -->
<!-- <param-value>http://example.com</param-value>-->
<param-value>*</param-value>
</context-param>

</web-app>
3 changes: 2 additions & 1 deletion geoserver/scripts/download-extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ EXTENSIONS_LINK_LIST=(
"http://sourceforge.net/projects/geoserver/files/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-vectortiles-plugin.zip"
"http://sourceforge.net/projects/geoserver/files/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-wcs2_0-eo-plugin.zip"
"http://sourceforge.net/projects/geoserver/files/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-wmts-multi-dimensional-plugin.zip"
"http://sourceforge.net/projects/geoserver/files/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-inspire-plugin.zip"
# "http://sourceforge.net/projects/geoserver/files/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-inspire-plugin.zip"
)
ARRAY_LEN=${#EXTENSIONS_LINK_LIST[@]}

echo " ---> Extention to download: $ARRAY_LEN"

mkdir downloads/

echo " ---> Start download extensions"
for url in "${EXTENSIONS_LINK_LIST[@]}";
do
echo " ---> Start download of $url"
Expand Down
3 changes: 2 additions & 1 deletion geoserver/scripts/download-geoserver.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

##### FOR TEST ONLY
#GS_VERSION=2.21.0
#GS_VERSION=2.20.4
#GS_DEMO_DATA=True
##### FOR TEST ONLY

Expand Down Expand Up @@ -31,6 +31,7 @@ echo " ------> $PWD/downloads/"
echo " ------> $PWD/$GEOSERVER_WAR"
rm -rf downloads/
rm -rf "$GEOSERVER_WAR"
rm -rf data/geoserver/.gitignore

if [ "$GS_DEMO_DATA" = False ];
then
Expand Down
26 changes: 23 additions & 3 deletions geoserver/scripts/start-geoserver.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
#!/usr/bin/env bash

echo " ---> JAVA_OPTS= $JAVA_OPTS"
JAVA_COMMANDS="-XX:PerfDataSamplingInterval=500 \
-Dorg.geotools.referencing.forceXY=true \
-DMAX_FILTER_RULES=${MAX_FILTER_RULES} \
-DOPTIMIZE_LINE_WIDTH=${OPTIMIZE_LINE_WIDTH} \
-Duser.timezone=UTC \
-Dorg.geotools.shapefile.datetime=true \
-DENABLE_JSONP=${ENABLE_JSONP} \
-Xms${GS_INITIAL_MEMORY} \
-Xmx${GS_MAXIMUM_MEMORY} \
-Djava.awt.headless=true -server \
-Dfile.encoding=UTF8 \
-Djavax.servlet.request.encoding=UTF-8 \
-Djavax.servlet.response.encoding=UTF-8 \
-XX:SoftRefLRUPolicyMSPerMB=36000 \
-XX:+UseG1GC \
-XX:MaxGCPauseMillis=200 \
-XX:ParallelGCThreads=20 \
-XX:ConcGCThreads=5"

export JAVA_OPTS="$JAVA_OPTS"
echo " ---> JAVA COMMANDS: ${JAVA_COMMANDS}"

export JAVA_OPTS=${JAVA_COMMANDS}

echo " ---> Start Geoserver v. $GS_VERSION on port $GS_HTTP_PORT"
echo " ---> Start Geoserver v. $GS_VERSION on port $GS_HTTP_PORT"
echo " ---> Start Geoserver v. $GS_VERSION on port $GS_HTTP_PORT"
echo " ---> Start Geoserver v. $GS_VERSION on port $GS_HTTP_PORT"
exec /opt/tomcat/bin/catalina.sh run

exec /opt/tomcat/bin/catalina.sh run

0 comments on commit 1657fe4

Please sign in to comment.