Skip to content

Commit

Permalink
Merge pull request #31 from MaxDragonheart/feat_update_ulgis_#29
Browse files Browse the repository at this point in the history
Feat update ulgis #29
  • Loading branch information
MaxDragonheart authored May 27, 2022
2 parents b33c2f2 + d188614 commit f982286
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 77 deletions.
5 changes: 3 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
GS_VERSION=2.20.1
GS_VERSION=2.20.4
GS_DEMO_DATA=False
GS_HTTP_PORT=8300
GS_INITIAL_MEMORY=1G
GS_MAXIMUM_MEMORY=4G
GS_MAXIMUM_MEMORY=4G
39 changes: 0 additions & 39 deletions README-docker-hub.md

This file was deleted.

7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Geoserver Docker Image

Geoserver's version 2.20.1, that runs on port 8300 as default with minimum 2GB and maximum 4GB of RAM.

Version tagged `low_cost_server` has minimum 512MB and maximum 2GB of RAM.
[Geoserver](https://geoserver.org/) runs on port 8300 as default with minimum 2GB and maximum 4GB of RAM.

## Credentials

Expand All @@ -25,7 +23,8 @@ Password: `geoserver`
## Run project
Use `.env` to customize your version:
```
GS_VERSION=2.20.1
GS_VERSION=2.20.4
GS_DEMO_DATA=False
GS_HTTP_PORT=8300
GS_INITIAL_MEMORY=1G
GS_MAXIMUM_MEMORY=4G
Expand Down
1 change: 1 addition & 0 deletions docker-compose-geoserver-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
dockerfile: Dockerfile
args:
GS_VERSION: ${GS_VERSION}
GS_DEMO_DATA: ${GS_DEMO_DATA}
GS_HTTP_PORT: ${GS_HTTP_PORT}
GS_INITIAL_MEMORY: ${GS_INITIAL_MEMORY}
GS_MAXIMUM_MEMORY: ${GS_MAXIMUM_MEMORY}
Expand Down
1 change: 1 addition & 0 deletions docker-compose-geoserver-nginx-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
dockerfile: Dockerfile
args:
GS_VERSION: ${GS_VERSION}
GS_DEMO_DATA: ${GS_DEMO_DATA}
GS_HTTP_PORT: ${GS_HTTP_PORT}
GS_INITIAL_MEMORY: ${GS_INITIAL_MEMORY}
GS_MAXIMUM_MEMORY: ${GS_MAXIMUM_MEMORY}
Expand Down
1 change: 1 addition & 0 deletions docker-compose-geoserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
image: maxdragonheart/geoserver:latest
environment:
GS_VERSION: ${GS_VERSION}
GS_DEMO_DATA: ${GS_DEMO_DATA}
GS_HTTP_PORT: ${GS_HTTP_PORT}
GS_INITIAL_MEMORY: ${GS_INITIAL_MEMORY}
GS_MAXIMUM_MEMORY: ${GS_MAXIMUM_MEMORY}
Expand Down
16 changes: 10 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ version: '3.7'

services:
geoserver:
image: maxdragonheart/geoserver:latest
# environment:
# GS_VERSION: ${GS_VERSION}
# GS_HTTP_PORT: ${GS_HTTP_PORT}
# GS_INITIAL_MEMORY: ${GS_INITIAL_MEMORY}
# GS_MAXIMUM_MEMORY: ${GS_MAXIMUM_MEMORY}
image: maxdragonheart/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_INITIAL_MEMORY: ${GS_INITIAL_MEMORY}
GS_MAXIMUM_MEMORY: ${GS_MAXIMUM_MEMORY}
container_name: geoserver
restart: always
volumes:
Expand Down
15 changes: 15 additions & 0 deletions docs/guides/docker-tips.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Docker

Build: `docker build -t LAYER-NAME .`

Build with args: `docker build --build-arg ARG1=VALUE1 --build-arg ARG2=VALUE2 -t LAYER-NAME .`

Run and access to container: `docker run -it LAYER-NAME`

Start container: `docker container run -it -d --name CONTAINER-NAME -p 8081:8080 LAYER-NAME`

List of active container: `docker ps`

List of images: `docker images`

Purge images and volumes: `docker system prune -a --volumes`
46 changes: 26 additions & 20 deletions geoserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# syntax=docker/dockerfile:1

# ULGIS as Layer
FROM gisconsultant/ulgis as gis-os
## Disable Prompt During Packages Installation
FROM maxdragonheart/ulgis:latest as gis-os
WORKDIR /
# Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive
## Update&Upgrade and install useful stuffs
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y unzip wget systemctl default-jdk
# Install JAVA and related stuffs
RUN apt-get install -y default-jdk libgdal-java
# Install useful stuffs
RUN apt-get install -y \
systemctl \
xsltproc

# GIS-OS as Layer
## Geoserver Web Archive Installation
## https://docs.geoserver.org/latest/en/user/installation/war.html
## Environment Variables
ARG TOMCAT_MAJOR=9
ARG TOMCAT_VERSION=9.0.58
ARG TOMCAT_VERSION=9.0.63
ARG CATALINA_HOME=/opt/tomcat
ARG GS_HTTP_PORT=8300

Expand All @@ -31,7 +35,7 @@ RUN mkdir ${TOMCAT_DOWNLOAD_FOLDER}
WORKDIR ${TOMCAT_DOWNLOAD_FOLDER}
RUN wget ${TOMCAT_LINK} \
&& tar xzvf apache-tomcat-${TOMCAT_VERSION}.tar.gz -C ${CATALINA_HOME} --strip-components=1
WORKDIR /
WORKDIR ../
RUN rm -rf ${TOMCAT_DOWNLOAD_FOLDER}
#COPY files/tomcat/context.xml ${CATALINA_HOME}/webapps/manager/META-INF
COPY files/tomcat/tomcat-users.xml ${CATALINA_HOME}/conf
Expand All @@ -41,21 +45,24 @@ COPY files/tomcat/web.xml ${CATALINA_HOME}/conf
FROM ubuntu:20.04 as tmp_image
## Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive
## Update&Upgrade Ubuntu and install useful stuffs
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y unzip wget
## Update&Upgrade Ubuntu
RUN apt-get update && apt-get upgrade -y
## Install useful stuffs
RUN apt-get install -y unzip wget

ARG GS_VERSION=2.20.1
ARG GS_VERSION=2.20.4
ARG GS_DEMO_DATA=False

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

### Download 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
## Remove default datadir with demo data
RUN rm -rf /data/geoserver/data
#RUN rm -rf /data/geoserver/data

## Download extensions
RUN mkdir -p data/plugins
Expand All @@ -66,7 +73,7 @@ RUN ./download-extensions.sh
# Tomcat as Layer
FROM tomcat as geoserver
ENV LIBJPEG_VERSION=2.0.6
RUN apt-get install -y libgdal-java cmake nasm \
RUN apt-get 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 \
Expand All @@ -80,6 +87,7 @@ RUN apt-get install -y libgdal-java cmake nasm \
&& 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 --from=tmp_image data/geoserver ${CATALINA_HOME}/webapps/geoserver
Expand All @@ -93,12 +101,12 @@ ENV GEOSERVER_HOME=${CATALINA_HOME}/webapps/geoserver
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
## 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
## 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
## CSRF Protection | https://docs.geoserver.org/stable/en/user/security/webadmin/csrf.html#csrf-protection
#ARG CSRF_WHITELIST="*"

ENV ENABLE_JSONP=${ENABLE_JSONP} \
Expand Down Expand Up @@ -134,8 +142,6 @@ ENV JAVA_OPTS="-Xms${GS_INITIAL_MEMORY} -Xmx${GS_MAXIMUM_MEMORY} \

COPY ./scripts/start-geoserver.sh ./
RUN chmod +x start-geoserver.sh
## Decomment to test bash file. Make sure to comment all after `RUN /start-geoserver.sh`
#RUN /start-geoserver.sh

WORKDIR ${GEOSERVER_HOME}
EXPOSE ${GS_HTTP_PORT}
Expand Down
2 changes: 1 addition & 1 deletion geoserver/files/geoserver/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<!--
<context-param>
<param-name>GEOSERVER_DATA_DIR</param-name>
<param-value>C:\eclipse\workspace\geoserver_trunk\cite\confCiteWFSPostGIS</param-value>
<param-value>/geoserver</param-value>
</context-param>
-->

Expand Down
5 changes: 5 additions & 0 deletions geoserver/scripts/download-extensions.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/env bash

##### FOR TEST ONLY
#GS_VERSION=2.21.0
##### FOR TEST ONLY

echo " ---> Extensions for Geoserver's version: $GS_VERSION"

declare -a EXTENSIONS_LINK_LIST
Expand Down
39 changes: 34 additions & 5 deletions geoserver/scripts/download-geoserver.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,53 @@
#!/usr/bin/env bash

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

GEOSERVER_LINK="http://sourceforge.net/projects/geoserver/files/GeoServer/${GS_VERSION}/geoserver-${GS_VERSION}-war.zip"
GEOSERVER_WAR=data/geoserver.war
GEOSERVER_FOLDER=data/geoserver

echo " ---> Start download of Geoserver $GS_VERSION"

echo " ---> Download Geoserver in downloads/"
pwd
echo " ---> Download Geoserver in $PWD/downloads/"
mkdir downloads/
echo " ---> Geoserver download link: $GEOSERVER_LINK"
wget "$GEOSERVER_LINK" -P downloads/

echo " ---> Unzip Geoserver from downloads/geoserver-$GS_VERSION-war.zip to data/"
echo " ---> Unzip and copy Geoserver"
echo " ------> from $PWD/downloads/geoserver-$GS_VERSION-war.zip"
echo " ------> to $PWD/data/"
unzip downloads/geoserver-"$GS_VERSION"-war.zip '*.war' -d data/

echo " ---> Unzip .war from $GEOSERVER_WAR to $GEOSERVER_FOLDER"
echo " ---> Unzip .war"
echo " ------> from $PWD/$GEOSERVER_WAR"
echo " ------> to $PWD/$GEOSERVER_FOLDER"
unzip "$GEOSERVER_WAR" -d "$GEOSERVER_FOLDER"

echo " ---> Delete of downloads/ and $GEOSERVER_WAR"
echo " ---> Deletion of:"
echo " ------> $PWD/downloads/"
echo " ------> $PWD/$GEOSERVER_WAR"
rm -rf downloads/
rm -rf "$GEOSERVER_WAR"

if [ "$GS_DEMO_DATA" = False ];
then
echo " ---> Remove demo data"

rm -rf data/geoserver/data/data/
rm -rf data/geoserver/data/layergroups/
rm -rf data/geoserver/data/palettes/
rm -rf data/geoserver/data/styles/
rm -rf data/geoserver/data/workspaces/

mkdir data/geoserver/data/data/
mkdir data/geoserver/data/layergroups/
mkdir data/geoserver/data/palettes/
mkdir data/geoserver/data/styles/
mkdir data/geoserver/data/workspaces/
fi


echo " ---> Geoserver download completed"
3 changes: 3 additions & 0 deletions geoserver/scripts/start-geoserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ echo " ---> JAVA_OPTS= $JAVA_OPTS"

export JAVA_OPTS="$JAVA_OPTS"

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

0 comments on commit f982286

Please sign in to comment.