An “environment” in the API is referred to as a stack in the UI and the Rancher documentation. In the API documentation, we’ll use the UI terminology. A Rancher stack mirrors the same concept as a docker-compose project. It represents a group of services that make up a typical application or workload.
| Field | Type | Create | Update | Default | Notes |
|---|---|---|---|---|---|
| description | string | Optional | Yes | - | |
| dockerCompose | string | Optional | - | - | |
| environment | map[string] | Optional | - | - | |
| externalId | string | Optional | Yes | - | |
| name | string | Yes | Yes | - | |
| outputs | map[string] | Optional | Yes | - | |
| previousEnvironment | map[string] | Optional | Yes | - | |
| previousExternalId | string | Optional | Yes | - | |
| rancherCompose | string | Optional | - | - | |
| startOnCreate | boolean | Optional | - | - |
| Field | Type | Notes |
|---|---|---|
| data | map[json] | |
| healthState | string | |
| id | int | The unique identifier for the environment |
Please read more about the common resource fields. These fields are read only and applicable to almost every resource. We have segregated them from the list above.
/v1/projects/${PROJECT_ID}/environments/${ID}?action=activateservices
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=activateservices'/v1/projects/${PROJECT_ID}/environments/${ID}?action=cancelrollback
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=cancelrollback'/v1/projects/${PROJECT_ID}/environments/${ID}?action=cancelupgrade
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=cancelupgrade'/v1/projects/${PROJECT_ID}/environments/${ID}?action=deactivateservices
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=deactivateservices'/v1/projects/${PROJECT_ID}/environments/${ID}?action=exportconfig
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"serviceIds": "array[reference[service]]"
}' 'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=exportconfig'/v1/projects/${PROJECT_ID}/environments/${ID}?action=finishupgrade
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=finishupgrade'/v1/projects/${PROJECT_ID}/environments/${ID}?action=rollback
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=rollback'