---
title: "How To Set Up a Staging Environment on Heroku in 3 Easy Steps"
description: "Heroku pipelines let you put a staging app in front of production: disable auto-deploy on production, create a pipeline with a new staging app auto-deploying from GitHub, and optionally enable Review Apps per pull request."
url: "https://swe.quest/articles/how-to-set-up-a-staging-environment-on-heroku-in-3-easy-steps-5198bdb0f631816e"
canonical: "https://www.heroku.com/blog/how-to-set-up-staging-environment-3-easy-steps/"
source: "Heroku Engineering"
published: "2026-07-16"
difficulty: "medium"
kind: "How-to"
reading_minutes: 7
tags: ["deployment","ci-cd","cloud","postgres"]
---

# How To Set Up a Staging Environment on Heroku in 3 Easy Steps

A post on [Heroku Engineering](https://swe.quest/sources/heroku.md), published 2026-07-16, 7 min read, How-to. Original: [https://www.heroku.com/blog/how-to-set-up-staging-environment-3-easy-steps/](https://www.heroku.com/blog/how-to-set-up-staging-environment-3-easy-steps/)

## Summary

Heroku pipelines let you put a staging app in front of production: disable auto-deploy on production, create a pipeline with a new staging app auto-deploying from GitHub, and optionally enable Review Apps per pull request. Staging should be isolated per Twelve-Factor principles, with separate config vars and its own Postgres database. That database is either built from migrations via the release phase and app.json postdeploy scripts, or copied from production with the destructive pg:copy when the data is not sensitive. Promotion copies the already-compiled slug to production rather than rebuilding, so verified code runs unchanged and rollbacks are fast, though database migrations must be rolled back separately.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Deployment](https://swe.quest/tags/deployment.md) (Reliability & operations)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)

## Prerequisites

- Heroku apps and CLI ([easy posts on Developer tools](https://swe.quest/tags/developer-tools.md?difficulty=easy))
- Git and GitHub workflows
- Environment variables

## Keywords

Heroku, Heroku Pipelines, Review Apps, Twelve-Factor App, Heroku Postgres, DORA

## Related posts

- [Migrate a Rails App from Heroku to Render](https://swe.quest/articles/migrate-a-rails-app-from-heroku-to-render-a8a375d8766a19ae.md): Render · 2022-05-23 · Medium · 8 min read · Ruby, Infrastructure as code, Deployment, Cloud platforms
  Migrating the open-source git-scm.org Rails app from Heroku to Render means mapping Heroku concepts (web/worker processes, dynos, Heroku Postgres/Redis, Scheduler, config vars) to Render equivalents and codifying the whole stack in a render.yaml Blueprint.
- [Migrate a Django App from Heroku to Render (and get it ready for prod)](https://swe.quest/articles/migrate-a-django-app-from-heroku-to-render-and-get-it-ready-for-prod-9f68854dd66c351a.md): Render · 2022-06-27 · Medium · 18 min read · Infrastructure as code, Deployment, Python, Cloud platforms
  A Django e-commerce app (Saleor) can be moved from Heroku to Render by translating its app.json, Procfile, Dockerfiles and docker-compose.yml into a single render.yaml Blueprint.
- [Heroku Postgres Upgrade Guide: Simplify Your Move to Version 17](https://swe.quest/articles/heroku-postgres-upgrade-guide-simplify-your-move-to-version-17-1677ccc4fe1d5c64.md): Heroku Engineering · 2025-05-29 · Medium · 7 min read · PostgreSQL, Schema migrations, Cloud platforms
  Postgres 17 is now available on Heroku Postgres, along with five new \`heroku pg:upgrade:\*\` CLI subcommands (prepare, run, cancel, dryrun, wait) that expose Heroku's internal upgrade automation for self-service major-version upgrades.
- [A database for every preview environment using Neon, GitHub Actions, and Vercel](https://swe.quest/articles/a-database-for-every-preview-environment-using-neon-github-actions-and-vercel-dd5fe24cba2d12b5.md): Neon · 2023-04-14 · Medium · 14 min read · PostgreSQL, CI/CD, Deployment, Schema migrations
  Neon's copy-on-write branching can give every pull request its own production-like Postgres database, avoiding the bottlenecks of shared staging or shared preview databases.
- [Migrating From Heroku To Railway](https://swe.quest/articles/migrating-from-heroku-to-railway-dbd89b10c75a9d07.md): Railway · 2022-08-19 · Medium · 7 min read · Deployment, Cloud platforms, Ruby
  Moving a Heroku app to Railway comes down to three steps: deploy from a GitHub repo, import Heroku config vars, and add Postgres and Redis as separate database services.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
