|
| 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 | +``` |
0 commit comments