Search code examples
githerokustaging

Trying to set up a heroku staging site - "Resource not found "


I'm working on an existing rails project which is deployed on heroku. I'm trying to set up a staging server which deploys from the staging branch. (currently master deploys to production).

I'm following this page http://devcenter.heroku.com/articles/multiple-environments#starting_with_a_production_app

and i'm on the section "Starting from a production app". The code it gives is

heroku create --stack [production stack] --remote staging --addons newrelic:bronze,logging:expanded

I'm trying to adapt this to my own needs but i get a message back Resource not found.

Here's what i get for "heroku apps"

custom_domains:basic
exceptional:basic
logging:expanded
shared-database:5mb

If i do heroku list i get this

buddystef                 <project manager's email>
vivid-window-286
vivid-earth-537

where 'buddystef' is the production version of the app. So, i'm trying this:

heroku create --stack [buddystef stack] --remote buddy-staging --addons custom_domains:basic,exceptional:basic,logging:expanded,shared-database:5mb

And i'm getting Resource not found

Do i need to set up a seperate git repo first for the staging branch? If so, what's the best way to do this?

Grateful for any advice - max

EDIT - the "Resource not found" message seems (after googling) to be associated with logging in with the wrong credentials. But, i'm logging in as the owner of the buddystef project.


Solution

  • Seems like your over-complicating things here, Max. Keep it simple, create the app like John suggests, add the addons, then declare it a staging environment:

    heroku config:add RACK_ENV=staging --app stagingbuddystef
    

    create the environments/staging.rb similar to that of production.rb

    If it's a public site, you'd probably wish to secure it from public access, avoid confusing users. See this SO answer for password protecting staging environment

    Git : You should have your own staging branch. Remember that heroku operates on master branch, so you should do this:

    myproj git:(staging)$ git push stagingbuddystef staging:master 
    

    Read more about git good practices here: http://nvie.com/posts/a-successful-git-branching-model/