Deployments

Deploying is the process of updating the state of an Environment. This could include updates to the version of code, Application configuration or even resources. The Platform Orchestrator stores the history of every Deployment that happens in an Environment.

Each Environment in the Platform Orchestrator holds a history of all Deployments into it. The Deployment object stores metadata about the deployment. This includes when it was triggered, whether it was successful, who triggered it and the Deployment Set that was deployed. The history can be analyzed to understand what the material changes were made to an Environment between any two deployments. This cane be done by “diffing” the Deployment Sets deployed in each deployment.

It is also possible to roll back the state of an Environment to a past Deployment by re-deploying that deployment.

Deploying to an Environment

Deploy your Applications to an Environment.

  1. From the Applications overview , select your Application and Environment.
  2. In Draft deltas section, choose a draft deployment you want to deploy and select Review & Deploy.
    1. Enter a comment to be included with the deployment.
    2. Select Deploy.

Use the humctl deploy command to deploy a Delta with changes to an Environment.

humctl deploy delta $DELTA_ID $ENV_ID --comment="${COMMENT}"

Where the following environment variables are set:

Variable Example Description
ENV_ID my-env The ID of the Environment to be deployed to.
DELTA_ID ffbbf5198e4 The ID of the Delta to deploy.
COMMENT Added DNS An comment to be included with the deployment.

curl "https://api.humanitec.io/orgs/${HUMANITEC_ORG}/apps/${APP_ID}/envs/${ENV_ID}/deploys" \
  -X POST \
  -H "Authorization: Bearer ${HUMANITEC_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "delta_id": "'${DELTA_ID}'",
  "message": "'${COMMENT}'"
}'

Where the following environment variables are set:

Variable Example Description
HUMANITEC_TOKEN lsakdjhcals A Humanitec token of a user with at least Manager role on the Organiztion.
HUMANITEC_ORG my-org The Humanitec organization the Application is in.
APP_ID my-app The ID of the Application.
ENV_ID my-env The ID of the Environment to be deployed to.
DELTA_ID ffbbf5198e4 The ID of the Delta to deploy.
COMMENT Added DNS An comment to be included with the deployment.

This action cannot be performed via Terraform as it involves creating ephemeral objects.

Rollback

Rebasing to a previous Deployment in the current Environment and then Deploying without additional changes will execute a rollback to the previous Deployment state.

  1. From the Applications overview , select your Application and Environment.
  2. Select Redeploy on the Deployment you want to roll back to.
    1. Enter a comment to be included with the deployment.
    2. Select Re-deploy to confirm.

Use the humctl deploy command to deploy a previous deployment.

humctl deploy deploy $DEPLOY_ID --comment="${COMMENT}"

Where the following environment variables are set:

Variable Example Description
DEPLOY_ID 17bfbbf98e4 The ID of the Deployment to roll back to.
COMMENT Rollback DNS An comment to be included with the deployment.

You can use the index notation +n where n is the index of the previous deployment. For example, +1 would be the previous deployment, +2 would be the one before that etc.

More help can be found via humctl help deploy.

You can roll back a Deployment via the Rebase endpoint .

This action cannot be performed via Terraform as it involves creating ephemeral objects.

Comparing deployments

Being able to quickly see the difference between two Deployments is a great start when debugging a problem. From the difference, you can immediately see what changed and from that identify which elements to look into first in your attempt to figure out why things are not working.

  1. From the Applications overview , select your Application and Environment.
  2. Select Diff deploy on the Deployment you want to compare with the Active deployment.
    • This will open a new screen allowing you to select the deployments you want to compare. The diff will be shown in JSON or YAML below.
    • You can create a new Draft from the diff by clicking on Create draft from the diff and send it to one of your existing Environments.

You can compare Deployments via the CLI using the humctl diff command. E.g. to compare the most recent with the previous Deployment for Application my-app in the development Environment, use this command:

humctl diff sets --app my-app --env development deploy/. deploy/+1

Type humctl diff sets -h to see more examples.

API instructions coming soon.

Terraform instructions coming soon.

Top