Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

MapStore Build and Deployment

tdipisa edited this page Oct 3, 2012 · 31 revisions

These instructions describe how to build and deploy MapStore assuming you have a copy of the application source code from GitHub.

Getting a copy of the application

To get a copy of the application source code, use this command from the GIT shell:

you@prompt:~$ git clone https://github.com/geosolutions-it/mapstore.git

To initialize, build and to run the application you need Ant and Maven. In addition, to pull in external dependencies, you'll neeed Git installed. Before running in development mode or preparing the application for deployment, you need to pull in external dependencies.

Getting dependencies

The MapStore contains a submodule to manage CSW (Catalog Service for the Web). After cloning the application you have to initialize and pull this component. Do this by running the following command in the mapstore directory:

you@prompt:~$ cd mapstore/
you@prompt:~/mapstore$ git submodule init
you@prompt:~/mapstore$ git submodule update (at this step enter the required user name and password if needed)
you@prompt:~/mapstore$ ant init (to assemble the ringoJS server side JavaScript)

Running MapStore in development mode

The MapComposer application can be run in development mode. In development mode, individual scripts are available to a debugger. To run the application in development mode, run ant debug:

you@prompt:~$ cd mapstore
you@prompt:~/mapstore$ ant debug

If the build succeeds, you'll be able to browse to the application at http://localhost:8081/. By default, the application runs on port 8081. To change this, you can set the app.port property as follows (setting the port to 9080):

you@prompt:~/mapstore$ ant -Dapp.port=9080 debug

Preparing MapStore for deployment

Preparing MapStore dependencies

MapStore needs GeoStore in order to save and organize maps. Before deploy MapStore in your servlet container, read the GeoStore build and configuration instructions here. GeoStore provide two default users:

  • admin with pw admin
  • user with pw user

If you want add new users please refer to this page of the GeoStore documentation. After the GeoStore deploy you have to run the following command from command line in order to create the 'MAP' Category for mapstore maps.

curl -u admin:admin -XPOST -H "Content-type: text/xml" -d "<Category><name>MAP</name></Category>"
http://yourhost:yourport/geostore/rest/categories

To run this command you need cURL.

You can directly download the GeoStore 1.0 release here

MapStore needs also Http-Proxy to manage cross origin calls. Before deploy you MapStore instance, read the Http-Proxy build and configuration instructions here.

You can directly download the http_proxy 1.0 release here

The MapComposer component provide two GUI tools that allows the user to import/export map context. To enable these tools you have to build and deploy the xmlJsonTranslate service in your servlet container. To do this enter the followig command in mapstore directory:

you@prompt:~$ cd mapstore
you@prompt:~/mapstore$ cd mapcomposer/backend/xmlJsonTranslate
you@prompt:~$ mvn install (Maven build)

After the Maven build phase move the xmlJsonTranslate.war file to your servlet container. About the xmlJsonTranslate configuration make sure you have set a correct temp path inside the app.properties file (if the application is already running you have to reload it). Following an example:

### Temp directory
temp=yourtomcatdir/webapps/xmlJsonTranslate/temp

To enable the xmlJsonTranslate inside the MapComposer configuration you have to add the following property to the composer configuration placed in the mapstore/mapcomposer/app/templates/composer.html:

...

app = new GeoExplorer.Composer({
      modified: false,
      proxy: proxy,
      xmlJsonTranslateService: "http://yourhost:yourport/xmlJsonTranslate/",
      defaultSourceType: "gxp_wmssource",
      renderToTab : 'appTabs',

...

MapStore build and deployment

The MapStore application can be run in distribution mode. In distribution mode, scripts are concatenated and minified. Before moving your application to a production environment, run ant with the "dist" target. The "dist" target will result in a directory that can be dropped in a servlet container like Apache Tomcat.

you@prompt:~$ cd mapstore
you@prompt:~/mapstore$ ant dist

After the build you will have two new directories created:

  • mapcomposer/build/mapcomposer
  • mapmanager/build/mapstore

To deploy your MapStore move the built 'mapstore' and 'mapcomposer' directories to your servlet container.

Configuring MapStore

MapManager configurations : go to the deployed 'mapmanager/src' directory and edit the 'config.js' file to set the own URLs (basically you have only modify the 'localhost:8080' if needed).

MapComposer configurations : go to the deployed 'mapcomposer/WEB-INF/app/static/config' directory and edit the 'mapStoreConfig.js' file to set:

  • The GeoStore URL
  • The Http-Proxy URL
  • A list of additionals URLs of WMS sources to load at startup
  • Several other configuration about layers and map configurations.
  • External plugin configuration.

For more information see the configuration page..

Clone this wiki locally