Cloud Foundry is an open source platform as a service (PaaS) for developers to deploy and scale applications without manually configuring and managing servers. The promise of “write once, run anywhere” means developers can build their apps on a programming language or framework of their choice, and be able to deploy it to any underlying cloud environment.
For example, developers could code a Java-based Spring Framework application, and “push” the application to a Cloud Foundry space. That space could be running in an on-premises OpenStack cloud, or a public cloud like Amazon AWS, Google Cloud Platform, IBM Bluemix or Microsoft Azure. The idea is that it hides away infrastructure details and services such as databases, so developers do not need to worry about managing the underlying environment.
The Cloud Foundry platform is available from either the Cloud Foundry Foundation as open source software, or as a commercial product or service from multiple providers. Pivotal Cloud Foundry (PCF) is a commercial offering from Pivotal, which is now part of VMware.
As an open source low code platform to visually build enterprise web apps for coders and non-coders, Joget DX is a good complement for Cloud Foundry.
Deploy Joget DX on Pivotal Cloud Foundry
In this example, we will deploy Joget DX on PCF Dev from Pivotal. PCF Dev is a lightweight, easy to install distribution of Cloud Foundry designed to run on a developer machine, making it easier to locally develop, test and explore Cloud Foundry.
Step 1: Install PCF Dev
Install PCF Dev according to the instructions in the Pivotal Documentation.
Once installed, you may download the vm image from here and start PCF Dev using the command
and you should see the output:
Follow the instructions provided at the end of to connect to PCF Dev, by logging in using the admin user and choosing the pcfdev-org organization:
You should have output like the following:
Step 2: Create MySQL Database Service
In Cloud Foundry, all external dependencies such as databases, file systems and so on are considered services. Cloud Foundry allows administrators to provide a marketplace of services, from which users can provision reserved resources on-demand.
Here, we will create a MySQL Database Service.
In the command line, search the marketplace for MySQL plans available.
Create a service instance with the db-small plan with the name jogetdb:
More detailed information can be found at https://tanzu.vmware.com/tutorials/getting-started/connect-a-database
Step 3: Create Local Volume Service
In Cloud Foundry, a volume service provides a reliable, persistent file system. However in the latest CF Dev, it doesn't come with any volume service. Nevertheless, we should have that in production environment so Joget DX can read or write to it.
For example, create a service instance using the PCF Local Volume Service with the name jogetdata:
More detailed information can be found at https://docs.cloudfoundry.org/devguide/services/using-vol-services.html and https://github.com/cloudfoundry/local-volume-release
Step 4: Download and Deploy Joget DX WAR
Download Joget DX from https://www.joget.org/download/
Install Joget DX https://dev.joget.org/community/display/DX7/Installation+Guide
Look for the Joget DX WAR file jw.war in joget_installation_directory/apache-tomcat/webapps.
Push the WAR to the Cloud Foundry space with a memory allocation of 1G and application name joget:
Note that we use the --no-start parameter to delay the start of the application, because we need to set a couple of environment variables before starting up.
Step 5: Configure and Start Joget DX
Set the Apache Tomcat version to 8.5 and context path to /jw:
Next, disable the Spring auto reconfiguration. This is because the Joget DX WAR already performs the necessary initialization at startup, and the auto configuration will interfere with it:
Bind the volume service to mount the persistent filesystem to the Joget DX data directory:
Bind the MySQL database service:
Verify that the services are bound to the Joget application:
For example the output shows the services bound to the joget application:
Start the Joget application:
Step 6: Setup Joget Database
Now that the Joget platform has been deployed in Cloud Foundry, the final step is to setup the database schema, based on https://docs.cloudfoundry.org/devguide/services/migrate-db.html#single-migration.
At this point, we can obtain the MySQL database service credentials by viewing the environment variables:
In particular, note down the p-mysql service hostname, port, name, username and password.
Access Joget DX at http://joget.dev.cfdev.sh/jw/ and you will be presented with the database setup page.
Proceed to setup the database according to the instructions at https://dev.joget.org/community/display/DX7/Setting+Up+Database
Once setup is complete, you will be brought to the Joget DX App Center.
Appendix A: Application Manifest File
Optionally, an application manifest file can be used to specify environment variables and bind services.
However, there is a limitation that the current version of Cloud Foundry does not support specifying parameters when binding parameters, so binding of the local volume service to the Joget data directory has to be done manually:
Appendix B: Useful Cloud Foundry Commands
View application logs:
Restage the application after modifying service bindings or environment variables:
Stop PCF Dev VM:
Delete the PCF Dev VM:
Uninstall the PCF Dev Plugin:
View PCF Dev App Manager:https://apps.dev.cfdev.sh