Exploring the Cloud CLI's Capabilities
Liferay Cloud CLI is a powerful command-line tool designed to streamline your interactions with Liferay PaaS and SaaS environments. This article explores the CLI's features, from managing projects and services to deploying client extensions and troubleshooting issues.
Primary Features
The Liferay Cloud CLI tool provides a comprehensive set of commands for managing your Liferay Cloud deployments. It works by interacting with Liferay Cloud environments through APIs; when you execute a command, the CLI constructs an API request based on your input. Liferay Cloud then processes the request and returns a response.
Key features include:
- Project and Service Management: List, view details, and manage your Liferay Cloud projects and services.
- Deployment and Updates: Deploy applications and updates to your environments.
- Cloud Backups: Run and manage environment backups.
- Log Management: Access logs for troubleshooting and monitoring.
- Shell Access: Access a service’s shell.
In these ways, the Liferay Cloud CLI simplifies many tasks that would otherwise require navigating the Liferay Cloud Console. This is particularly useful for automating repetitive actions or working in environments with limited GUI access.
Using Liferay Cloud CLI
After installing the Liferay Cloud CLI tool, you can run lcp --help
to view all available commands. You can then run lcp login
or any command requiring project access (e.g., lcp log
) to trigger authentication. Once authenticated, you can execute any commands for project environments and services you can access.
When running environment and service commands, the CLI tool prompts you to identify a specific project environment and service. You can provide options and arguments in your commands if you already know the target environment or service ID.
Here's a look at some commonly used lcp
commands.
Listing Projects and Services
To view all project services, run the lcp list
command:
The output includes each service’s image and status.
View the image and status of environment specific services:
Check the image and status of a specific service:
Alternatively, you can check a service by passing its full URL to lcp list
:
Deploying to Liferay Cloud Environments
Use the lcp deploy
command to deploy either a specific service or all of your services to one of your environments:
Running 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:
Accessing Service Logs
Use lcp log
commands to display logs for specific projects, services, and instances.
View all service logs for a project environment:
View logs for a single service in a project environment:
Alternatively, use a service’s full URL to view its logs:
By default, the lcp log
command only returns 10,000 lines to reduce network impact. However, you can avoid this restriction by using --since
and --until
parameters to specify a period of time (e.g., yesterday
, "yesterday at 9pm"
, "10 minutes ago"
, "mm/dd/YYYY HH:mm:ss"
).
View all service logs for a project environment from a specific time to the present:
View all service logs for a project environment from a specific period of 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.
Conclusion
Liferay Cloud CLI is a valuable tool for managing and interacting with your cloud deployments. Next, you’ll learn about how you can use Liferay’s developer tools in Liferay SaaS deployments.
Capabilities
Product
Education
Contact Us