MapStore Integration in geOrchestra¶
This section describes how to include MapStore in your geOrchestra installation.
All the steps assumes you are working from the project main directory.
Edit docker-compose.yml¶
Add the following snippet to the docker-compose.yml file:
mapstore: image: geosolutionsit/mapstore2-georchestra:latest depends_on: - database volumes: - ./config:/etc/georchestra environment: - JAVA_OPTS=-Xms512m -Xmx512m -Dgeorchestra.datadir=/etc/georchestra
Configure the ’proxy’ container to forward requests to MapStore¶
Add the following to the config/security-proxy/targets-mapping.properties file:
analytics=http://analytics:8080/analytics/ atlas=http://atlas:8080/atlas/ console=http://console:8080/console/ extractorapp=http://extractorapp:8080/extractorapp/ geonetwork=http://geonetwork:8080/geonetwork/ geoserver=http://geoserver:8080/geoserver/ header=http://header:8080/header/ mapfishapp=http://mapfishapp:8080/mapfishapp/ mapstore=http://mapstore:8080/mapstore/
Create config directory for MapStore¶
mkdir config/mapstore/
Add geostore override file to user PostgreSQL¶
Create the config/mapstore/geostore-datasource-ovr.properties with the following content:
#Default Postgres Connection values, uncomment for using postgres geostoreDataSource.driverClassName=org.postgresql.Driver geostoreDataSource.url=jdbc:postgresql://database:5432/geostore geostoreDataSource.username=geostore geostoreDataSource.password=geostore geostoreVendorAdapter.databasePlatform=org.hibernate.dialect.PostgreSQLDialect geostoreEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=validate geostoreEntityManagerFactory.jpaPropertyMap[hibernate.default_schema]=geostore geostoreVendorAdapter.generateDdl=true geostoreVendorAdapter.showSql=false
NOTE: update the values to match your environment
Setup Database¶
- Jump into the PostgreSQL container and create GeoStore Role and DB
docker exec -it docker_database_1 bash su postgres psql -U georchestra CREATE ROLE geostore WITH LOGIN PASSWORD 'geostore'; CREATE DATABASE geostore WITH OWNER 'geostore';
- Create schemas and tables as per GeoStore documentation
Recreate MapStore Container to pick up the change¶
docker-compose up -d --force-recreate mapstore
Update “header” application index to link to Mapstore¶
- Extract the “header” application war from the docker image
docker cp docker_header_1:/var/lib/jetty/webapps/header.war ./header.war
- In the war file, update the WEB-INF/classes/_header/i18n/index_en.properties file adding the following:
mapstore=mapstore
- Repeat for all the other translation files
- In the war file, update the WEB-INF/jsp/index.jsp file adding the following:
<c:choose> <c:when test='<%= active.equals("mapstore") %>'> <li class="active"><a><fmt:message key="mapstore"/></a></li> </c:when> <c:otherwise> <li><a href="/mapstore/"><fmt:message key="mapstore"/></a></li> </c:otherwise> </c:choose>
- In the war file, update the WEB-INF/jsp/index.jsp file with the following:
... Boolean extractorappadmin = false; Boolean msadmin = false; String sec_roles = request.getHeader("sec-roles"); if(sec_roles != null) { String[] roles = sec_roles.split(";"); for (int i = 0; i < roles.length; i++) { if (roles[i].equals("ROLE_GN_EDITOR") || roles[i].equals("ROLE_GN_REVIEWER") || roles[i].equals("ROLE_GN_ADMIN") || roles[i].equals("ROLE_ADMINISTRATOR") || roles[i].equals("ROLE_USER")) { anonymous = false; } if (roles[i].equals("ROLE_SUPERUSER")) { admin = true; console = true; } if (roles[i].equals("ROLE_ORGADMIN")) { admin = true; console = true; } if (roles[i].equals("ROLE_GN_ADMIN")) { admin = true; catadmin = true; } if (roles[i].equals("ROLE_ADMINISTRATOR")) { admin = true; extractorappadmin = true; } if (roles[i].equals("ROLE_MAPSTORE_ADMIN")) { admin = true; msadmin = true; } } } ...
- In the war file, update the WEB-INF/jsp/index.jsp file adding the following:
<c:choose> <c:when test='<%= msadmin == true %>'> <c:choose> <c:when test='<%= active.equals("msadmin") %>'> <li class="active"><a><fmt:message key="mapstore"/></a></li> </c:when> <c:otherwise> <li><a href="/mapstore/#/admin"><fmt:message key="mapstore"/></a></li> </c:otherwise> </c:choose> </c:when> </c:choose>
- Finally put the edited war back to the container:
docker cp header.war docker_header_1:/var/lib/jetty/webapps/header.war