Setting Up Automatic Deployment

Setting Up Automatic Deployment

Kyle is able to begin developing and testing with Liferay Cloud, but it’s easier if he can test his changes immediately after deployment.

Here, you’ll configure a branch to deploy newly pushed changes to your UAT environment automatically.

Add the Configuration

Configure automatic deployment via the LCP_CI_DEPLOY_BRANCH and LCP_CI_DEPLOY_TARGET CI service environment variables.

  1. In the Liferay Cloud console, navigate to your infra environment.

  2. Click on the CI service.

  3. Click the Environment Variables tab.

  4. Set these environment variable values:

    • LCP_CI_DEPLOY_BRANCH: live-update


    Use these environment variables to inform CI of the branch and target environment for automatic deployment.

  5. Click Save Changes.

The CI service restarts with the new configuration. Once it’s back up, builds created from that point on via the live-update branch are deployed to your UAT environment automatically.

Test with a New Push

Next, make a commit and test that automatic deployment is working properly.

  1. Open your command prompt in your project repository.

  2. Create and switch to a new branch called live-update. You’ll use this branch to deploy immediately any new developments you push up to UAT.

    git checkout -b live-update
  3. Add and commit a dummy file to trigger a new build.

    touch dummy.txt
    git add dummy.txt
    git commit -m "First automatic deployment"
  4. Push the change to your remote live-update branch.

    git push origin live-update
  5. Return to the Liferay Cloud console and click Deployments.

    Your new push appears in the list of deployments made to the UAT environment.

Your new commit appears in the list of deployments, deployed to the UAT environment.

Now you can deploy any new developments or changes straight from your repository for testing. Next, you’ll practice using a backup to revert changes from development.

Relevant Concepts