Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.
/ heroku-surrogate Public archive

Run commands locally using a Heroku app's environment variables

License

Notifications You must be signed in to change notification settings

tpope/heroku-surrogate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Heroku surrogate

The heroku surrogate command pulls down the environment variables for a Heroku application, merges them into the local environment, and spawns a process. Here's a Rails specific example:

heroku surrogate rake db:migrate:up VERSION=20130228193803

This runs the migration locally, but connected to the DATABASE_URL specified by the server. This is great for sneaking a nondestructive migration out before the actual deploy, thus minimizing downtime.

The fun doesn't stop there. You can pass in a process type from your Procfile or any arbitrary command. Spin up a console. Spin up a worker. Heck, spin up a web server if you want.

heroku surrogate console
heroku surrogate worker
heroku surrogate PORT=3000 web

The --release option lets you use the environment and process types from an earlier release.

heroku surrogate --release=v123 env

Note that you're using development code against production resources. If you'd rather be running production code as well, pass --checkout, and the appropriate commit (respecting --release if given) will be checked out before executing.

heroku surrogate --checkout foreman start

Installation

heroku plugins:install https://github.com/tpope/heroku-surrogate.git

About

Run commands locally using a Heroku app's environment variables

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages