Joget on Cloud Foundry

Cloud Foundry is an open-source Platform as a Service (PaaS) that allows developers to deploy and scale applications without the manual setup or management of servers. Its "write once, run anywhere" promise enables developers to use their choice of programming languages or frameworks and deploy applications across various cloud environments.

For example, a developer could code a Java-based Spring Framework application and deploy it on a Cloud Foundry space, which could be running on a local OpenStack cloud or a public cloud such as Amazon AWS, Google Cloud Platform, IBM Bluemix, or Microsoft Azure.

The Cloud Foundry platform is managed by the Cloud Foundry Foundation and is available as open-source software or through commercial offerings from multiple providers like Pivotal Cloud Foundry (PCF), now part of VMware.

Joget DX, an open-source low-code platform for building enterprise web applications for both coders and non-coders, is a great complement to Cloud Foundry.

   

Deploy Joget DX on pivotal cloud foundry

Deploying Joget DX on Pivotal Cloud Foundry (PCF) involves several steps to set up the environment, deploy Joget, configure services, and finalize the database setup.

Install PCF Dev

Follow the installation instructions from Pivotal Documentation to install PCF Dev.

  1. Download the VM image and start PCF Dev using the command:
    cf dev start -f ~/pcfdev-v1.2.0-linux.tgz -s mysql

    Wait for the startup process to complete, which may take several minutes. You should see the following output indicating the system is now running:

    Downloading Resources...
    Progress: |====================>| 100.0%
    Setting State...
    Creating the VM...
    Starting the VM...
    Fetching VM Address...
    Waiting for the VM...
    Deploying the BOSH Director...
    Deploying PAS...
      Done (22m38s)
    Deploying Apps-Manager...
      Done (3m12s)
    Deploying Mysql...
      Done (2m12s)
    
             ██████╗  ██████╗███████╗██████╗ ███████╗██╗   ██╗
             ██╔══██╗██╔════╝██╔════╝██╔══██╗██╔════╝██║   ██║
             ██████╔╝██║     █████╗  ██║  ██║█████╗  ██║   ██║
             ██╔═══╝ ██║     ██╔══╝  ██║  ██║██╔══╝  ╚██╗ ██╔╝
             ██║     ╚██████╗██║     ██████╔╝███████╗ ╚████╔╝
             ╚═╝      ╚═════╝╚═╝     ╚═════╝ ╚══════╝  ╚═══╝
                         is now running!

After the VM is up and running, proceed with the following steps to begin using PCF Dev:

  1. Log in to PCF Dev, execute the following command:
    cf login -a https://api.dev.cfdev.sh --skip-ssl-validation
    Admin user:
    • Email: admin
    • Password: admin

Regular user:

    • Email: user
    • Password: pass
  1. Go to https://apps.dev.cfdev.sh to access the Apps Manager.
  2. To deploy specific services, use the command:
    cf dev deploy-service <service-name> [Available services: mysql, redis, rabbitmq, scs]

After successfully logging in and deploying services, you might need to handle some additional configurations and potential warnings:

  • Handle API Version Warning: If you encounter a warning about the API version being unsupported, it indicates that your CF CLI needs an update to a newer version that is compatible with the Cloud Foundry environment you are using:
    API endpoint: https://api.dev.cfdev.sh
    Your CF API version (2.125.0) is no longer supported. Upgrade to a newer version of the API (minimum version 2.128.0).

Please update your CF CLI according to the CF CLI Versioning Policy to avoid compatibility issues.

  • Login and Select Organization: After addressing any version warnings, ensure you are logged in with the correct credentials and select the appropriate organization to work within:
    Email: admin
    Password:
    Authenticating...
    OK
    
    Select an org:
    1. cfdev-org
    2. system
    
    Org (enter to skip): 1
    Targeted org cfdev-org
    Targeted space cfdev-space

    Use the admin user credentials (admin/admin) for this login. Once logged in, the CLI will confirm the targeted API endpoint, user, organization, and space, helping ensure that you are working in the correct environment.

    API endpoint:   https://api.dev.cfdev.sh (API version: 3.76.0)
    User:           admin
    Org:            cfdev-org
    Space:          cfdev-space
  • Verify Your Setup: After logging in and selecting your organization, it's important to verify that your environment is correctly set up to start deploying or managing your applications. Check the configuration and connected services to ensure everything is aligned as expected.

Create MySQL database service

In Cloud Foundry, services such as databases and file systems are external dependencies that you can manage through a marketplace. This marketplace allows administrators to offer a variety of services that users can provision on demand.

To create a MySQL Database Service, follow these steps:

  1. Use the following command to search the marketplace for available MySQL plans:
    cf marketplace -s p.mysql

This command lists all MySQL service plans available in your Cloud Foundry deployment.

  1. To provision a MySQL database, select the db-small plan and create a service instance named jogetdb by executing:
    cf create-service p.mysql db-small jogetdb

This command initializes a MySQL database instance with the specified plan, ready for use with your applications.

For additional guidance on connecting to the database once it is created, see VMware Tanzu Tutorials.

Create local volume service

In Cloud Foundry, a volume service provides a reliable, persistent file system. While the latest CF Dev does not include any pre-configured volume services, it's essential to set one up in a production environment where applications like Joget DX need persistent storage for read and write operations.

