Skip to main content

Application Deployment

Placing applications based on labels

Built in labels

When you want to deploy an application in a named site, match using the builtin label system/name. For example:

name: theater-room-manager-deployment
application: theater-room-manager
placement:
match-site-labels: >
system/name = stockholm-sergel

If you want to deploy an application on all edge sites, match using the builtin label system/type, which will be set to edge on all edge sites.

name: theater-room-manager-deployment
application: theater-room-manager
placement:
match-site-labels: >
system/type = edge

Custom labels

If you want to deploy an application on all sites that have the label city set to the value stockholm, then use:

name: theater-room-manager-deployment
application: theater-room-manager
placement:
match-site-labels: >
city = stockholm

Note that the match is case sensitive.

Rolling deployments

By default, the application is deployed to all selected sites at the same time. In order to do a rolling deployment to two sites at the time, and wait 10 minutes between each batch of sites before continuing:

supctl create application-deployments <<EOF
name: theater-room-manager-deployment
application: theater-room-manager
placement:
match-site-labels: >
system/type = edge
deploy-to-sites:
sites-in-parallel: 2
healthy-time: 10m
EOF

You can monitor the progress of the deployment by doing:

supctl show application-deployments theater-room-manager-deployment

The output is similar to the following:

name: theater-room-manager-deployment
application: theater-room-manager
application-version: *
placement:
match-site-labels: |
system/type = edge
deploy-to-sites:
sites-in-parallel: 2
healthy-time: 10m
status:
oper-status: deploying
wait-healthy-timeout: 7m18s
images:
- name: avassa-public/movie-theaters-demo/projector-operations:v2.0
status: present
digest: sha256:d42e0fbedb0c83d50bb6
- name: avassa-public/movie-theaters-demo/digital-assets-manager:v1.0
status: present
digest: sha256:cd9f8edadf866a2013a2
- name: avassa-public/movie-theaters-demo/curtain-controller:v1.0
status: present
digest: sha256:cd9f8edadf866a2013a2
selected-sites:
- gothenburg-bergakungen
- helsingborg-roda-kvarn
- stockholm-sergel
- stockholm-sture
applications:
- version: "1.1"
deployed-to:
- gothenburg-bergakungen
- stockholm-sture

Canary deployments

Sometimes it is useful to do a canary deployment, i.e., deploy to a few selected sites first, and only if they are successful, continue with the rest. To do this, you must first set a label on the sites you want to use for canary deployment. In the example below, we use all sites with the label city = stockholm as canary sites, and we wait 15 minutes before continuing with a rolling deployment of the rest, four sites at the time.

supctl create application-deployments <<EOF
name: theater-room-manager-deployment
application: theater-room-manager
placement:
match-site-labels: >
system/type = edge
deploy-to-sites:
canary-sites:
match-site-labels:
city = stockholm
canary-healthy-time: 15m
sites-in-parallel: 4
healthy-time: 5m
EOF

You can monitor the progress of the deployment by doing:

supctl show application-deployments theater-room-manager-deployment
name: theater-room-manager-deployment
application: theater-room-manager
application-version: *
placement:
match-site-labels: |
system/type = edge
deploy-to-sites:
canary-sites:
match-site-labels: city = stockholm
canary-healthy-time: 15m
sites-in-parallel: 4
healthy-time: 5m
status:
oper-status: deploying
wait-healthy-timeout: 14m39s
images:
- name: avassa-public/movie-theaters-demo/projector-operations:v2.0
status: present
digest: sha256:d42e0fbedb0c83d50bb6
- name: avassa-public/movie-theaters-demo/digital-assets-manager:v1.0
status: present
digest: sha256:cd9f8edadf866a2013a2
- name: avassa-public/movie-theaters-demo/curtain-controller:v1.0
status: present
digest: sha256:cd9f8edadf866a2013a2
selected-sites:
- gothenburg-bergakungen
- helsingborg-roda-kvarn
- stockholm-sergel
- stockholm-sture
applications:
- version: "1.1"
deployed-to:
- stockholm-sergel
- stockholm-sture

Pausing and resuming a deployment

If you want to hold an ongoing canary or rolling deployment, for example to investigate the sites that already got the new version, pause it:

supctl do application-deployments theater-room-manager-deployment pause

The sites that are currently being deployed to complete as usual, but no further sites are deployed to. The deployment reports this as:

supctl show application-deployments theater-room-manager-deployment \
--fields status/[oper-status,deploying-status,deployment-stage]
status:
oper-status: deploying
deploying-status: paused
deployment-stage: rolling

To continue:

supctl do application-deployments theater-room-manager-deployment resume

This returns the deployment to whatever it was waiting for when it was paused, i.e., the remaining healthy time, or the canary-continue operation. To continue with the next set of sites right away instead, skip the remaining wait:

supctl do application-deployments theater-room-manager-deployment resume \
--continue-immediately

Note that a pause is cleared whenever a new deployment is started, such as when a new application version is deployed, when the application deployment is changed, or when a redeploy is invoked.

If the deployment turned out to be a bad one, roll back instead of resuming, by changing application-version to the previous version as described in deployment failures.

Adding sites to a deployment

If new sites are added that match the application deployment's placement site label expression, the application can be deployed to the new sites by doing a redeploy:

supctl do application-deployments theater-room-manager-deployment redeploy