Before you deploy your application in WSO2 Integration Cloud, you develop and test it locally and create an archive file. If the environment that you develop on locally is different to the deployment environment that you select in the Integration Cloud, there's a chance that your application will fail. Therefore, WSO2 provides Docker images that simulate the Cloud's runtimes that you can use to test your applications locally before you deploy them in the Cloud.
Let's get started!
Create an archive file by bundling your application's artifacts together.Expand to see the archive file types for different app types...
App Type Archive File Type WSO2 ESB Composite Application .car Java Web Appplication .war Java Microservice .jar PHP Application .zip Note that when creating the ZIP file, you must select all your application's artifacts (Alt+A), right-click on the selected files, and then click Archive or any other option depending on your operating system or software. WSO2 Jaggery Application .zip Note that when creating the ZIP file, you must select all your application's artifacts (Alt+A), right-click on the selected files, and then click Archive or any other option depending on your operating system or software. WSO2 Data Service .car (see this for more information).
Let's set up your local environment using a Docker image of the Cloud's runtime in which you plan to deploy your application.
Docker is a tool designed to make it easier to create, deploy, and run applications using containers, which allow you to package your application with the required libraries and dependencies. Because of containers, your application will run on any machine regardless of the customized settings that each machine might have that could differ from the machine used for writing and testing the code.
WSO2 Cloud offers runtimes for each application type that you can deploy in the Cloud. The runtimes have corresponding Docker images as shown in the table below. Select a Docker image from the list:
Tip: Note that the runtimes that are deprecated in WSO2 Cloud do not have corresponding Docker images.Expand to see the Docker images for different runtimes...
App Type Available Docker Images WSO2 ESB Composite Application Java Web Application Java Microservice PHP Application WSO2 Jaggery Application WSO2 Data Service
- Install Docker 1.10.3 on your developer environment by following the instructions here.
Create a folder for your application in an appropriate location.
Create a Dockerfile with the name
Dockerfileinside the folder mentioned above.
Click the link below and select the Docker file content that goes with the application type that you want to deploy.
Tip: It is recommended to use environment variables in your application when defining variables such as database URLs, database users, etc. This will ensure that you do not have to change the code when running your application on different platforms such as the Docker image and the Cloud.Expand this to see the Docker file content for your app type...
App Type Docker File Content WSO2 ESB Composite Application Java Web Application
<DOCKER_IMAGE>in this command can have one of many values you see in the table in step 2.
Java Microservice 2.0.0
Tip: Be sure to pull the Docker image that corresponds to the runtime you plan to select in WSO2 Cloud. For example, if you plan to select MSF4J 1.0.0, which is deprecated, as your runtime in the Cloud, the given Docker image will not be compatible as it is based on MSF4J 2.0.0.
PHP Jaggery WSO2 Data Service
In the above code, replace
<APP_ARTIFACT_NAME>with the actual artifact name (e.g.,
foo-app.war) and copy the artifact to the folder you created in step 4 (e.g.,
Note that you now have the following folder structure in the folder that you created in step 4.
Log in to docker.cloud.wso2.com using your WSO2 user account and run the following command to pull the docker image that you want to use. The Docker image should change according to your application type.
Run the Docker build command to create an image as follows:
Start a container with your application. To see the commands that correspond to your app type, expand the link below.Expand to see the command to start a container for your app type...
App Type Command WSO2 ESB Composite Application Java Web Application Java Microservice 2.0.0 PHP Jaggery Data Service
Using a web browser, access your application's URL to test it.
You have now seen how to use a simulated Cloud runtime, in the form of a Docker image, to test your application locally before you deploy it in the Cloud.