Introducing Heroku Fork
June 27, 2013 by Shanley Kane
An application is more than source code - it’s executables, generated assets, runtime environments, dependencies, configuration, running processes, backing services and more. What if you could fork your entire app, not just your code?
heroku fork lets you create unique, running instances of existing applications right from the command line. These instances are live and available on Heroku immediately so you can change, scale and share them however you want.
How It Works
$ heroku fork -a sourceapp targetapp
- Copies the source app's precompiled slug.
- Copies the source app's config vars, excluding add-on-specific environment variables.
- Re-provisions the source app's add-ons with the same plan. Note that if you are using paid add-ons, you will be charged for their usage in the new app.
- Copies the source app's Heroku Postgres data, if present.
- Scales the web process of the new app to one dyno, regardless of the number of web processes running on the source app. This ensures you don’t pay for scale you may not need.
For more on the specific behaviors and limitations of
heroku fork, please see the Dev Center article.
Today’s Use Cases
Demonstrable Pull Requests
The common practice for evaluating pull requests is cumbersome at best: submitters provide a screenshot (or animated gif) to illustrate the proposed change, or a maintainer pulls down the remote branch and previews the change locally. Using
heroku fork, pull requests can be accompanied by the URL of a live fork of the app that demonstrates a real, interactive version of the new feature.
Quick Setup of Multiple Environments
Keeping development, staging, production and other environments as similar as possible provides the foundation for a healthy workflow. Using
heroku fork you can quickly spin up new, homogeneous application environments for other stages of development. You may even want additional environments outside of the standard development/staging/production workflow -
heroku fork provides a simple way to spin up more ephemeral environments to play with, modify or dispose of as desired.
Migration to EU region
We recently launched Heroku Europe.
heroku fork can be used to migrate your application to the Europe region:
$ heroku fork -a sourceapp targetapp --region eu
After verifying add-on provisioning and config vars in the new application, you can take steps to complete migration, such as migrating any production data not stored in Heroku Postgres and adjusting DNS settings.
Future of Fork
We want to empower teams to work faster and smarter: test new features, carry out experiments, and evolve rapidly. We think
heroku fork provides the foundation for these things and more. We’d love to hear what you think of it and how you're using it. Email us.