Creating and deploying apps with Boundless SDK¶
- Creation - Generating a new template application
- Customization - Adding features and functionality to the application
- Testing - Deploying the application in a test mode to verify functionality and troubleshoot
- Packaging - Creating a web archive that be deployed on any application server
- Deployment - Deploying the application in a production environment
Creating a new application¶
The Boundless SDK comes with three application templates:
- gxp - A template based on GXP, GeoExt, and OpenLayers 2
- ol3view - A template for viewing, based on OpenLayers 3 and Bootstrap
- ol3edit - A template for editing, based on OpenLayers 3 and Bootstrap
To create a new application based on this template, run the suite-sdk create command:
suite-sdk create path/to/myapp template
In the above command, the application will be called myapp and will be placed in the path/to/myapp directory. The template to be used must be one of the three listed above (gxp, ol3view, ol3edit).
Be sure to not name your application geoserver, geoexplorer, manager, docs, or any other name that might cause a conflict when deploying your application.
Customizing the application¶
The method of customizing the application depends on which template is used.
- If using the gxp template, please see the section on Application development with Boundless SDK GXP template.
- If using the ol3view or ol3edit templates, please see the section on OpenLayers 3 SDK templates.
Testing the application¶
Boundless SDK comes with a server that can be used to debug your application during development. The server loads all of your code as individual, uncompressed scripts, useful for debugging in a browser.
Run the following command to launch a server that loads the application in “debug mode”:
suite-sdk debug path/to/myapp
This server will publish the myapp application at http://localhost:9080/ . Navigate to this URL to view and test your application.
Type suite-sdk debug --help to see a full list of possible arguments.
Press Ctrl-C in the terminal window to shut down the server.
Changing the port¶
By default, the application will be published on port 9080. To run the server on another port, provide the -l <port> option to the debug command:
suite-sdk debug -l 8000 path/to/myapp
This will make your application available for debugging at http://localhost:8000/.
Accessing GeoServer while testing¶
Applications built with Boundless SDK are designed to be deployed in the same application server as OpenGeo Suite. So these applications will expect to have GeoServer accessible at the relative URL of /geoserver.
While testing locally, you may need to set up a proxy to a remote GeoServer to make it look as if it were available locally as well. To do this, provide the -g <URL> option:
suite-sdk debug -g http://example.com/geoserver path/to/myapp
This will make the GeoServer located at http://example.com/geoserver available locally to your application at the relative URL of http://localhost:9080/geoserver.
New in version 4.1: Since GeoServer is commonly located at http://localhost:8080/geoserver, if the -g option is not provided, the SDK will automatically check that location to see if a GeoServer is present. If a GeoServer is found, it will be automatically proxied to http://localhost:9080/geoserver.
The port and proxy options can both be used in the same command.
The testing server and proxy are suitable for debugging purposes only. Use the suite-sdk deploy command to prepare your application for production.
Packaging the application¶
After the applications is completed, the next step is to package it.
To package your application, run the following command:
suite-sdk package /path/to/myapp /path/to/destination
Type suite-sdk package --help to see a full list of possible arguments.
The above command will package the myapp application found at /path/to/myapp and create a myapp.war file at /path/to/destination. Leaving the destination option blank will cause the WAR file to be created in the current directory.
Deploying the application¶
Once the WAR file is created, it can be manually deployed to your application server.
To deploy to OpenGeo Suite for Windows, copy the WAR file to <OPENGEO_SUITE>\jetty\webapps. For example, if OpenGeo Suite is installed at C:\Program Files\Boundless\OpenGeo\, copy the WAR file to C:\Program Files\Boundless\OpenGeo\jetty\webapps\
To deploy to OpenGeo Suite for OS X, copy the WAR file to:
To deploy to OpenGeo Suite for Linux (either Ubuntu or any Red Hat-based Linux), and assuming an application named myapp:
Extract myapp.war to /usr/share/opengeo/myapp.
Create a file called myapp.xml in /etc/tomcat6/Catalina/localhost/ with the following content:
<Context displayName="myapp" docBase="/usr/share/opengeo/myapp" path="/myapp">
Save this file and restart Tomcat.
To deploy to OpenGeo Suite for Application Servers, please see the documentation for your application server.