-
Notifications
You must be signed in to change notification settings - Fork 43
MapStore Build and Deployment
These instructions describe how to build and deploy MapStore assuming you have a copy of the application source code from GitHub.
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.
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)
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
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 pwadmin
-
user
with pwuser
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',
...
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.
MapManager configurations : go to the deployed 'mapstore/src' directory and edit the 'config.js' file to set the own URLs (basically you have only modify the 'localhost:8080' if needed).
Since MapStore uses some Google service, you need a Google api key in your config.js file. Here some instruction to get started.
MapStore uses Google Shortener service to make shorter (and prettier) urls to share on social networks. Since Google Shortener is an external rest service, the current implementation uses the http_proxy developed by GeoSolutions. Hence, you need to add Google url to proxy config file proxy.properties.
- Add www.googleapis.com to hostnameWhitelist,
- Add (.google.) (or another regexp) to reqtypeWhitelist.fdh,
- Redeploy http_proxy, if necessary,
- Check if the proxy works correctly,
curl -XPOST -H 'Content-type: application/json' -d '{longUrl:"http://repubblica.it"}' http://localhost:8080/http_proxy/proxy/?url=https%3A//www.googleapis.com/urlshortener/v1/url%3Fkey%3DYOUR_API_KEY
MapComposer configurations : go to the deployed 'mapcomposer/WEB-INF/app/static' directory and edit the 'urlConfig.js' file to set:
- The GeoStore URL
- The Http-Proxy URL
- A list of additionals URLs of WMS sources to load at startup:
This is an example of the 'urlConfig.js' configuration:
{
"geoStoreBase":"http://localhost:8080/geostore/rest/",
"proxy":"/http_proxy/proxy/?url=",
"gsSources":[
{
"url":"http://demo1.geo-solutions.it/geoserver/ows",
"title":"FDH GeoServer",
"layerBaseParams":{
"TILED":true,
"TILESORIGIN":"-20037508.34,-20037508.34"
}
},
{
"url":"http://demo.geo-solutions.it/geoserverdemo/ows",
"title":"DEMO GeoServer"
}
]
}