Liferay Cloud Platform
- How can I get information about incidents and scheduled maintenances?
- How can I open a Liferay Cloud ticket?
- How does the "environments" configuration on LCP.json work?
- Incidents and Uptime Status
- Liferay Cloud Platform Maintenance and Release Schedule
- Liferay Cloud Support FAQ
- Liferay Cloud Support Overview
- Private Cluster
- Staging with Liferay Cloud
- Support Access
- Uptime History for Liferay Cloud Infrastructure
- Why Isn't Liferay Cloud Open-Source?
How does the "environments" configuration on LCP.json work?
In order to provide environment-specific configurations, we introduced the environments configuration, which allows you to override the default configuration specified on the LCP.json.
There are some specific rules that apply depending on the type of property that you're trying to override. This article will cover these specific use cases. But first, let's take a look at a basic use case of this feature.
Basic Behavior
Let's say we want to block the CI service to be deployed from all environments, except the infra environment.
In this case, we can define deploy: false as the default behavior and add deploy: true only for that specific environment.
{
"id": "ci",
"memory": 8192,
"cpu": 4,
"deploy": false,
"environments": {
"infra": {
"deploy": true
}
}
}
JSON Object Behavior
Now let's imagine we want to allow the CDN to be enabled in all environments, but in the dev environment we want it to be disabled.
In this case, we're dealing with loadBalancer, which is a JSON object. For these types of properties, we adopt a merging behavior. Therefore, you can only specify what changed. That's why we don't need to declare the targetPort once again.
{
"id": "webserver",
"memory": 512,
"cpu": 2,
"loadBalancer": {
"targetPort": 80,
"cdn": true
},
"environments": {
"dev": {
"loadBalancer": {
"cdn": false
}
}
}
}
The resulting loadBalancer object would look like this on the dev environment:
"loadBalancer": {
"targetPort": 80,
"cdn": false
}
JSON Array Behavior
Finally, let's say we want to have all ports closed, but open only one port externally available in the uat environment.
In this case, we're dealing with ports, which is a JSON array. For these types of properties, we adopt an override behavior. This means that we need to be explicit about what we want to change.
{
"id": "database",
"memory": 1024,
"cpu": 2,
"ports": [
{
"port": 3306,
"external": false
},
{
"port": 3000,
"external": false
}
],
"environments": {
"uat": {
"ports": [
{
"port": 3306,
"external": true
}
]
}
}
}
The resulting ports array would look like this on the uat environment:
"ports": [
{
"port": 3306,
"external": true
}
]