Conductive instance on Heroku

I would like to use the code for dev.myapp.com for testing, and then for www.myapp.com for use in production. Is this possible with Heroku?

+84
deployment heroku staging
Aug 14 '09 at 19:38
source share
5 answers

Your interface to Heroku is essentially a Git branch. Heroku Pearl does some work through its API, but in your Git repository it's just a new remote branch.

 heroku create yourapp # production git br -D heroku # delete the default branch heroku create staging-yourapp # staging git br -D heroku # delete the default branch 

After you have configured several applications on Heroku, you can configure the Git repository as follows:

 git remote add staging git@heroku.com:staging-yourapp.git git push origin staging git remote add production git@heroku.com:yourapp.git git push origin production 

Usually I work in a "working" branch and use Github for my host.

Assuming the case is for you, your deployment workflow will probably look something like this:

 git co -b working # do some work # push to github: git co master git merge working git push # push to staging: git co staging git merge master git push origin staging # push to production git co production git merge master git push origin production 
+142
Aug 21 '09 at 20:44
source share

This explains everything you need to know if your newbie is like me: http://devcenter.heroku.com/articles/multiple-environments

+19
Jan 05 '12 at 4:45
source share

A key part of the original question is the linking of the middleware application to the subdomain (dev.myapp.com) of the main application (www.myapp.com). This was not considered in any of the answers.

Step 1: Configure both versions ('myapp') and the intermediate version ('staging-myapp') of your application, as indicated by Luc Bayes

Step 2. On your domain management system (for example, GoDaddy):

 Create a CNAME record: dev.myapp.com that points to: proxy.heroku.com 

Step 3: Configure Heroku to route dev.myapp.com to staging-myapp:

 heroku domains:add dev.myapp.com --app staging-myapp 

After the CNAME record has spread, you can launch your middleware at dev.myapp.com.

+9
May 01 '12 at 7:35 a.m.
source share

You must check heroku_san

This is a pretty good job manipulating environments on a hero.

+8
Dec 29 '10 at 13:08
source share

Now everything is easier. Here's how you do it ...

Create an app for every environment.

 $ heroku create myapp --remote production $ heroku create myapp-staging --remote staging 

This will create named remote repositories for each application, which you can see in .git/config .

Now you can use either - the application or - remote switches to target a specific application:

 $ heroku info --app myapp-staging $ heroku info --remote staging 

Install Rails Environments

For Rails applications, Heroku uses a production environment by default . If you want your middleware to run in the middleware, create an environment in your project and set the appropriate RAILS_ENV and RAKE_ENV environment variables in the application:

 $ heroku config:set RACK_ENV=staging RAILS_ENV=staging --remote staging 

Customize environments

If you have other configuration variables, you need to pass them to each environment as well.

 $ heroku config:set AWS_KEY=abc --remote staging $ heroku config:set AWD_SECRET=123 --remote staging ...etc 

This is a huge pain, although I just use my snappconfig stone and run

 $ rake heroku:config:load[myapp-staging] 

to load the YAML project configuration files into Heroku.

Deploy

Now you just click on Heroku as follows:

 $ git push staging master $ git push production master 

and migrate as follows:

 $ heroku run rake db:migrate --remote staging $ heroku run rake db:migrate --remote production 



(See Managing Multiple Environments for the Application. Heroku Dev Center for more information and shortcuts.)

+5
Sep 27 '13 at 13:46
source share



All Articles