To create a local volume service instance for Joget DX:

  1. Execute the Service Creation Command:
    cf create-service local-volume free-local-disk jogetdata

This command creates a service instance named jogetdata using the PCF Local Volume Service, which provides a free local disk.

For more detailed information on using volume services in Cloud Foundry, see the Cloud Foundry documentation on volume services and the GitHub repository for the local volume release.

Download and deploy Joget DX

To deploy Joget DX on Cloud Foundry, you first need to download and prepare the application WAR file.

  1. Download the latest version of Joget DX from the official website.
    1. For installation instructions, see System Requirements.
  2. Find the jw.war file within your Joget installation directory under apache-tomcat/webapps.
  3. Use the following command to push the WAR file to your Cloud Foundry space:
    cf push joget -p /path_to/joget-enterprise-linux-7.0.0/apache-tomcat-8.5.41/webapps/jw.war -m 1G --no-start -b https://github.com/cloudfoundry/java-buildpack.git
    Note: The --no-start parameter is used to delay the application start. This allows you to set necessary environment variables before the application begins running.

Set up and start Joget DX

Set up Joget DX by setting the required environment and binding services, ensuring the application interacts correctly with the necessary resources.

  1. Set up the Apache Tomcat version and set the context path:
    cf set-env joget JBP_CONFIG_TOMCAT '[tomcat: { version: 8.5.+, context_path: "/jw" }]'

    Disable Spring's auto-reconfiguration to avoid conflicts with Joget's initialization processes:

    cf set-env joget JBP_CONFIG_SPRING_AUTO_RECONFIGURATION '[enabled: false]'
  2. Bind the local volume service to create a persistent file system for Joget DX:
    cf bind-service joget jogetdata -c '{"mount":"/home/vcap/wflow"}'

    Bind the MySQL database service to manage application data:

    cf bind-service joget jogetdb
  3. Ensure that all services are properly bound to the Joget application by executing:
    cf services

    This command lists all services associated with your application. Here's what the output might look like when services are correctly bound:

    name      service   plan       bound apps   last operation     broker                   upgrade available
    jogetdb   p.mysql   db-small   joget        create succeeded   dedicated-mysql-broker

This output confirms that the jogetdb service, a MySQL database with the db-small plan, is successfully bound to the Joget application, indicating that the service creation and binding have been successfully completed.

  1. Start the Joget DX application:
    cf start joget

Set up Joget database

Now that Joget DX is deployed on Cloud Foundry, the final step is to configure the database schema.

  1. Retrieve the credentials for the MySQL database service by viewing the environment variables:
    cf env joget

    Note down the hostname, port, database name, username, and password provided under the p.mysql service credentials. This information is important for configuring the database connection in Joget DX.

    Here is an example of what the output might look like:

    Getting env variables for app joget in org cfdev-org / space cfdev-space as admin...
    OK
     
    System-Provided:
    {
     "VCAP_SERVICES": {
      "p.mysql": [
       {
        "binding_name": null,
        "credentials": {
         "hostname": "q-n1s3y1.q-g173.bosh",
         "jdbcUrl": "jdbc:mysql://q-n1s3y1.q-g173.bosh:3306/service_instance_db?user=e35c7904b0c8402096ef491aa0a17151\u0026password=xgd4xt398r8hkct6\u0026useSSL=false",
         "name": "service_instance_db",
         "password": "xgd4xt398r8hkct6",
         "port": 3306,
         "uri": "mysql://e35c7904b0c8402096ef491aa0a17151:xgd4xt398r8hkct6@q-n1s3y1.q-g173.bosh:3306/service_instance_db?reconnect=true",
         "username": "e35c7904b0c8402096ef491aa0a17151"
        },
        "instance_name": "jogetdb",
        "label": "p.mysql",
        "name": "jogetdb",
        "plan": "db-small",
        "provider": null,
        "syslog_drain_url": null,
        "tags": [
         "mysql"
        ],
        "volume_mounts": []
       }
      ]
     }
    }
     
    {
     "VCAP_APPLICATION": {
      "application_id": "f80eeb36-b149-4aed-a3dc-a0cca32c0e1f",
      "application_name": "joget",
      "application_uris": [
       "joget.dev.cfdev.sh"
      ],
      "application_version": "92375e68-74b1-41f6-9d11-5f196629fb4a",
      "cf_api": "https://api.dev.cfdev.sh",
      "limits": {
       "disk": 1024,
       "fds": 16384,
       "mem": 1024
      },
      "name": "joget",
      "space_id": "45d5b30a-6bb1-4ccb-99f1-e45912c40ef1",
      "space_name": "cfdev-space",
      "uris": [
       "joget.dev.cfdev.sh"
      ],
      "users": null,
      "version": "92375e68-74b1-41f6-9d11-5f196629fb4a"
     }
    }
     
    User-Provided:
    JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: [enabled: false]
    JBP_CONFIG_TOMCAT: [tomcat: { version: 8.5.+, context_path: "/jw" }]
  1. Open Joget DX at http://joget.dev.cfdev.sh/jw/ to start the database setup.
  2. Follow the detailed instructions provided in the Set Up a Database to configure the database.
    Once the database set up is complete, you will have access to the Joget DX App Center.

For more information on application management and deployment with Cloud Foundry, see the Cloud Foundry for Application Deployment and Management guide.

Created by Julieth Last modified by Aadrian on Dec 13, 2024