Creating and deploying apps with Boundless SDK

Boundless SDK provides tools for building JavaScript-based web mapping applications backed by OpenGeo Suite. The application development life-cycle is as follows:

  1. Creation - Generating a new template application
  2. Customization - Adding features and functionality to the application
  3. Testing - Deploying the application in a test mode to verify functionality and troubleshoot
  4. Packaging - Creating a web archive that be deployed on any application server
  5. 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).

Warning

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.

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.

Note

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.

Note

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.

Note

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.

Packaging the application is the process of creating a web archive (WAR) that can be deployed to any application server, such as the one hosting OpenGeo Suite web applications. This process will concatenate and compress (“minify”) all JavaScript resources and then create a WAR.

To package your application, run the following command:

suite-sdk package /path/to/myapp /path/to/destination

Note

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.

Windows

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\

The WAR file should automatically extract to its own directory, but if it doesn’t, you can manually extract the file using a standard “unzip” program such as 7-zip.

OS X

To deploy to OpenGeo Suite for OS X, copy the WAR file to:

~/Library/Application\ Support/GeoServer/jetty/webapps

The WAR file should automatically extract to its own directory, but if it doesn’t, you can manually extract the file using a standard “unzip” program such as iZip.

Linux

To deploy to OpenGeo Suite for Linux (either Ubuntu or any Red Hat-based Linux), and assuming an application named myapp:

  1. Extract myapp.war to /usr/share/opengeo/myapp.

  2. Create a file called myapp.xml in /etc/tomcat7/Catalina/localhost/ with the following content:

    <Context displayName="myapp" docBase="/usr/share/opengeo/myapp" path="/myapp"/>
    
  3. Save this file and restart Tomcat.

Application Servers

To deploy to OpenGeo Suite for Application Servers, please see the documentation for your application server.