Skip to content
Stackship documentation Svenska

App ServiceUsers

Deployment slots

Run another branch of an app's repository next to the app, with its own hostname, settings, deployments and logs.

Requires: apps/write

A slot runs another branch of the app's repository as a workload of its own, next to the app — for a staging or test version, for example. It has its own hostname, status, deployments and logs, and is started, stopped and deployed on its own. Slots are for apps built from GitHub, GitLab or Azure DevOps. Adding and changing slots needs apps/write; deleting one needs apps/delete. The portal shows the slot buttons to everyone who can see the app, and the platform refuses what you may not do.

What a slot shares with the app

Shared with the app The slot's own
The repository and its deployment source The branch, and the commit it is on
Runtime stack and version Environment variables and build variables
Compute plan Startup project
Secret references — the slot's code reads /secrets/env.json too Hostname
Managed identity Deployment history and logs
Role assignments: roles on the app cover its slots A disk of its own when the app has persistent storage

A slot runs one instance. It takes the app's port and HTTPS settings as they are when the slot is created.

Caution

A slot runs the code on its branch with the app's secrets and managed identity. Anyone who can push to that branch, or create a slot, can run code that reads the app's secrets and acts as its identity. Build slots only from branches you trust as much as the app's own.

Add a slot

  1. Open the app and its Slots tab, and choose Create Slot.
  2. Slot Name — 2 to 12 characters: lowercase letters, digits and hyphens, starting and ending with a letter or digit, and not default. It is part of the slot's hostname and cannot be changed.
  3. Branch — the branch the slot builds, picked from the repository's branches.
  4. Start Project (Optional) — filled in with the app's; change it if the branch builds another .NET project.
  5. App Settings (Environment Variables) — one KEY=value per line, filled in with the app's settings. The slot gets exactly these — left empty, a copy of the app's — and does not follow later changes to the app's settings.
  6. Choose Create Slot.

The slot is built from the latest commit of its branch. It gets the hostname <app label>-<slot>.apps.example.com, where <app label> is the part of the app's generated hostname before the first dot; for an app on a domain of its own it is the app's name. The slot is refused when another resource in the cluster already uses that hostname — which for an app on a domain of its own can be a slot of an app with the same name in another resource group. See Hostnames already in use.

Pushes to the branch deploy the slot again — see Automatic deployments.

The slot starts with the app's build variables marked.

The slot page

Choose a slot on the Slots tab, or in the app list, to open its page. The header shows the app it belongs to and the slot's status, and has Browse, Deploy (Re-deploy while the slot runs), and Restart, Stop and Start, which work as they do for the app — see Deploy, start, stop and delete.

The tabs are Overview (name, branch, hostname, runtime, version, compute plan, start project and how the image runs), Configuration, Deployments, Logs, Access Control (the app's role assignments), Activity and Danger Zone.

Slot settings

The slot's Configuration tab has four sections. Saving Branch & Build, Environment Variables or Runtime builds and deploys the slot again.

  • Branch & Build — Git Branch, typed in, and Start Project. A new branch is built from its latest commit.
  • Environment Variables — the slot's settings and build variables, edited as for the app — see Environment variables. Copy from Parent App, shown when the app has settings, replaces them with the app's settings and build marks; when the slot already has settings, confirm with Copy and Replace. Then save.
  • Runtime — fields for the stack and version. A slot always runs on the app's stack and version: change them on the app. A change saved in the slot's Runtime section does not take effect.
  • Networking & Security — shows the slot's hostname, which cannot be changed; there is nothing to save.

Delete a slot

Use the delete button on the slot's row on the Slots tab and confirm with Delete Slot, or open the slot's Danger Zone and type its name. The slot's disk, when it has one, is kept until the app is deleted; a new slot with the same name gets it back.

With the CLI

bash
stsh apps slot get my-app staging -g my-resource-group
stsh apps slot action my-app staging restart -g my-resource-group
stsh apps slot logs my-app staging -g my-resource-group
stsh apps slot delete my-app staging -g my-resource-group

slot action takes start, stop or restart and returns once the platform has accepted it. slot delete asks you to confirm; --yes skips the question. Slots are created in the portal or through the API.