How to set up an additional server in Heroku? - ruby-on-rails

I want to set up a new Heroku server for QA purposes.
I've done most of the pieces but I've missed something:
1) I made a new app using the CLI Heroku toolbelt:
heroku apps:create myapp-qa
2) I made a copy of the existing git repostory on my local machine:
git clone git#github.com:me/myapp.git
3) Added the remote for the aq server:
git remote add myapp-qa git#github.com:myrepo/myapp.git
3) I then tried to push my new app with:
cd myapp
git push myapp-qa master
I got the message "already up-to-date"
4) If I go to the app in a browser to http://myapp-qa.herokuapp.com/ it says "Heroku | Welcome to your new app!" instead of showing any of my application pages.
What did I miss?

Heroku has a plugin specifically designed for this.
https://github.com/heroku/heroku-pipeline
It allows you to specify a "pipeline" of servers
Dev -> Staging -> Production and allows you to deploy to dev, then promote that build to staging, then promote that to production.

Setup needed to be:
git remote add myapp-qa git#heroku.com:myapp-qa.git
git push origin myapp-qa

Related

Error pushing to Heroku after adding new domain

I recently added a new GoDaddy domain to my rails app.
Everything works fine when I push to git but when I try to push to Heroku using:
$ git push heroku
I get the following error:
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository
Please make sure you have the correct access rights and the repository exists.
Is this problem occurring because I need to create another environment? The domain name for my GoDaddy website is listed under '$ heroku domains' but doesn't seem to be connected.
Any ideas would be helpful. TIA!
As for your comment on answer below, its obvious that you should try
git push prod master instead of git push heroku
'heroku' and 'prod' it's just names of remote repositories. Heroku by default creates repos named accordingly - 'heroku'. As far as I know it could be changed to whatever you need
This issue is probably unrelated to godaddy. Try typing
git remote -v
this will give you a list of the remote repositories you have setup. If none are pointing to your app on heroku you'll need to set it up.
Refer to this on article from heroku dev center
https://devcenter.heroku.com/articles/git
EDIT
As i suspected your heroku remote is named "prod" not "heroku" try 'git push prod' that should work.
You might have to specify the branch in which case the command would be 'git push prod master'
EDIT2
It looks your are not yet authorized to push to heroku. The root problem can vary. I recommend starting with this article:
https://devcenter.heroku.com/articles/keys
Also check this SO article
git push heroku master Write failed: Connection reset by peer

Heroku push to production

I set up my staging and production environments on heroku, and pushed to both and it worked fine. I came back a day later and was able to push to staging but got the following message about git push production master:
fatal: 'production' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
To confirm where each remote points to, login to Heroku and open the settings to your app and then match the git URL of the app to the ones displayed by git remote -v. Then, if necessary, add a remote for production (i.e. heroku).

How to use a heroku app that already exists

please help me,
when I want to upload an rails app to heroku I do this sequence and works creating a new project on heroku
git init
git add .
git commit -m "init"
heroku create
git push heroku master
and then I get a new url like http://-somethingdiferent-.herokuapp.com each time that I need to deploy an project
I dont know how to use that project later without creating other new heroku project
I was thinking to use something like pull of git, but I dont know how is the pull on heroku, maybe -git pull heroku master? but in that case, how can I pull the same project?
please I will like if you know the sequence or any tutorial?
thanks
Try to create an app first
# run this command from the app folder to create a new app
$ heroku open --app the-app-name
# Add it to the remote
$ heroku git:remote -a the-app-name
# push app to heroku
$ git push heroku master
the-app-name shall be replaced by the application name.
one can find more useful stuff here.

How to reset everything Heroku in my Git/Rails 3.1 Project

I solved my problem while writing this post, but I thought this might be good information for other noobs like me :)
To solve the problem below edit the following file
.git/config
There's a section that looks like this
[remote "heroku"]
url = git#heroku.com:adjective-noun-1234.git
fetch = +refs/heads/*:refs/remotes/heroku/*
This is what git tries to push to. Just change the line
url = git#heroku.com:adjective-noun-1234.git
to whatever new Heroku project you created. Git should now be able to push to Heroku again.
I have gotten my second Rails app ever to a working state and want to deploy it. So I followed all the steps for Heroku deployment in the Ruby on Rails Tutorial (I had the deployment working for the sample app from the book) using:
heroku create
I then push my project with
git push heroku master
The project doesn't work although I can't find any errors in the Heroku logs, all I get is:
We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it
shortly.
So I looked around the Heroku Support Section and found the official Rails 3.0 / 3.1 deployment guide:
http://devcenter.heroku.com/articles/rails3
http://devcenter.heroku.com/articles/rails31_heroku_cedar
I went to the Heroku Web Frontend > General Info > Destroy App because I wanted to continue my efforts with a clean slate.
Following the guide I created a Heroku project for the cedar stack:
heroku create --stack cedar
And push it to Heroku using
git push heroku master
THE PROBLEM: for some reason git is still trying to push to the old Heroku project!!!
resulting in an error
fatal: The remote end hung up unexpectedly
Check your remote repositories, and update it to the new heroku name:
git remote -v
Then remove the heroku one that is wrong:
git remote rm heroku
Then add the new one
git remote add heroku git#heroku.com:sitename.git
This is a bit extreme, but worked for me....
heroku destroy appname
heroku create
git push heroku master

Rails3 & Git & Heroku - development/staging server

I have a Rails 3 app I'm developing with a team using Git/Github and deploying to a Heroku cedar stack. Our Github respository has 2 main branches Master and Development.
I would like to push our Development branch regularly to a different server on Heroku as a development/staging environment.
What's the cleanest simplest way to push our Development branch to a different app than Master without disrupting our Git flow much?
Thanks a lot!
You'll want to add a second git remote i.e. your second application's heroku git repo url to your app to be able to push to that from a single codebase.
At the moment you probably have the default remote origin named 'heroku' which is pushing to your production application.
You'll want to add a second remote origin pointing at your new heroku app that you intend to use for staging, eg
git remote add staging <git repo url from 'my apps' page on heroku>
once you have the new git origin set up you can push to it via;
git push staging <branch to deploy>:master
Simple. Heroku always uses the master branch, but using Git will allow you to push /your/ development branch, to /their/ master
For instance:
git push heroku development:master
where heroku is your origin for your heroku development env, and development is your local development branch. You might also want to override the RACK_ENV var on Heroku too if you don't want your dev branch running in production mode (although, personally I would create a staging environment in your code which does caching etc, but not send email to production addresses etc)
heroku_san is a Gem which allows complex deploy configurations when using Heroku, without the need to constantly specify which Heroku app you wish to push to on the command line. It would allow you to do exactly what you describe above.

Resources