├── .gitattributes
├── .github
└── workflows
│ └── main.yml
├── .gitignore
├── README.md
├── build
├── Dockerfile
├── build.bat
├── build.sh
├── download.sh
├── resources
│ ├── fonts
│ │ ├── LiberationSans-Bold.ttf
│ │ ├── LiberationSans-BoldItalic.ttf
│ │ ├── LiberationSans-Italic.ttf
│ │ ├── LiberationSans-Regular.ttf
│ │ ├── OCHA-Icons-Bounded.ttf
│ │ ├── OCHA-Icons-Unbounded.ttf
│ │ ├── README.txt
│ │ ├── Roboto-Black.ttf
│ │ ├── Roboto-BlackItalic.ttf
│ │ ├── Roboto-Bold.ttf
│ │ ├── Roboto-BoldItalic.ttf
│ │ ├── Roboto-Italic.ttf
│ │ ├── Roboto-Light.ttf
│ │ ├── Roboto-LightItalic.ttf
│ │ ├── Roboto-Medium.ttf
│ │ ├── Roboto-MediumItalic.ttf
│ │ ├── Roboto-Regular.ttf
│ │ ├── Roboto-Thin.ttf
│ │ ├── Roboto-ThinItalic.ttf
│ │ └── Strategi_Symbols.ttf
│ ├── plugins
│ │ └── .gitkeep
│ └── tomcat
│ │ ├── tomcat_server_stylesheet.xsl
│ │ └── update_tomcat_settings.sh
├── run.bat
└── run.sh
├── docker-compose.yml
├── env.list
├── nginx
└── nginx.conf
├── run.sh
├── sshd.conf
└── tomcat_settings
├── logs_8085
└── placeholder.txt
├── logs_8086
└── placeholder.txt
└── setenv.sh
/.gitattributes:
--------------------------------------------------------------------------------
1 | # These settings are for any web project
2 |
3 | # Handle line endings automatically for files detected as text
4 | # and leave all files detected as binary untouched.
5 | * text=auto
6 |
7 | # Force the following filetypes to have linux line endings
8 | *.sh text eol=lf
9 |
10 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: Build & publish tW images
2 | on:
3 | push:
4 | branches:
5 | - "master"
6 | jobs:
7 | build-and-push-image:
8 | runs-on: ubuntu-latest
9 | strategy:
10 | fail-fast: false
11 | matrix:
12 | include:
13 | - tag: 2.26.0-jms # 2.22.1
14 | gs-version: 2.26.0
15 | label: 2.26.0-jms
16 | permissions:
17 | contents: read
18 | packages: write
19 |
20 | steps:
21 | - name: Checkout repository
22 | uses: actions/checkout@v3
23 |
24 | - name: Log in to the Docker Hub
25 | uses: docker/login-action@v2
26 | with:
27 | username: ${{ secrets.DOCKERHUB_USERNAME }}
28 | password: ${{ secrets.DOCKERHUB_TOKEN }}
29 |
30 | - name: Set up QEMU
31 | uses: docker/setup-qemu-action@v2
32 | with:
33 | platforms: linux/arm64/v8
34 |
35 | - name: Set up Docker Buildx
36 | uses: docker/setup-buildx-action@v2
37 |
38 | - name: Extract metadata (tags, labels) for Docker
39 | id: meta
40 | uses: docker/metadata-action@v4
41 | with:
42 | images: thinkwhere/geoserver
43 | tags: ${{ matrix.tag }}
44 |
45 | - name: Download build files
46 | run: |
47 | cd build
48 | chmod +x ./download.sh
49 | sudo ./download.sh "${{ matrix.gs-version }}"
50 |
51 | - name: Build and push application-base
52 | uses: docker/build-push-action@v4
53 | with:
54 | context: ./build
55 | file: ./build/Dockerfile
56 | build-args: |
57 | GS_VERSION=${{ matrix.gs-version }}
58 | push: true
59 | tags: ${{ steps.meta.outputs.tags }}
60 | platforms: linux/arm64/v8
61 | labels: ${{ steps.meta.outputs.labels }}
62 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore downloaded application and plugins
2 | *.zip
3 | .idea
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # docker-geoserver
2 |
3 | A simple docker container that runs Geoserver influenced by this docker
4 | recipe: https://github.com/kartoza/docker-geoserver by Tim Sutton. Created with input from GeoSolutions.
5 |
6 | This container is configured to build with:
7 | * Tomcat9
8 | * Openjdk 11
9 | * GeoServer 2.8.x +
10 | * GeoServer Plugins: Any plugins downloaded to /resources/plugins folder will be included in the container
11 | * Truetype fonts: Any .ttf fonts copied to the /resources/fonts folder will be included in the container
12 |
13 |
14 | **Note:** We recommend using ``apt-cacher-ng`` to speed up package fetching -
15 | you should configure the host for it in the provided 71-apt-cacher-ng file.
16 |
17 | ## Getting Started
18 |
19 | The image can be downloaded from our image on dockerhub. There are tagged images for most versions that have been released since 2.8:
20 |
21 | ```shell
22 | docker pull thinkwhere/geoserver
23 | ```
24 |
25 | To build the image yourself:
26 |
27 | ```shell
28 | docker build -t thinkwhere/geoserver git://github.com/thinkwhere/geoserver-docker/build
29 | ```
30 |
31 | Or for more control over the contents of the image, clone the repository first. This way you can specify the version to build, and choose which fonts and plugins to include
32 |
33 |
34 | ```shell
35 | git clone git://github.com/thinkwhere/geoserver-docker
36 |
37 | cd geoserver/build
38 |
39 | docker build --build-arg GS_VERSION=2.18.2 -t mygeoserver .
40 | ```
41 |
42 | ### Build scripts
43 |
44 | For convenience, there is a `build.bat` and `build.sh` for running the build.
45 | - Edit these with the GeoServer version you want to build
46 | - Edit these to set the plugins variable with the list of plugins to include in the build
47 | - Run the appropriate build.x file for your environment (build.bat for Docker in Windows; build.sh for Docker in Linux)
48 |
49 |
50 | ## Options
51 |
52 | ### Geoserver Plugins
53 |
54 | To build the GeoServer image with plugins (Control Flow, Monitor, Inspire, etc),
55 | download the plugin zip files from the GeoServer download page and put them in
56 | `resources/plugins` before building. You should make sure these match the version of
57 | GeoServer you are installing.
58 | GeoServer version is controlled by the variable in Dockerfile or the build script, or download the WAR bundle
59 | for the version you want to `resources/geoserver.zip` before building.
60 |
61 | ### Community Plugins
62 |
63 | Community plugins are also available (S3 Geotiff) and can be added by placing the appropraite zip file(s) in the same location.
64 | They are not available from the SourceForge source used in the build scripts, so additional scripting has been
65 | included to source them from [GeoSever](https://build.geoserver.org/). Make sure that these lines are included and the list of
66 | plugins includes the plugin(s) required.
67 | ### Custom Fonts
68 |
69 | To include any .ttf fonts with symbols in your container, copy them into the `resources/fonts` folder
70 | before building.
71 |
72 | This repo bundles the following 3rd-party fonts:
73 |
74 | * UN OCHA fonts for humanitarian relief mapping (http://reliefweb.int/report/world/world-humanitarian-and-country-icons-2012).
75 | * Roboto fonts from google (https://github.com/google/roboto/).
76 | * Liberation Sans fonts from Red Hat (https://www.dafont.com/liberation-sans.font).
77 |
78 |
79 | ### Tomcat Extras
80 |
81 | Tomcat is bundled with extras including docs, examples, etc. If you don't need these, set
82 | the `TOMCAT_EXTRAS` build-arg to `false` when building the image. (This is the default in
83 | build.sh.)
84 |
85 | ```shell
86 | docker build --build-arg TOMCAT_EXTRAS=false -t thinkwhere/geoserver-docker .
87 | ```
88 |
89 | ### GeoWebCache
90 |
91 | GeoServer is installed by default with the integrated GeoWebCache functionality. If you are using
92 | the stand-alone GeoWebCache, or another caching engine such as MapProxy, you can remove the built-in GWC
93 | by setting the `DISABLE_GWC` build-arg to `true` when building the image.
94 |
95 | ```shell
96 | docker build --build-arg DISABLE_GWC=true -t thinkwhere/geoserver-docker .
97 | ```
98 |
99 | **Note:** this removes all *gwc* jar files from the installation. If you are building with plugins that have
100 | dependencies on the gwc classes, using this option could prevent geoserver from initializing.
101 | (examples include: INSPIRE plugin v2.9.2+; control-flow plugin v2.9.2+)
102 |
103 | ### Native JAI / JAI ImageIO
104 |
105 | Native JAI and JAI ImageIO are included in the final image by default providing better
106 | performance for raster data processing. Unfortunately they native JAI is not under active
107 | development anymore. In the event that you face issues with raster data processing,
108 | they can remove them from the final image by setting the `JAI_IMAGEIO` build-arg to `false`
109 | when building the image.
110 |
111 | ```shell
112 | docker build --build-arg JAI_IMAGEIO=false -t thinkwhere/geoserver-docker .
113 | ```
114 |
115 | ### GDAL Image Formats support
116 |
117 | You can optionally include native GDAL libraries and GDAL extension in the image to enable
118 | support for GDAL image formats.
119 |
120 | To include native GDAL libraries in the image, set the `GDAL_NATIVE` build-arg to `true`
121 | when building the image.
122 |
123 | ```shell
124 | docker build --build-arg GDAL_NATIVE=true -t thinkwhere/geoserver-docker .
125 | ```
126 |
127 | To include the GDAL extension in the final image download the extension and place the zip
128 | file in the `resources/plugins` folder before building the image. If you use the build.sh
129 | script to build the image simply uncomment the relevant part of the script.
130 |
131 | ```shell
132 | #if [ ! -f resources/plugins/geoserver-gdal-plugin.zip ]
133 | #then
134 | # wget -c http://netix.dl.sourceforge.net/project/geoserver/GeoServer/2.8.3/extensions/geoserver-2.8.3-gdal-plugin.zip -O resources/plugins/geoserver-gdal-plugin.zip
135 | #fi
136 | ```
137 |
138 | ### S3 Geotiff plugin
139 |
140 | The S3 Geotiff plugin is required to serve GeoTiffs from S3.
141 | NOTE: that it is a community plugin and therefore not officially supported
142 |
143 | This plugin requires that environment variables are set for:
144 | - AWS_ACCESS_KEY
145 | - AWS_SECRET_KEY
146 |
147 | These are included in the setenv.sh file in tomcat_settings and should be edited to have appropriate values.
148 |
149 | See [Setting Tomcat properties](#setting-tomcat-properties) for an example of including this.
150 |
151 | ## Run
152 |
153 | ### External geoserver_data directory
154 | You probably want to run Geoserver with an external geoserver_data directory mapped as a docker volume.
155 | This allows the configuration to be persisted or shared with other instances. To create a running container
156 | with an external volume do:
157 |
158 | ```shell
159 | mkdir -p ~/geoserver_data
160 | docker run \
161 | --name=geoserver \
162 | -p 8080:8080 \
163 | -d \
164 | -v $HOME/geoserver_data:/opt/geoserver/data_dir \
165 | -t thinkwhere/geoserver
166 | ```
167 |
168 | ### Running multiple instances on the same machine
169 | For installations with multiple containers on the same host, map port 8080 to a different port for each
170 | instance. It is recommended that the instance name contains the mapped port no for ease of reference.
171 | Each instance should also have its own log file, specified by passing in the `GEOSERVER_LOG_LOCATION'
172 | variable as illustrated in the example below.
173 |
174 | ```shell
175 | mkdir -p ~/geoserver_data
176 | docker run \
177 | --name=geoserver \
178 | -p 8085:8080 \
179 | -d \
180 | -v $HOME/geoserver_data:/opt/geoserver/data_dir \
181 | -e "GEOSERVER_LOG_LOCATION=/opt/geoserver/data_dir/logs/geoserver_8085.log" \
182 | -t thinkwhere/geoserver
183 | ```
184 |
185 | ### Setting Tomcat properties
186 |
187 | To set Tomcat properties such as maximum heap memory size, create a `setenv.sh`
188 | file such as:
189 |
190 | ```shell
191 | JAVA_OPTS="$JAVA_OPTS -Xmx1024M"
192 | JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled"
193 | ```
194 |
195 | Then pass the `setenv.sh` file as a volume at `/usr/local/tomcat/bin/setenv.sh` when running:
196 |
197 | ```shell
198 | docker run -d \
199 | -v $HOME/tomcat/setenv.sh:/usr/local/tomcat/bin/setenv.sh \
200 | thinkwhere/geserver
201 | ```
202 |
203 | It is also possible to pass in custom values to Tomcat which are controlled in server.xml, for example `MaxHttpHeaderSize`. A full list of these parameters can be found in `build/tomcat/update_tomcat_settings.sh`
204 |
205 | Environemnt variables can be passed in to the `docker run` command, as well as a request to run `update_tomcat_settings.sh` which will pass these values into the Tomcat `server.xml`.
206 |
207 | For example -
208 |
209 | ```shell
210 | docker run -e "HTTP_MAX_HEADER_SIZE=524288" -t thinkwhere/geoserver:2.18.3 /bin/sh -c conf/update_tomcat_settings.sh
211 | ```
212 |
213 |
214 | This repository contains a ``run.sh`` script for your convenience.
215 |
216 | ### Using docker-compose
217 |
218 | Docker-compose allows you to deploy a load-balanced cluster of geoserver containers with a single command. A sample docker-compose.yml configuration file is included in this repository, along with a sample nginx configuration file.
219 |
220 | To deploy using docker-compose:
221 |
222 | 1. copy nginx folder from this repository to your machine.
223 | 2. copy tomcat_settings folder from this repository to your machine.
224 | 3. copy docker-compose.yml to your machine. Edit the volume entries to reflect the correct location of your geoserver_data, nginx and tomcat_settings folders on your machine.
225 | 4. type `docker-compose up -d` to start up a load-balanced cluster of 2x geoserver containers + nginx.
226 | 5. access geoserver services at http://localhost/geoserver/wms?
227 |
228 | **Note:** The default geoserver user is 'admin' and the password is 'geoserver'.
229 | It is recommended that these are changed for production systems.
230 |
231 |
--------------------------------------------------------------------------------
/build/Dockerfile:
--------------------------------------------------------------------------------
1 | #--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
2 | # Defaults to amd64:
3 | FROM tomcat:9-jre11-temurin@sha256:bf23f2dffde0c1b6ef6eaba95e05f531a3a6f274c5234d10126d73b092db18b6
4 | # Valid for arm64:
5 | # FROM tomcat:9-jre11-temurin@sha256:96f05b79814a1fb0523e3063668b4e3be7a1bbb01e6e6b2757915764381825ac
6 | #9.0-jre11-slim
7 | #9.0.65-jdk11-openjdk-slim
8 | MAINTAINER thinkWhere
9 | # Credit: Tim Sutton
10 | # kartoza/docker-geoserver
11 |
12 | RUN apt-get clean; apt-get update --fix-missing; apt-get -y install libapr1-dev \
13 | libssl-dev wget zip curl xsltproc certbot cabextract
14 |
15 | RUN set -e \
16 | export DEBIAN_FRONTEND=noninteractive \
17 | dpkg-divert --local --rename --add /sbin/initctl \
18 | # Set JAVA_HOME to /usr/lib/jvm/default-java and link it to OpenJDK installation
19 | # && ln -s /usr/lib/jvm/java-11-openjdk-amd64 /usr/lib/jvm/default-java \
20 | && apt-get clean \
21 | && rm -rf /var/lib/apt/lists/*
22 |
23 |
24 | #-------------Application Specific Stuff ----------------------------------------------------
25 |
26 | ENV DEBIAN_FRONTEND=noninteractive \
27 | GEOSERVER_DATA_DIR=/opt/geoserver/data_dir \
28 | GDAL_SKIP="ECW JP2ECW" \
29 | GDAL_DATA=/usr/local/gdal-data \
30 | # AMD64 architecture:
31 | LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/apr/lib:/usr/lib:/usr/lib/x86_64-linux-gnu"
32 | # ARM64 architecture:
33 | # LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/apr/lib:/usr/lib:/usr/lib/aarch64-linux-gnu"
34 |
35 |
36 | RUN mkdir -p ${GEOSERVER_DATA_DIR}
37 |
38 | ADD resources /tmp/resources
39 |
40 | # Optionally remove Tomcat manager, docs, and examples
41 | ARG TOMCAT_EXTRAS=false
42 | RUN if [ "$TOMCAT_EXTRAS" = false ]; then \
43 | rm -rf $CATALINA_HOME/webapps/ROOT && \
44 | rm -rf $CATALINA_HOME/webapps/docs && \
45 | rm -rf $CATALINA_HOME/webapps/examples && \
46 | rm -rf $CATALINA_HOME/webapps/host-manager && \
47 | rm -rf $CATALINA_HOME/webapps/manager; \
48 | fi;
49 |
50 | # ---------- GS_Version will be passed in as a parameter ------------
51 | ARG GS_VERSION
52 |
53 | # Add GDAL native libraries if the build-arg GDAL_NATIVE = true
54 | # EWC and JP2ECW are subjected to licence restrictions
55 | ARG GDAL_NATIVE=false
56 | RUN if [ "$GDAL_NATIVE" = true ]; then \
57 | wget --progress=bar http://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.16/native/gdal/gdal-data.zip \
58 | -O /tmp/resources/gdal-data.zip && \
59 | wget --progress=bar http://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.29/native/gdal/linux/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz \
60 | -O /tmp/resources/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz && \
61 | unzip /tmp/resources/gdal-data.zip -d /usr/local && \
62 | mkdir /usr/local/gdal_native_libs && \
63 | tar -xvf /tmp/resources/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz -C /usr/local/gdal_native_libs; \
64 | apt-get update; \
65 | apt-get install -y gdal-bin --fix-missing; \
66 | fi;
67 |
68 |
69 | # If using GDAL make sure extension is downloaded
70 | RUN if [ "$GDAL_NATIVE" = true ] && [ ! -f /tmp/resources/plugins/geoserver-gdal-plugin.zip ]; then \
71 | wget --progress=bar -c http://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-gdal-plugin.zip \
72 | -O /tmp/resources/plugins/geoserver-gdal-plugin.zip; \
73 | fi;
74 |
75 | WORKDIR $CATALINA_HOME
76 |
77 |
78 | # Fetch the geoserver war file if it
79 | # is not available locally in the resources dir and
80 | RUN if [ ! -f /tmp/resources/geoserver.zip ]; then \
81 | wget --progress=bar -c http://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/geoserver-${GS_VERSION}-war.zip \
82 | -O /tmp/resources/geoserver.zip; \
83 | fi; \
84 | unzip /tmp/resources/geoserver.zip -d /tmp/geoserver \
85 | && unzip /tmp/geoserver/geoserver.war -d $CATALINA_HOME/webapps/geoserver \
86 | && rm -rf $CATALINA_HOME/webapps/geoserver/data \
87 | && rm -rf /tmp/geoserver
88 |
89 | # Install any plugin zip files in resources/plugins
90 | RUN if ls /tmp/resources/plugins/*.zip > /dev/null 2>&1; then \
91 | for p in /tmp/resources/plugins/*.zip; do \
92 | unzip $p -d /tmp/gs_plugin \
93 | && mv /tmp/gs_plugin/*.jar $CATALINA_HOME/webapps/geoserver/WEB-INF/lib/ \
94 | && rm -rf /tmp/gs_plugin; \
95 | done; \
96 | fi;
97 |
98 | # Install Font files in resources/fonts if they exist
99 | RUN if ls /tmp/resources/fonts/*.ttf > /dev/null 2>&1; then \
100 | cp -rf /tmp/resources/fonts/*.ttf /usr/share/fonts/truetype/; \
101 | fi;
102 |
103 | # Copy across script and XML stylesheet which will allow the Tomcat server.xml to be parameterised
104 | RUN cp /tmp/resources/tomcat/* $CATALINA_HOME/conf/
105 | RUN chmod +x $CATALINA_HOME/conf/update_tomcat_settings.sh
106 |
107 | # Delete resources after installation
108 | RUN rm -rf /tmp/resources
109 |
110 | # CMD "/opt/geoserver/bin/startup.sh"
111 | EXPOSE 8080
--------------------------------------------------------------------------------
/build/build.bat:
--------------------------------------------------------------------------------
1 | @Echo off
2 |
3 | SET GS_VERSION=2.18.3
4 | SET BUILD_GS_VERSION=%GS_VERSION:~0,4%
5 |
6 | rem Create plugins folder if does not exist
7 | if not exist .\resources\NUL mkdir .\resources
8 | if not exist .\resources\plugins\NUL mkdir .\resources\plugins
9 |
10 | SET plugins=control-flow,inspire,monitor,css,ysld,web-resource,sldservice,gwc-s3
11 |
12 | rem Download plugins from list above. Modify list as required
13 | rem works for windows 10 powershell
14 |
15 | for %%f in (%plugins%) do (
16 | if not exist resources\plugins\geoserver-%%f-plugin.zip powershell.exe Invoke-WebRequest -OutFile resources/plugins/geoserver-%%f-plugin.zip -Uri https://sourceforge.net/projects/geoserver/files/GeoServer/%GS_VERSION%/extensions/geoserver-%GS_VERSION%-%%f-plugin.zip/download -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
17 | @ECHO geoserver-%%f-plugin downloaded.
18 | )
19 |
20 | SET community_plugins=cog
21 |
22 | rem Community plugins are not available from sourgeforge
23 | rem therefore source from https://build.geoserver.org/
24 |
25 | for %%f in (%community_plugins%) do (
26 | if not exist resources\plugins\geoserver-%%f-plugin.zip powershell.exe Invoke-WebRequest -OutFile resources/plugins/geoserver-%%f-plugin.zip -Uri https://build.geoserver.org/geoserver/%BUILD_GS_VERSION%.x/community-latest/geoserver-%BUILD_GS_VERSION%-SNAPSHOT-%%f-plugin.zip -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
27 | @ECHO geoserver-%%f-plugin downloaded.
28 | )
29 |
30 |
31 | rem Build options include:
32 | rem TOMCAT_EXTRAS [true | false]
33 | rem GDAL_NATIVE [true | false] - default false; build with GDAL support
34 | rem GS_VERSION - specifies which version of geoserver is to be built
35 |
36 | rem Valid for AMD64 (i.e., t3a.medium)
37 | rem docker build --build-arg GS_VERSION=${GS_VERSION} --build-arg TOMCAT_EXTRAS=false --build-arg GDAL_NATIVE=true -t thinkwhere/geoserver:${GS_VERSION} .
38 | rem Valid also for ARM64 (i.e., t4g.medium)
39 | docker buildx build --build-arg GS_VERSION=%GS_VERSION% --build-arg TOMCAT_EXTRAS=false --build-arg GDAL_NATIVE=false --platform linux/arm64/v8 -t thinkwhere/geoserver:%GS_VERSION% --push .
40 |
--------------------------------------------------------------------------------
/build/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Create plugins folder if does not exist
4 | if [ ! -d ./resources ]
5 | then
6 | mkdir ./resources
7 | fi
8 |
9 | if [ ! -d ./resources/plugins ]
10 | then
11 | mkdir ./resources/plugins
12 | fi
13 |
14 | GS_VERSION=2.26.0
15 | BUILD_GS_VERSION=${GS_VERSION:0:-2}
16 |
17 | # Add in selected plugins. Comment out or modify as required
18 | plugins=(control-flow inspire monitor css ysld web-resource sldservice gwc-s3)
19 |
20 | for p in "${plugins[@]}"
21 | do
22 | if [ ! -f resources/plugins/geoserver-${p}-plugin.zip ]
23 | then
24 | wget -c http://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-${p}-plugin.zip -O resources/plugins/geoserver-${p}-plugin.zip
25 | fi
26 | done
27 |
28 | # Community plugins are not available from sourgeforge
29 | # therefore source from https://build.geoserver.org/
30 | community_plugins=(cog-s3 jms-cluster) # activeMQ-broker )
31 | for c in "${community_plugins[@]}"
32 | do
33 | if [ ! -f resources/plugins/geoserver-${c}-plugin.zip ]
34 | then
35 | wget -c http://build.geoserver.org/geoserver/${BUILD_GS_VERSION}.x/community-latest/geoserver-${BUILD_GS_VERSION}-SNAPSHOT-${c}-plugin.zip -O resources/plugins/geoserver-${c}-plugin.zip
36 | fi
37 | done
38 |
39 | ## build options include:
40 | # TOMCAT_EXTRAS [true | false]
41 | # GDAL_NATIVE [true | false] - default false; build with GDAL support
42 | # GS_VERSION - specifies which version of geoserver is to be built
43 |
44 | # Valid for AMD64 (i.e., t3a.medium)
45 | docker build --build-arg GS_VERSION=${GS_VERSION} --build-arg TOMCAT_EXTRAS=false --build-arg GDAL_NATIVE=true -t thinkwhere/geoserver:${GS_VERSION} .
46 | # Valid also for ARM64 (i.e., t4g.medium)
47 | # docker buildx build --build-arg GS_VERSION=${GS_VERSION} --build-arg TOMCAT_EXTRAS=false --build-arg GDAL_NATIVE=false --platform linux/arm64/v8 -t thinkwhere/geoserver:${GS_VERSION} --push .
--------------------------------------------------------------------------------
/build/download.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # GS_VERSION param and abbreviated version
4 | GS_VERSION=$1
5 | echo "Build $GS_VERSION"
6 | BUILD_GS_VERSION=${GS_VERSION:0:-2}
7 | echo "Build Minor $BUILD_GS_VERSION"
8 |
9 | # Create plugins folder if does not exist
10 | if [ ! -d ./resources ]
11 | then
12 | mkdir ./resources
13 | fi
14 |
15 | if [ ! -d ./resources/plugins ]
16 | then
17 | mkdir ./resources/plugins
18 | fi
19 |
20 | # Add in selected plugins. Comment out or modify as required
21 | plugins=(control-flow inspire monitor css ysld web-resource sldservice gwc-s3)
22 |
23 | for p in "${plugins[@]}"
24 | do
25 | if [ ! -f resources/plugins/geoserver-${p}-plugin.zip ]
26 | then
27 | # https://sourceforge.net/projects/geoserver/files/GeoServer/2.23.0/extensions/geoserver-2.23.0-gdal-plugin.zip
28 | wget -c http://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-${p}-plugin.zip -O resources/plugins/geoserver-${p}-plugin.zip
29 | fi
30 | done
31 |
32 | # Community plugins are not available from sourgeforge
33 | # therefore source from https://build.geoserver.org/
34 | community_plugins=(cog-s3 jms-cluster) #activeMQ-broker )
35 | for c in "${community_plugins[@]}"
36 | do
37 | if [ ! -f resources/plugins/geoserver-${c}-plugin.zip ]
38 | then
39 | # https://build.geoserver.org/geoserver/2.23.x/community-latest/geoserver-2.23-SNAPSHOT-jms-cluster-plugin.zip
40 | wget -c http://build.geoserver.org/geoserver/${BUILD_GS_VERSION}.x/community-latest/geoserver-${BUILD_GS_VERSION}-SNAPSHOT-${c}-plugin.zip -O resources/plugins/geoserver-${c}-plugin.zip
41 | fi
42 | done
43 |
--------------------------------------------------------------------------------
/build/resources/fonts/LiberationSans-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/LiberationSans-Bold.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/LiberationSans-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/LiberationSans-BoldItalic.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/LiberationSans-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/LiberationSans-Italic.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/LiberationSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/LiberationSans-Regular.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/OCHA-Icons-Bounded.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/OCHA-Icons-Bounded.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/OCHA-Icons-Unbounded.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/OCHA-Icons-Unbounded.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/README.txt:
--------------------------------------------------------------------------------
1 | To include fonts in the container file system copy them into here.
2 | Currently only handles .ttf fonts
3 |
--------------------------------------------------------------------------------
/build/resources/fonts/Roboto-Black.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Roboto-Black.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/Roboto-BlackItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Roboto-BlackItalic.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/Roboto-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Roboto-Bold.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/Roboto-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Roboto-BoldItalic.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/Roboto-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Roboto-Italic.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/Roboto-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Roboto-Light.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/Roboto-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Roboto-LightItalic.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/Roboto-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Roboto-Medium.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/Roboto-MediumItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Roboto-MediumItalic.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/Roboto-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Roboto-Regular.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/Roboto-Thin.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Roboto-Thin.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/Roboto-ThinItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Roboto-ThinItalic.ttf
--------------------------------------------------------------------------------
/build/resources/fonts/Strategi_Symbols.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/fonts/Strategi_Symbols.ttf
--------------------------------------------------------------------------------
/build/resources/plugins/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/build/resources/plugins/.gitkeep
--------------------------------------------------------------------------------
/build/resources/tomcat/tomcat_server_stylesheet.xsl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/build/resources/tomcat/update_tomcat_settings.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Update Tomcat server settings
4 | # Inspired by https://github.com/kartoza/docker-geoserver
5 |
6 | # Backup Tomcat server config before making any changes
7 | cp ${CATALINA_HOME}/conf/server.xml ${CATALINA_HOME}/conf/server_backup.xml
8 |
9 | # Setup any variables which have been passed into the build
10 | if [ -n "$HTTP_PORT" ]; then
11 | HTTP_PORT_PARAM="--stringparam http.port $HTTP_PORT "
12 | fi
13 |
14 | if [ -n "$HTTP_PROXY_NAME" ]; then
15 | HTTP_PROXY_NAME_PARAM="--stringparam http.proxyName $HTTP_PROXY_NAME "
16 | fi
17 |
18 | if [ -n "$HTTP_PROXY_PORT" ]; then
19 | HTTP_PROXY_PORT_PARAM="--stringparam http.proxyPort $HTTP_PROXY_PORT "
20 | fi
21 |
22 | if [ -n "$HTTP_REDIRECT_PORT" ]; then
23 | HTTP_REDIRECT_PORT_PARAM="--stringparam http.redirectPort $HTTP_REDIRECT_PORT "
24 | fi
25 |
26 | if [ -n "$HTTP_CONNECTION_TIMEOUT" ]; then
27 | HTTP_CONNECTION_TIMEOUT_PARAM="--stringparam http.connectionTimeout $HTTP_CONNECTION_TIMEOUT "
28 | fi
29 |
30 | if [ -n "$HTTP_COMPRESSION" ]; then
31 | HTTP_COMPRESSION_PARAM="--stringparam http.compression $HTTP_COMPRESSION "
32 | fi
33 |
34 | if [ -n "$HTTP_MAX_HEADER_SIZE" ]; then
35 | HTTP_MAX_HEADER_SIZE_PARAM="--stringparam http.maxHttpHeaderSize $HTTP_MAX_HEADER_SIZE "
36 | fi
37 |
38 | if [ -n "$HTTPS_PORT" ]; then
39 | HTTPS_PORT_PARAM="--stringparam https.port $HTTPS_PORT "
40 | fi
41 |
42 | if [ -n "$HTTPS_MAX_THREADS" ]; then
43 | HTTPS_MAX_THREADS_PARAM="--stringparam https.maxThreads $HTTPS_MAX_THREADS "
44 | fi
45 |
46 | if [ -n "$HTTPS_CLIENT_AUTH" ]; then
47 | HTTPS_CLIENT_AUTH_PARAM="--stringparam https.clientAuth $HTTPS_CLIENT_AUTH "
48 | fi
49 |
50 | if [ -n "$HTTPS_PROXY_NAME" ]; then
51 | HTTPS_PROXY_NAME_PARAM="--stringparam https.proxyName $HTTPS_PROXY_NAME "
52 | fi
53 |
54 | if [ -n "$HTTPS_PROXY_PORT" ]; then
55 | HTTPS_PROXY_PORT_PARAM="--stringparam https.proxyPort $HTTPS_PROXY_PORT "
56 | fi
57 |
58 | if [ -n "$HTTPS_COMPRESSION" ]; then
59 | HTTPS_COMPRESSION_PARAM="--stringparam https.compression $HTTPS_COMPRESSION "
60 | fi
61 |
62 | if [ -n "$HTTPS_MAX_HEADER_SIZE" ]; then
63 | HTTPS_MAX_HEADER_SIZE_PARAM="--stringparam https.maxHttpHeaderSize $HTTPS_MAX_HEADER_SIZE "
64 | fi
65 |
66 | if [ -n "$JKS_FILE" ]; then
67 | JKS_FILE_PARAM="--stringparam https.keystoreFile ${CERT_DIR}/$JKS_FILE "
68 | fi
69 | if [ -n "$JKS_KEY_PASSWORD" ]; then
70 | JKS_KEY_PASSWORD_PARAM="--stringparam https.keystorePass $JKS_KEY_PASSWORD "
71 | fi
72 |
73 | if [ -n "$KEY_ALIAS" ]; then
74 | KEY_ALIAS_PARAM="--stringparam https.keyAlias $KEY_ALIAS "
75 | fi
76 |
77 | if [ -n "$JKS_STORE_PASSWORD" ]; then
78 | JKS_STORE_PASSWORD_PARAM="--stringparam https.keyPass $JKS_STORE_PASSWORD "
79 | fi
80 |
81 | # Parse XML using xsltproc to insert variables into server.xml
82 | transform="xsltproc \
83 | --output ${CATALINA_HOME}/conf/server.xml \
84 | $HTTP_PORT_PARAM \
85 | $HTTP_PROXY_NAME_PARAM \
86 | $HTTP_PROXY_PORT_PARAM \
87 | $HTTP_REDIRECT_PORT_PARAM \
88 | $HTTP_CONNECTION_TIMEOUT_PARAM \
89 | $HTTP_COMPRESSION_PARAM \
90 | $HTTP_MAX_HEADER_SIZE_PARAM \
91 | $HTTPS_PORT_PARAM \
92 | $HTTPS_MAX_THREADS_PARAM \
93 | $HTTPS_CLIENT_AUTH_PARAM \
94 | $HTTPS_PROXY_NAME_PARAM \
95 | $HTTPS_PROXY_PORT_PARAM \
96 | $HTTPS_COMPRESSION_PARAM \
97 | $HTTPS_MAX_HEADER_SIZE_PARAM \
98 | $JKS_FILE_PARAM \
99 | $JKS_KEY_PASSWORD_PARAM \
100 | $KEY_ALIAS_PARAM \
101 | $JKS_STORE_PASSWORD_PARAM \
102 | ${CATALINA_HOME}/conf/tomcat_server_stylesheet.xsl \
103 | ${CATALINA_HOME}/conf/server.xml"
104 |
105 | eval "$transform"
106 |
107 | # Run server
108 | . $CATALINA_HOME/bin/catalina.sh run
109 |
--------------------------------------------------------------------------------
/build/run.bat:
--------------------------------------------------------------------------------
1 | SET GS_PORT=8080
2 |
3 | docker run --name=geoserver_%GS_PORT% -p %GS_PORT%:8080 -d -v %HOME%/geoserver_data:/opt/geoserver/data_dir -e "HTTP_MAX_HEADER_SIZE=524288" -t thinkwhere/geoserver:2.18.3 /bin/sh -c conf/update_tomcat_settings.sh
4 |
--------------------------------------------------------------------------------
/build/run.sh:
--------------------------------------------------------------------------------
1 | GS_PORT=8080
2 |
3 | docker run --name=geoserver_${GS_PORT} -p ${GS_PORT}:8080 -d -v $HOME/geoserver_data:/opt/geoserver/data_dir -e "HTTP_MAX_HEADER_SIZE=524288" -t thinkwhere/geoserver:2.18.3 /bin/sh -c conf/update_tomcat_settings.sh
4 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2'
2 | services:
3 | nginx:
4 | container_name: nginx_loadbalance
5 | restart: always
6 | image: nginx
7 | logging:
8 | driver: "json-file"
9 | options:
10 | max-size: "10m"
11 | max-file: "10"
12 | ports:
13 | - "80:8080"
14 | volumes:
15 | - ~/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
16 | links:
17 | - geoserver_8085
18 | - geoserver_8086
19 | geoserver_8085:
20 | container_name: geoserver_8085
21 | restart: always
22 | image: thinkwhere/geoserver:2.12
23 | logging:
24 | driver: "json-file"
25 | options:
26 | max-size: "10m"
27 | max-file: "10"
28 | hostname: geoserver_8085
29 | ports:
30 | - "8085:8080"
31 | environment:
32 | - GEOSERVER_LOG_LOCATION=/opt/geoserver/data_dir/logs/geoserver_8085.log
33 | volumes:
34 | - ~/geoserver_data:/opt/geoserver/data_dir
35 | - ~/tomcat_settings/setenv.sh:/usr/local/tomcat/bin/setenv.sh
36 | - ~/tomcat_settings/logs_8085:/usr/local/tomcat/logs
37 | - ~/Rasters:/root/Rasters
38 | geoserver_8086:
39 | container_name: geoserver_8086
40 | restart: always
41 | image: thinkwhere/geoserver:2.12
42 | logging:
43 | driver: "json-file"
44 | options:
45 | max-size: "10m"
46 | max-file: "10"
47 | hostname: geoserver_8086
48 | ports:
49 | - "8086:8080"
50 | environment:
51 | - GEOSERVER_LOG_LOCATION=/opt/geoserver/data_dir/logs/geoserver_8086.log
52 | volumes:
53 | - ~/geoserver_data:/opt/geoserver/data_dir
54 | - ~/tomcat_settings/setenv.sh:/usr/local/tomcat/bin/setenv.sh
55 | - ~/tomcat_settings/logs_8086:/usr/local/tomcat/logs
56 | - ~/Rasters:/root/Rasters
57 |
--------------------------------------------------------------------------------
/env.list:
--------------------------------------------------------------------------------
1 | AWS_ACCESS_KEY=""
2 | AWS_SECRET_KEY=""
--------------------------------------------------------------------------------
/nginx/nginx.conf:
--------------------------------------------------------------------------------
1 |
2 | events {
3 | worker_connections 2048; ## Default: 1024
4 | }
5 |
6 | http {
7 | # List of geoserver instances
8 | upstream geoserver_backend {
9 | least_conn;
10 | server geoserver_8085:8080;
11 | server geoserver_8086:8080;
12 | }
13 |
14 | # Configuration for the server
15 | server {
16 |
17 | # Running port
18 | listen 8080;
19 |
20 | # Proxy settings
21 | location / {
22 | proxy_pass http://geoserver_backend;
23 | proxy_redirect off;
24 | proxy_set_header Host $http_host;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | docker kill geoserver_8085
3 | docker rm geoserver_8085
4 |
5 | DATA_DIR=~/geoserver_data
6 | if [ ! -d $DATA_DIR ]
7 | then
8 | mkdir -p $DATA_DIR
9 | fi
10 |
11 |
12 | docker run \
13 | --name=geoserver_8085 \
14 | -p 8085:8080 \
15 | -d \
16 | -v $DATA_DIR:/opt/geoserver/data_dir \
17 | -e "GEOSERVER_LOG_LOCATION=/opt/geoserver/data_dir/logs/geoserver_8085.log" \
18 | -t thinkwhere/geoserver:latest
19 |
20 |
21 | # alt docker run command if s3-geotiff plugin is used
22 | # to ensure environment variables are set
23 | # docker run \
24 | # --name=geoserver-s3-geotiff \
25 | # --env-file=$HOME\env.list
26 | # -p 8080:8080 \
27 | # -d \
28 | # -v $HOME/geoserver_data:/opt/geoserver/data_dir \
29 | # -v $HOME/tomcat_settings/setenv.sh:/usr/local/tomcat/bin/setenv.sh \
30 | # -t thinkwhere/geoserver-s3-geotiff
--------------------------------------------------------------------------------
/sshd.conf:
--------------------------------------------------------------------------------
1 | [program:sshd]
2 | user=root
3 | command=/usr/sbin/sshd -D
4 | autorestart=true
5 | stopsignal=INT
6 |
--------------------------------------------------------------------------------
/tomcat_settings/logs_8085/placeholder.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/tomcat_settings/logs_8085/placeholder.txt
--------------------------------------------------------------------------------
/tomcat_settings/logs_8086/placeholder.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thinkWhere/GeoServer-Docker/0125ca65471a2f36c05812d279d14dbed7b9922a/tomcat_settings/logs_8086/placeholder.txt
--------------------------------------------------------------------------------
/tomcat_settings/setenv.sh:
--------------------------------------------------------------------------------
1 | JAVA_OPTS="$JAVA_OPTS -Xmx1536M"
2 |
--------------------------------------------------------------------------------