Skip to content

Commit 642f05c

Browse files
committed
Centralize Docker configurations for GeoNOde services
1 parent bf487b2 commit 642f05c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1844
-862
lines changed

Dockerfile

Lines changed: 0 additions & 69 deletions
This file was deleted.

GPL.txt

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

LICENSE

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
MIT License
1+
GeoNode is distributed under the GNU General Public License Version 2.0 license:
22

3-
Copyright (c) 2016 Terranodo LLC
3+
GeoNode, open geospatial information server
4+
Copyright (C) 2014-2023 Open Source Geospatial Foundation.
5+
Copyright (C) 2001-2014 OpenPlans
6+
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation; either version 2 of the License, or
10+
(at your option) any later version (collectively, "GPL").
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program; if not, write to the Free Software
19+
Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
420

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
21+
For latest contact information of Open Source Geospatial Foundation see the website at
22+
http://www.osgeo.org. Current email is [email protected] and address is OSGeo, 14525 SW Millikan #42523, Beaverton, Oregon, United States, 97005-2343.
1123

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
24+
The full GPL license is available in this directory in the file GPL.txt

README

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Docker images for GeoNode services
2+
**This is a WIP. Further details will be provided in this README once the repo has been stabilized.**
3+
4+
This repository collects the configurations for the Docker images used by GeoNode and GeoNode project Docker compose files.
5+
It replaces the configurations defined in the following locations:
6+
- https://github.com/GeoNode/geonode-project/tree/master/docker
7+
- https://github.com/GeoNode/geonode/tree/master/scripts/docker (will be removed except the [GeoNode base image](https://github.com/GeoNode/geonode/tree/master/scripts/docker/base/ubuntu))
8+
- https://github.com/GeoNode/geoserver-docker (will be archived and deprecated)
9+
- https://github.com/GeoNode/data-docker (will be archived and deprecated)
10+
- https://github.com/GeoNode/nginx-docker (will be archived and deprecated)
11+
- https://github.com/GeoNode/postgis-docker (will be archived and deprecated)
12+
13+
The [configurations](https://github.com/GeoNode/geonode-project/tree/master/docker) in the GeoNode Project repository will by default inherit from these base images without further configurations. These configurations can be customized inside projects for any specific need.
14+

celery.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

docker-build.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

docker-purge.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

docker/geoserver/Dockerfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
ARG IMAGE_VERSION=9.0-jdk11-openjdk-slim-bullseye
2+
ARG JAVA_HOME=/usr/local/openjdk-11
3+
FROM tomcat:$IMAGE_VERSION
4+
LABEL GeoNode Development Team
5+
6+
ARG GEOSERVER_CORS_ENABLED=False
7+
ARG GEOSERVER_CORS_ALLOWED_ORIGINS=*
8+
ARG GEOSERVER_CORS_ALLOWED_METHODS=GET,POST,PUT,DELETE,HEAD,OPTIONS
9+
ARG GEOSERVER_CORS_ALLOWED_HEADERS=*
10+
#
11+
# Set GeoServer version and data directory
12+
#
13+
ENV GEOSERVER_VERSION=2.23.0
14+
ENV GEOSERVER_DATA_DIR="/geoserver_data/data"
15+
ENV GEOSERVER_CORS_ENABLED=$GEOSERVER_CORS_ENABLED
16+
ENV GEOSERVER_CORS_ALLOWED_ORIGINS=$GEOSERVER_CORS_ALLOWED_ORIGINS
17+
ENV GEOSERVER_CORS_ALLOWED_METHODS=$GEOSERVER_CORS_ALLOWED_METHODS
18+
ENV GEOSERVER_CORS_ALLOWED_HEADERS=$GEOSERVER_CORS_ALLOWED_HEADERS
19+
#
20+
# Download and install GeoServer
21+
#
22+
RUN apt-get update -y && apt-get install curl wget unzip -y
23+
RUN cd /usr/local/tomcat/webapps \
24+
&& wget --no-check-certificate --progress=bar:force:noscroll https://artifacts.geonode.org/geoserver/${GEOSERVER_VERSION}/geoserver.war -O geoserver.war \
25+
&& unzip -q geoserver.war -d geoserver \
26+
&& rm geoserver.war \
27+
&& mkdir -p $GEOSERVER_DATA_DIR
28+
29+
VOLUME $GEOSERVER_DATA_DIR
30+
31+
# added by simonelanucara https://github.com/simonelanucara
32+
# Optionally add JAI, ImageIO and Marlin Render for improved Geoserver performance
33+
WORKDIR /tmp
34+
35+
RUN wget --no-check-certificate https://repo1.maven.org/maven2/org/postgis/postgis-jdbc/1.3.3/postgis-jdbc-1.3.3.jar -O postgis-jdbc-1.3.3.jar && \
36+
wget --no-check-certificate https://maven.geo-solutions.it/org/hibernatespatial/hibernate-spatial-postgis/1.1.3.2/hibernate-spatial-postgis-1.1.3.2.jar -O hibernate-spatial-postgis-1.1.3.2.jar && \
37+
rm /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/hibernate-spatial-h2-geodb-1.1.3.2.jar && \
38+
mv hibernate-spatial-postgis-1.1.3.2.jar /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/ && \
39+
mv postgis-jdbc-1.3.3.jar /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/
40+
41+
42+
# copy the script and perform the run of scripts from entrypoint.sh
43+
RUN mkdir -p /usr/local/tomcat/tmp
44+
WORKDIR /usr/local/tomcat/tmp
45+
COPY set_geoserver_auth.sh /usr/local/tomcat/tmp
46+
COPY entrypoint.sh /usr/local/tomcat/tmp
47+
COPY tasks.py /usr/local/tomcat/tmp
48+
COPY ./templates /templates
49+
COPY multidump.sh /usr/local/tomcat/tmp
50+
COPY multidump-alt.sh /usr/local/tomcat/tmp
51+
52+
RUN chmod +x /usr/local/tomcat/tmp/set_geoserver_auth.sh \
53+
&& chmod +x /usr/local/tomcat/tmp/entrypoint.sh
54+
55+
RUN apt-get update \
56+
&& apt-get install -y procps less \
57+
&& apt-get install -y python3 python3-pip python3-dev
58+
59+
RUN pip install j2cli invoke==2.2.0 requests==2.31.0
60+
61+
ENV JAVA_OPTS="-Djava.awt.headless=true -Dgwc.context.suffix=gwc -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=/var/log/jvm.log -XX:MaxPermSize=512m -XX:PermSize=256m -Xms512m -Xmx2048m -XX:+UseConcMarkSweepGC -XX:ParallelGCThreads=4 -Dfile.encoding=UTF8 -Djavax.servlet.request.encoding=UTF-8 -Djavax.servlet.response.encoding=UTF-8 -Duser.timezone=GMT -Dorg.geotools.shapefile.datetime=false -DGS-SHAPEFILE-CHARSET=UTF-8 -DGEOSERVER_CSRF_DISABLED=true -DPRINT_BASE_URL=http://geoserver:8080/geoserver/pdf -Xbootclasspath/a:/usr/local/tomcat/webapps/geoserver/WEB-INF/lib/marlin-0.9.3.jar -Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine"
62+
63+
CMD ["/usr/local/tomcat/tmp/entrypoint.sh"]

docker/geoserver/README.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# geoserver-docker
2+
3+
[GeoServer](http://geoserver.org) is an open source server for sharing geospatial data.
4+
This is a docker image that eases setting up a GeoServer running specifically for [GeoNode](https://github.com/GeoNode/geoserver-geonode-ext) with an additional separated data directory.
5+
6+
The image is based on the official Tomcat 9 image
7+
8+
## Installation
9+
10+
This image is available as a [trusted build on the docker hub](https://registry.hub.docker.com/r/geonode/geoserver/), and is the recommended method of installation.
11+
Simple pull the image from the docker hub.
12+
13+
```bash
14+
$ docker pull geonode/geoserver
15+
```
16+
17+
Alternatively you can build the image locally
18+
19+
```bash
20+
$ git clone https://github.com/geonode/geoserver-docker.git
21+
$ cd geoserver-docker
22+
$ docker build -t "geonode/geoserver" .
23+
```
24+
25+
## Quick start
26+
27+
You can quick start the image using the command line
28+
29+
```bash
30+
$ docker run --name "geoserver" -v /var/run/docker.sock:/var/run/docker.sock -d -p 8080:8080 geonode/geoserver
31+
```
32+
33+
Point your browser to `http://localhost:8080/geoserver` and login using GeoServer's default username and password:
34+
35+
* Username: admin
36+
* Password: geoserver
37+
38+
## How to use different versions
39+
40+
There are mainly two different versions of this image which are useful for running **GeoNode** with different authentication system types. These versions are released as specific tags for two authentication mechanisms:
41+
42+
**Cookie based authn**:
43+
- [geonode/geoserver:2.9.x](https://hub.docker.com/r/geonode/geoserver/builds/bx7ydhghnlrfnsppduyva73/)
44+
45+
**Oauth2 based authn**:
46+
- [geonode/geoserver:2.9.x-oauth2](https://hub.docker.com/r/geonode/geoserver/builds/bwca5rtexeoegzgroavftdr/)
47+
- [geonode/geoserver:2.10.x](https://hub.docker.com/r/geonode/geoserver/builds/bjohcnc29vm69acqjrvndxf/)
48+
- [geonode/geoserver:2.12.x](https://hub.docker.com/r/geonode/geoserver/builds/bh7pyw5atmkcljurwsnzbs7/)
49+
- [geonode/geoserver:2.13.x](https://hub.docker.com/r/geonode/geoserver/builds/btmjctbuvrjfnnrxrs4wyrs/)
50+
- [geonode/geoserver:2.14.x](https://hub.docker.com/r/geonode/geoserver/builds/bj53pi8he8uksz6ggvrs3wc/)
51+
52+
You can declare what version to use along with the data directory tag which corresponds to the same version.
53+
54+
## Configuration
55+
56+
### Data volume
57+
58+
This GeoServer container keeps its configuration data at `/geoserver_data/data` which is exposed as volume in the dockerfile.
59+
The volume allows for stopping and starting new containers from the same image without losing all the data and custom configuration.
60+
61+
You may want to map this volume to a directory on the host. It will also ease the upgrade process in the future. Volumes can be mounted by passing the `-v` flag to the docker run command:
62+
63+
```bash
64+
-v /your/host/data/path:/geoserver_data/data
65+
```
66+
67+
### Data volume container
68+
69+
In case you are running Compose for automatically having GeoServer up and running then a data volume container will be mounted with a default preloaded *GEOSERVER_DATA_DIR* at the configuration data directory of the container.
70+
Make sure that the image from the repository [data-docker](https://github.com/GeoNode/data-docker) is available from the [GeoNode Docker Hub](https://hub.docker.com/u/geonode/) or has been built locally:
71+
72+
```bash
73+
docker build -t geonode/geoserver_data .
74+
```
75+
76+
#### Persistance behavior
77+
78+
If you run:
79+
80+
```bash
81+
docker-compose stop
82+
```
83+
84+
Data are retained in the *GEOSERVER_DATA_DIR* and can then be mounted in a new GeoServer instance by running again:
85+
86+
```bash
87+
docker-compose up
88+
```
89+
90+
If you run:
91+
92+
```bash
93+
docker-compose down
94+
```
95+
96+
Data are completely gone but you can ever start from the base GeoServer Data Directory built for Geonode.
97+
98+
#### Data directory versions
99+
100+
There has to be a correspondence one-to-one between the data directory version and the tag of the GeoServer image used in the Docker compose file. So at the end you can consume these images below:
101+
102+
* **2.9.x**: [geonode/geoserver_data:2.9.x](https://hub.docker.com/r/geonode/geoserver_data/builds/bsus6alnddg4bc7icwymevp/)
103+
* **2.9.x-oauth2**: [geonode/geoserver_data:2.9.x-oauth2](https://hub.docker.com/r/geonode/geoserver_data/builds/bwkxcupsunvuitzusi9gsnt/)
104+
* **2.10.x**: [geonode/geoserver_data:2.10.x](https://hub.docker.com/r/geonode/geoserver_data/builds/b5jqhpzapkqxzyevjizccug/)
105+
* **2.12.x**: [geonode/geoserver_data:2.12.x](https://hub.docker.com/r/geonode/geoserver_data/builds/byaaalw3lnasunpveyg3x4i/)
106+
* **2.13.x**: [geonode/geoserver_data:2.13.x](https://hub.docker.com/r/geonode/geoserver_data/builds/bunuqzq7a7dk65iumjhkbtc/)
107+
* **2.14.x**: [geonode/geoserver_data:2.14.x](https://hub.docker.com/r/geonode/geoserver_data/builds/blpdjzkrv7pm3stunzpn4pp/)
108+
109+
### Database
110+
111+
GeoServer recommends the usage of a spatial database
112+
113+
#### PostGIS container (PostgreSQL + GIS Extension)
114+
115+
If you want to use a [PostGIS](http://postgis.org/) container, you can link it to this image. You're free to use any PostGIS container.
116+
An example with [kartooza/postgis](https://registry.hub.docker.com/u/kartoza/postgis/) image:
117+
118+
```bash
119+
$ docker run -d --name="postgis" kartoza/postgis
120+
```
121+
122+
For further information see [kartooza/postgis](https://registry.hub.docker.com/u/kartoza/postgis/).
123+
124+
Now start the GeoServer instance by adding the `--link` option to the docker run command:
125+
126+
```bash
127+
--link postgis:postgis
128+
```

docker/geoserver/docker-compose.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
version: '3.9'
2+
3+
services:
4+
5+
postgis:
6+
image: geonode/postgis:13
7+
ports:
8+
- "25432:5432"
9+
volumes:
10+
- /srv/docker/geoserver/postgis:/var/lib/postgresql
11+
#volumes_from:
12+
#- pgstore
13+
healthcheck:
14+
test: "pg_isready -d postgres -U postgres"
15+
restart: on-failure
16+
17+
geoserver:
18+
image: geonode/geoserver:2.23.0
19+
build:
20+
context: .
21+
links:
22+
- postgis
23+
ports:
24+
- "8080:8080"
25+
volumes:
26+
- /geoserver_data/data
27+
environment:
28+
- NGINX_BASE_URL=http://localhost
29+
depends_on:
30+
postgis:
31+
condition: service_completed_successfully
32+
data-dir-conf:
33+
condition: service_healthy
34+
healthcheck:
35+
test: curl --fail -s http://localhost:8080/geoserver/rest/workspaces/geonode.html || exit 1
36+
interval: 1m30s
37+
timeout: 10s
38+
retries: 3
39+
restart: on-failure
40+
41+
data-dir-conf:
42+
image: geonode/geoserver_data:2.23.0
43+
container_name: geoserver_data_dir # named data container
44+
entrypoint: sleep infinity
45+
volumes:
46+
- /geoserver_data/data
47+
healthcheck:
48+
test: "ls -A '/geoserver_data/data' | wc -l"
49+
restart: on-failure
50+
51+
volumes:
52+
# reference to the named data container that holds the preloaded geoserver data directory
53+
geoserver_data_dir:

0 commit comments

Comments
 (0)