H
Hostess
CLI Commands

hostess environments

Create, list, update, and delete Hostess project environments from the CLI.

Description

Manage a project's environments — production, preview, staging, or any custom stage. The environments command group (alias envs) covers what's also available in Studio's Environments tab: creating environments, editing their branch mapping and TTL, viewing their live services, and deleting them.

environments resolves the project the same way domains and secrets do: --project/-p, falling back to the name field in hostess.yml.


environments list

List a project's environments.

Usage

Terminal
hostess environments list [flags]

Alias: hostess envs list (or hostess envs ls).

Flags

FlagShortTypeDefaultDescription
--project-pstringFrom hostess.ymlProject name
--tokenstringAuth token

Examples

Terminal
hostess environments list
NAME                 TYPE         BRANCHES                     TTL                        PROTECTED
production           production   main                         —                          yes
preview              ephemeral    feature/*, fix/*             24h (auto-delete)          no
staging              standard     —                            —                          no

TYPE is production for the reserved production environment, ephemeral for preview-style environments, and standard otherwise. TTL shows (auto-delete) next to the duration when auto-delete is enabled.


environments create

Create a new environment.

Usage

Terminal
hostess environments create <name> [flags]

Flags

FlagTypeDefaultDescription
--branchesstring[]noneBranch patterns this environment tracks (comma-separated or repeatable)
--ephemeralboolfalseMark this environment as ephemeral (e.g. per-PR previews)
--ttlstringnoneTime-to-live for ephemeral resources (e.g. 24h)
--auto-deleteboolfalseAutomatically delete this environment when its TTL expires
--protectedboolfalseProtect this environment's branches
--projectstringFrom hostess.ymlProject name
--tokenstringAuth token

Examples

Terminal
# A standard environment tied to a branch
hostess environments create staging --branches main,release/*
Environment 'staging' created.

NAME                 TYPE         BRANCHES                     TTL                        PROTECTED
staging              standard     main, release/*              —                          no
Terminal
# An ephemeral preview environment
hostess environments create pr-preview --ephemeral --ttl 24h --auto-delete

# Protect a branch-mapped environment
hostess environments create qa --branches release/* --branches hotfix/* --protected

environments ensure

Idempotently create an environment if it does not exist.

Usage

Terminal
hostess environments ensure <name> [flags]

Flags

FlagTypeDefaultDescription
--branchesstring[]noneBranch patterns this environment tracks (comma-separated or repeatable)
--ephemeralboolfalseMark this environment as ephemeral (e.g. per-PR previews)
--ttlstringnoneTime-to-live for ephemeral resources (e.g. 24h)
--auto-deleteboolfalseAutomatically delete this environment when its TTL expires
--protectedboolfalseProtect this environment's branches
--projectstringFrom hostess.ymlProject name
--tokenstringAuth token

Examples

Terminal
hostess environments ensure staging
Terminal
hostess environments ensure preview --branches='*' --ephemeral --ttl=24h --auto-delete

environments update

Update an existing environment. Only the flags you pass are changed — anything unset is left as-is.

Usage

Terminal
hostess environments update <name> [flags]

Accepts the same flags as environments create.

Examples

Terminal
# Extend the TTL
hostess environments update staging --ttl 72h
Environment 'staging' updated.

NAME                 TYPE         BRANCHES                     TTL                        PROTECTED
staging              standard     main, release/*              72h                        no
Terminal
# Turn off auto-delete and protect the environment
hostess environments update staging --auto-delete=false --protected

At least one of --branches, --ephemeral, --ttl, --auto-delete, or --protected is required.


environments delete

Delete an environment.

Usage

Terminal
hostess environments delete <name> [flags]

Aliases: hostess environments rm, hostess environments remove.

Flags

FlagTypeDefaultDescription
--yesboolfalseSkip the confirmation prompt
--projectstringFrom hostess.ymlProject name
--tokenstringAuth token

Examples

Terminal
hostess environments delete staging
This will permanently delete environment 'staging', its secrets, and its deployment history, and tear down its running services. Continue? [y/N]
Terminal
# Skip the confirmation prompt (CI)
hostess environments delete staging --yes

Deleting an environment permanently removes the environment, its secrets, deployment history, and running services. The production environment can't be deleted.


environments services

Show the live services currently running in an environment.

Usage

Terminal
hostess environments services <name> [flags]

Flags

FlagShortTypeDefaultDescription
--project-pstringFrom hostess.ymlProject name
--tokenstringAuth token

Examples

Terminal
hostess environments services production
SERVICE              STATUS         SHA        AGE      URL
web                  Running        abc1234    1h       https://web.example.hostess.run
worker               Failed         —          1h       —

This reflects what's actually running in the environment right now, not a single deployment's snapshot — services can be on different deployments if they were updated at different times (e.g. with hostess deploy -s).


hostess environments | Hostess Docs