The CLI tool can be used to view and manage your Liferay Cloud services. Once installed, you can run
lcp --help in your terminal to view available actions.
You can run the
--verbose option at the end of any
lcp command to see extra logging and information. Run the
--help flag at the end of any
lcp command to see the available flags you can use with it.
- Installing the CLI Tool
- Upgrading the CLI Tool from Version 2 to 3
- Configuring the CLI Remote
- Showing the Service Logs
- Changing the Number of Service Instances
- Listing Projects or Services
- Restarting a Service
- Deploying to Your Liferay Cloud Environment
- Accessing a Service’s Shell
- Uninstalling Version 3 of the CLI Tool
Open your terminal, and run this command:
curl https://cdn.liferay.cloud/lcp/stable/latest/install.sh -fsSL | bash
If you get a permissions error, try running the command again and replacing
Download the latest version of the Windows installer, and follow the steps in the wizard.
You must first uninstall your current version before you can install and use version 3. This prevent conflicts with the same binary name.
These instructions are specific to uninstalling CLI version 2 and are not the same as those for uninstalling version 3 of the CLI tool.
Open a terminal and run:
Verify uninstall is complete by running the command
On Windows 10, go to Control Panel → Programs → Uninstall a program.
Alternatively, for Windows 7 and 8, go to Control Panel → Add or Remove Programs.
Click Uninstall then confirm.
Verify uninstall is complete by running the command
Verify that CLI version 2 has been uninstalled before installing version 3.
Once version 2 is uninstalled, you can follow the above instructions to install version 3 of the CLI tool.
To access Liferay Cloud services via the CLI tool, it must be configured to point to Liferay Cloud’s remote URL:
To list the CLI’s remotes, run this command:
You can add new remotes to the CLI tool using this command:
lcp remote set <remote-alias> <remote-url>
If desired, you can change its default remote:
lcp remote default <remote-alias>
Alternatively, you can specify the remote inline:
lcp shell -p <project-id> --service <service-id> --remote <remote-alias>
lcp backup command to download a specific backup using its ID.
Run this command to download both the database and document library concurrently:
lcp backup download --backupId <ID>
Alternatively, add the
--doclib flags to only download the one specified:
lcp backup download <type> --backupId <ID>
lcp log commands to display logs for specific projects, services, and instances. Below are some common commands, though you can see available command options by running
lcp log --help.
View all service logs for a project environment:
lcp log -p <project>-<environment>
View logs for a single service in a project environment:
lcp log -p <project>-<environment> -s <service>
Alternatively, use a service’s full URL to view its logs:
lcp log --url <service>-<project>-<environment>.lfr.cloud
By default, the
lcp log command only returns 10,000 lines to reduce network impact. However, you can avoid this restriction by using
--until parameters to specify a period of time (e.g.,
"yesterday at 9pm",
"10 minutes ago",
View all service logs for a project environment from a specific time to the present:
lcp log -p <project>-<environment> --since <start_time>
View all service logs for a project environment from a specific period of time:
lcp log --since "<start_time>" --until "<end_time>"
You can also pipe the output of an
lcp log command into a file by appending
>> "<new-file.txt>" to the end of the command. When run, the new file is created in your terminal’s current path.
lcp log -p <project>-<environment> -s <service> --since "<start_time>" --until "<end_time>" >> "<new-file.txt>"
lcp scale commands to individually scale environment services. These examples include some common commands, though you can see available command options by running
lcp scale --help.
View all services and their instances for a project environment, and then select a service to scale:
lcp scale -p <project>-<environment>
Then, follow the terminal prompts to select a service and determine the number of its instances.
Alternatively, specify the target service and desired number of instances as part of the
lcp scale command:
lcp scale -p <project>-<environment> -s <service> <instances>
You can also scale instances using its full URL:
lcp scale --url <service>-<project>-<environment>.lfr.cloud <instances>
lcp list commands to view project services, each with its image and status. These examples include some common commands, though you can see available command options by running
lcp list --help.
View a complete list of projects, services, and instances that you either own or collaborate on:
View the image and status of environment specific services:
lcp list -p <project>-<environment>
Check the image and status of a specific service:
lcp list -p <project>-<environment> --service <serviceID>
Alternatively, you can check a service by passing its full URL to
lcp list --url <service>-<project>-<environment>.lfr.cloud
lcp restart commands to restart an environment service. These examples include some common commands, though you can see available command options by running
lcp restart --help.
View all project environments and services, and then select an environment service to restart:
Restart a specific service in a project:
lcp restart -p <project>-<environment> -s <service>
Alternatively, restart a service by passing its full URL to
lcp restart --url <serviceID>-<projectID>.lfr.cloud
lcp deploy command to deploy either a specific service or all of your services to one of your environments:
lcp deploy from the root directory of your repository deploys all applicable services to your chosen environment. Run the command from one service’s folder (with the service’s
LCP.json file in that folder) to specifically deploy that service to the environment.
Run the command with
-r to specify a remote (by its ID) other than the default:
lcp deploy -r <remote-id>
See Deploying Changes via the CLI Tool for more information.
To access a service container’s shell, run this command:
This lists all the services in the container and prompts you to choose which one to access.
Alternatively, access the shell of a specific service’s container by adding the service’s project ID and service ID to the
lcp shell command:
lcp shell -p <project>-<environment> -s <service>
lcp docs command to access Liferay Cloud resources, including official documentation, Help Center content, and more.
For Mac and Linux, run this command:
curl https://cdn.liferay.cloud/lcp/stable/latest/uninstall.sh -fsSL | bash
For Windows 7 and 8, go to Control Panel → Add or Remove Programs. In Windows 10, go to Control Panel → Programs → Uninstall a program. Then, find LCP CLI in the list of programs, select it, and click Uninstall. Follow the steps in the wizard.