Preview Environments
Deploy and operate preview-style environments explicitly in Hostess v1.
Preview environments are useful for reviewing changes before production. In Hostess v1, preview deployment automation is driven outside hostess.yml: use explicit CLI targets such as hostess deploy --env preview, or use your CI provider's branch and pull request filters.
Deploy to Preview
Choose the target environment
Use the CLI to deploy to the existing preview environment:
hostess deploy --env previewNew projects are provisioned with production and preview environments. If you target a custom environment such as staging or qa, create it first with hostess environments create staging or in Studio's Environments tab.
If you omit --env, the CLI uses the first environment returned by the API, which is usually the most recently created environment. On a standard new project that is often preview, but scripts and CI should always pass --env explicitly.
Use CI branch filters
In GitHub Actions, branch or pull request filters belong in the workflow, not in hostess.yml:
name: Deploy Preview
on:
pull_request:
branches:
- main
jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: howl-cloud/setup-hostess@v1
- run: hostess deploy --env preview --no-interactive
env:
HOSTESS_TOKEN: ${{ secrets.HOSTESS_TOKEN }}Keep preview state disposable when appropriate
Preview environments should use their own data and credentials. Do not restore production data into preview unless you have a deliberate test plan and have removed sensitive records.
Redis is temporary by default. Set retention: permanent only when the preview queue, session, or cache data must survive redeploys:
services:
cache:
type: redis
retention: ephemeralFor custom services that write to disk, omit persistence and retention: permanent unless the preview service needs durable files.
Per-Environment Secrets
Preview environments often need different secrets than production:
hostess secrets add STRIPE_KEY --envs production --value sk_live_abc123
hostess secrets add STRIPE_KEY --envs preview --value sk_test_xyz789This prevents preview deployments from using production credentials.
Domains
Preview environments usually use autogenerated Hostess URLs. If a long-lived preview or staging target needs a custom domain, configure only the domains field under that environment:
environments:
preview:
domains:
frontend: [preview.myapp.com]
services:
frontend:
type: nextjs
build:
source: ./frontendService-level domains are shorthand for production. Use environments.<env>.domains for preview, staging, or any other non-production hostname.
Operational Notes
- Use
--env previewexplicitly in scripts and CI. - Use CI workflow filters to decide which branches or pull requests deploy.
- Keep preview data separate from production data.
- Use service-level
retentionandpersistenceonly where the service type supports them and the preview state needs to survive redeploys. - Use
hostess secrets add --envsorhostess secrets edit --envsto keep preview credentials separate.