Deploying Changes via the CLI Tool¶
With the CLI tool, you can directly deploy local project changes without triggering a Jenkins build or using the DXP Cloud Management Console. This tutorial walks through the process of adding a portal property to the Liferay service and deploying it to the
dev using the CLI tool.
Although the CLI tool provides a quick way to deploy changes to your project, it’s best practice to use the CI service and DXP Cloud console for the majority of deployments. See Deploying Changes via the DXP Cloud Console to learn how.
If you are using version
3.x.x services in your project, you must first prepare their
LCP.json files before deploying changes with the CLI tool.
Otherwise, you can skip this step and begin the deployment process:
Preparing LCP.json Files in Project Version 3¶
If you are not using version
3.x.x services in your project, then skip this step and begin making your change.
Otherwise, open the
gradle.properties at the root of your repository, and find properties for the Docker image versions for each of your services, like the following properties:
liferay.workspace.lcp.backup.image=liferaycloud/backup:3.2.1 liferay.workspace.lcp.database.image=liferaycloud/database:3.2.1 liferay.workspace.lcp.search.image=liferaycloud/elasticsearch:6.1.4-3.0.3 liferay.workspace.lcp.liferay.image=liferaycloud/liferay-dxp:7.2.10-ga1-3.0.10 liferay.workspace.lcp.webserver.image=liferaycloud/nginx:1.14.2-3.1.1 liferay.workspace.lcp.jenkins.image=liferaycloud/jenkins:2.176.1-3.1.1
For each of these properties, copy the value and use it to replace the placeholder value for the
image property in the corresponding service’s
LCP.json file. This allows the CLI to use the correct Docker images when it searches within the
For example, use the value from the
liferay.workspace.lcp.search.image property as the new value in
lcp/search/LCP.json for this line:
"image": "@[email protected]",
liferay.workspace.lcp.jenkins.image property corresponds to the
Adding a Portal Property to the Liferay Service¶
Begin the deployment life cycle by adding a portal property to the
dev environment’s Liferay service and committing your changes:
Ensure your local master branch is up-to-date with the latest version of your project’s repository.
Create a new working branch based on your up-to-date master branch.
git checkout -b example-cli-deployment-branch
<project>\liferay\configs\dev\, and add the following property to the
If you’re using version 3.x.x services, then the appropriate folder path is
lcp/liferay/deploy/dev. See DXP Cloud Project Changes in Version 4 for more information on the differences in the directory structure, and Understanding Service Stack Versions for how to check the version of your services.
Add and commit your changes with the following commands:
git add .
git commit -m "Test - Adding Portal Property"
Deploying Your New Build via the CLI Tool¶
Once you’ve committed your changes, follow these steps to create a build of your Liferay service with Gradle, and then deploy it to your
dev environment using the CLI tool:
Open your terminal, and navigate to the Liferay service folder.
If you’re using version 3.x.x services, you must navigate to the
lcpdirectory in your repository before running the CLI tool, so that it can traverse the directory and find your services’
lcp login. If you’re not already logged in, you are prompted to authenticate your credentials via browser.
Run the following commands in sequence to create a Gradle build for your Liferay service:
./gradlew clean deploy createDockerfile
If you are using version
3.x.xservices in your project, then you must instead run
./gradlew distLiferayCloudfrom the
You must first create a Gradle build of the Liferay service before running the
lcp deploycommand. No local build process is required for other services, so you can directly deploy backup, CI, database, search, and webserver services.
LCP.jsonfile into the Docker directory before deploying the build.
cp LCP.json build/docker
You must copy the
LCP.jsonfile into the Docker directory, because the
lcp deploycommand must be run from a directory with the service’s
LCP.jsonfile when deploying that service.
Run the following command to deploy the build to your
lcp deploy --project=<project-name> --environment=dev
During this process, your new build is added to your project and deployed to the
devenvironment. At this time, the Liferay service should restart with the new portal property.
Verifying Your Sample Deployment¶
Once your build has successfully deployed and your
dev environment’s Liferay service is Ready, follow these steps to verify your changes:
Navigate to your project’s
Go to the Web Server service’s page, and click on its URL to access the
devenvironment’s DXP instance:
Verify the web server node is displayed at the bottom of the Home Page.