2. 2
Developing a CloudHub Application
The best way to learn how to develop a CloudHub application is to read the
Getting Started with CloudHub guide, which includes walkthroughs of basic
concepts and examples to help get you familiar with the process of
developing and deploying your applications in CloudHub.
This page covers additional details relevant to deployment.
3. 3
Specifying a Host
Define the Host address in a CloudHub configuration as 0.0.0.0. CloudHub
routes requests from your application domain URL to the endpoint. If you
deploy multiple workers, CloudHub load-balances incoming traffic
automatically across these workers for you. As your application scales,
work loads automatically distribute between your workers.
4. 4
Providing an External HTTP or HTTPS Port
If your application requires an externally accessible HTTP or HTTPS port to
receive messages, trigger events, or expose a web service or user
interface, declare the Port using the reserved property ${http.port} `or $
{https.port}`. On CloudHub, port ${http.port} `or ${https.port}` is assigned
automatically by the platform services. Traffic on port 80 to your application
domain’s URL routes to this port.
5. 5
Running Your Application Locally
If you want to run a CloudHub application locally, create an application
properties file named mule-app.properties in the src/main/app folder of your
project. You need to do this whether you work in Anypoint Studio or
another IDE. This allows you to define a local value for the variable
http.port or https.port.
If you have other runtime settings that you want to configure differently
when running locally, you may also place them in the application properties
file and refer to them using the syntax ${propertyname} in your Mule
application configuration. Each application can declare a set of
environment variables when it is deploys to provide a different value when
deploying on CloudHub. You can define these environment variables using
the CloudHub Console or the Command Line Tools.
6. 6
Logging
All log messages from your application are captured by the CloudHub
logging service and available through the log search tool in the CloudHub
console. If you wish to expose additional information in your logs for
diagnostic or audit purposes, Mule provides a logger element for fine
grained logging of message content.
7. 7
Packaging Third-Party Libraries
CloudHub provides services in the platform that support connecting over
many different protocols and transforming many data formats. All the
standard Mule libraries are included and available to your application. If you
have the need to include a different third party library, you can package that
library in the <mule application zip>/lib folder of your application package.
Any libraries that are packaged in your Mule application lib folder are
available on the classpath to your application at run time.
8. 8
Adding a UI for Your Application
CloudHub applications can have a web UI using HTML and JavaScript. The
AJAX Module provides support for interacting with your application from the
browser and provides support for serving up static content.