Handling multiple Heroku accounts from one local app
I have recently started work on an application that is already deployed to production. I'v开发者_如何学编程e done a full checkout from production and have got the app up and running locally. The problem I face now is handling the production repo and my test heroku repo.
At the moment, I'd like to be able to checkout the db (using heroku db:pull) from production and do a build to my test heroku app. This is very cumbersome and I'm nervous that I'll accidently commit test code to the production server.
Is there an elegant solution to handle such a scenario? Is there a command I can run to see which app my local environment is currently sync'd with?
Thanks, gearoid.
Heroku is just a remote git repository so git remote
will show you the remotes for your project - there's a verbose option git remove -v
too that will show the URLs of the remotes.
Once you'll pulled the production code you'll then need to push that to the testing heroku app with something like git push myapp-test mytestbranch:master
assuming you've setup a remote named myapp-test pointing to your test app on heroku.
There's a gem called 'heroku_san' that provides similar command lines to capistrano, eg rake production deploy, rake staging deploy that make commands a bit more explicit.
In short though, just be very careful and double check the push commands - especially heroku db:push (note, you'll need to specify --app myapp-test to target your test application!) - the CLI does give you warnings but trust me, it's easy to get it wrong ;). If in doubt, double and triple check!
精彩评论