Docker

MapStore has a set docker image for each release available on Docker hub

You can simply run this instance by pulling and running the container.

docker pull geosolutionsit/mapstore2
docker run  --name mapstore geosolutionsit/mapstore2 # named MapStore.

The docker image are configured to use H2 local database.

In order to have a production instance of MapStore using docker, you need at least to externalize the database and connect to an instance of PostgreSQL.

Externalize the database configuration

First of all, you have to download the image

docker pull geosolutionsit/mapstore2

Then you have to create on your host machine a file with the database connection settings. Let’s create this file in /docker/geostore-datasource-ovr-postgres.properties.

# Setup driver and dialect for PostgreSQL database
geostoreDataSource.driverClassName=org.postgresql.Driver
geostoreVendorAdapter.databasePlatform=org.hibernate.dialect.PostgreSQLDialect

# Connection parameters
geostoreDataSource.url=jdbc:postgresql://192.168.1.100:5432/geostore
geostoreDataSource.username=geostore
geostoreDataSource.password=geostore
geostoreEntityManagerFactory.jpaPropertyMap[hibernate.default_schema]=geostore

# Automatic create-update database mode
geostoreEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=validate

# Other options
geostoreVendorAdapter.generateDdl=true
geostoreVendorAdapter.showSql=false

Note

Is up to you to create a proper postgreSQL instance (docker or not) and make it reachable from the docker instance at the address written in DB. Follow the guide in database section for this.

As a final step you have to the docker instance of MapStore with the options for:

  • adding the proper JAVA_OPTS to the JVM to externalize the database configuration

  • mapping the configuration file with the file on the host machine you created before.

docker run \
  -v `pwd`/docker/geostore-datasource-ovr-postgres.properties:/usr/local/tomcat/conf/geostore-datasource-ovr.properties \
  -e JAVA_OPTS="-Xms512m -Xmx512m -XX:MaxPermSize=128m -Dgeostore-ovr=file:///usr/local/tomcat/conf/geostore-datasource-ovr.properties" \
  --name mapstore \
  -p8080:8080 \
geosolutionsit/mapstore2

Doing so, the mapstore instance will run on port 8080.

Note

Future versions of MapStore will provide a docker-compose file to have postgreSQL docker image properly configured.