Implementation of GeoServer/Geofence ready for deployment in a containerized environment.
The default installation assumes you either have or is going to use a PostGIS database for GeoFence data storage. If you want to use the default H2 database, comment out the postgis service in the docker-compose.yml file before you start the container ecosystem.
The installation follows the following steps:
- Pull the repository.
- Start the postgis service.
- Create a PostGIS enabled database with the associated user.
- Change your geofence service environment to match you database setup.
- Launch the remaining geoserver & geofence services.
Choose a suitable directory and clone the repository:
$ git clone https://github.com/Terranex/docker-geoserver-geofence.git
$ docker-compose up -d postgis
$ docker exec -it geofencegeoserver_postgis_1 bash
$ su postgres
$ createuser --createdb --login --no-superuser --no-createrole --pwprompt geofence
$ exit
$ psql -U postgres -c "CREATE DATABASE geofence OWNER geofence ENCODING 'UTF8';"
$ psql -U postgres -d geofence -c "CREATE EXTENSION postgis;"
Your database is now set up and ready.
Try logging in as geofence
:
psql -U geofence
Now run SELECT PostGIS_Version();
to validate postgis extentions where successfully installed.
For additional help customizing this service visit PostgreSQL and PostGIS in a Docker container
- Open the GeoFence configuration override file ./geofence/geofence-datasource-ovr.properties
- Adjust the required database settings to match your postgis service
- For help go to Geofence configuration help
$ docker-compose up -d
- Log in to Geoserver web admin interface (default credentials admin:geoserver)
- Go to Security-GeoFence to edit "GeoFence services URL":
http://geofence:8080/geofence/remoting/RuleReader
- Click "Test Connection" button and it should display success
- Restart Geoserver
docker-compose restart geoserver
Environment variables per service are stored in a ENV file in each of the service directories, i.e.
- ./geofence
- ./geoserver
- ./postgis
This should run out of the box, but can be ammended should the need arise.
This will automatically download the required software, i.e. GeoServer, GeoFence along with the dependencies based on the download URLs provided in the docker-compose.yml ags
subsection per service.