Deploying Rails Apps to heroku from multiple PC - ruby-on-rails

I am Rails newbie and learning to build rails apps. First time I deploy from my home PC and then everything just fine, then I want to work on the apps and deploy from my laptop and work PC, but it turn out I cannot deploy my update code. Every time I push to github work fine, but when I want to push to heroku it didn't deploy my code. I opened my heroku apps, and it's obviously out-dated
$ git push
Counting objects: 26, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (14/14), 1.22 KiB, done.
Total 14 (delta 9), reused 0 (delta 0)
To git#github.com:myprofile/myapp.git
bb15762..94d0674 master -> master
$ git push heroku master
Everything up-to-date
I use Linux on virtualBox and I clone it for each PC, so all has identical ID and MAC I believe. I did all necessary git remote add heroku and in the end heroku just ignore my update code and never rerun the build.
I tried to run this command $ heroku rollback $ heroku restart --app MyApp as well in order to get my update code push to heroku still did't work either. When I run $ heroku info --app MyApp it give all my app info
=== my-app
Addons: heroku-postgresql:dev
Git URL: git#heroku.com:my-app.git
Owner Email: myemail#gmail.com
Repo Size: 13M
Slug Size: 17M
Stack: cedar
Web URL: http://my-app.herokuapp.com/
I just wonder what happen and only using my Home PC to push to heroku is kind of annoying for me because I need to work on it anywhare if that possible. Thank you for the all future answers!
When I call this command git remote -v it gives me these:
all git#github.com:myprofile/my-aap.git (fetch)
all git#github.com:myprofile/my-aap.git (push)
github git#github.com:myprofile/my-aap.git (fetch)
github git#github.com:myprofile/my-aap.git (push)
heroku git#github.com:myprofile/my-aap.git (fetch)
heroku git#github.com:myprofile/my-aap.git (push)
origin git#github.com:myprofile/my-aap.git (fetch)
origin git#github.com:myprofile/my-aap.git (push)

I resolved this issue. #phoet - Thank you for the hints. I was adding wrong remote master to heroku that is the reason why my push didn't go through.
So I remove all the existing remote and adding again. Now everything works with little adjustment.

Related

Heroku Problems: Not able to deploy app for some reason

I am trying to deploy a basic app from Github to Heroku.
Following directions from Heroku's guide
Here's the thing. When I clone from the github repository, I clone a specific branch that's 8 commits ahead of master.
The reason why I clone that specific branch is that it's the most advanced on. Each branch is built upon the previous branch.
I don't want to merge that branch into the master because I don't know how to undo that.
By the time I try to do this step from the guide above: heroku ps:scale web=1, I always get this: Scaling dynos... failed
! App must be deployed before dynos can be scaled.
Why does this happen? Advice?
Please let me know if this question needs further clarification. Thank you.
EDIT
For the record, it has the Procfile which has this in it: web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
EDIT 2
When I do git push heroku branch_name - this is what I get:
Delta compression using up to 4 threads.
Compressing objects: 100% (243/243), done.
Writing objects: 100% (389/389), 727.55 KiB | 0 bytes/s, done.
Total 389 (delta 111), reused 389 (delta 111)
remote: Pushed to non-master branch, skipping build.
EDIT 3
I followed the first answer from this thread.
It worked, and restarted the app in Heroku.
But I restarted it again with this line: heroku restart --app name_of_app_in_heroku and got this: Restarting dynos... done
Then I tried to do heroku open --app name_of_app_in_heroku, and all I get is the basic welcome page. How do I overcome this?
Also, I just looked at my Heroku's dashboard, and checked the app, and it says it has no dynos. How is that possible?
EDIT 4
Also, I just ran this command: heroku pg:info and got this answer: name_of_app_in_heroku has no heroku-postgresql databases.
But that shouldn't be, I can see the DB's URL in the app's config vars in the settings of the app's dashboard.
It sounds like the app's never been deployed (because you're trying to deploy non master branch and heroku has been ignoring the pushes)
When you push to heroku, the name for the branch needs to be master on the heroku side.
By default git push keeps the same name for both sides:
git push heroku some_branch
Tries to (assuming upstream is setup appropriately etc) update a branch called "some_branch" on the heroku remote, with your local branch of the same name.
To use a different name you'd do
git push heroku some_branch:master
Which means push the changes from the branch called some_branch locally to heroku's master branch
When you deploy your app try doing this
gp heroku master -f
heroku run rake db:migrate --app APPNAME
heroku restart --app APPNAME
heroku open --app APPNAME
This are the lines that I use when I deploy a project to Heroku

Fatal: Heroku repository does not exist

I renamed my Heroku app from their goofy name to something more reasonable. I never imagined that it would cause me trouble here. just now I tried the following
git remote -v
heroku http://appname.herokuapp.com (fetch)
heroku http://appname.herokuapp.com (push)
origin git#github.com:MyAccount/games.git (fetch)
origin git#github.com:MyAccount/games.git (push)
I thought I had it won there. but then I tried
git push heroku master
and then i got this message
fatal: repository 'http://appname.herokuapp.com/' not found
I don't understand why it won't push
You need to change your heroku remote to match the new name for your app.
Do on the command line
git remote remove heroku
git remote add heroku git#heroku.com:YOUR_APP_NAME.git
Let me know if that doesn't fix it

Trouble re(deploying) to heroku

I had trouble re-deploying the sample app from Hartls book:
! No such app as murmuring-beyond-6630.
So then I logged into Heroku, deleted the app and created another...
fatal: The remote end hung up unexpectedly
yuliya#ubuntu:~/rails_projects/sample_app$ heroku create
Creating cryptic-plains-9409... done, stack is cedar
http://cryptic-plains-9409.herokuapp.com/ | git#heroku.com:cryptic-plains-9409.git
yuliya#ubuntu:~/rails_projects/sample_app$ heroku keys:add
Found existing public key: /home/yuliya/.ssh/yuliya.pub
Uploading SSH public key /home/yuliya/.ssh/yuliya.pub... done
yuliya#ubuntu:~/rails_projects/sample_app$ git push heroku master
! No such app as murmuring-beyond-6630.
Still referenced previous app so I removed it using the git rm heroku command. Then I ran heroku create. Then tried to push the app again...
yuliya#ubuntu:~/rails_projects/sample_app$ git remote add heroku git#heroku.com:cryptic-plains-9409
yuliya#ubuntu:~/rails_projects/sample_app$ git push heroku master
! Invalid path.
! Syntax is: git#heroku.com:<app>.git where <app> is your app's name.
I am completely stuck and would appreciate any help here. I am brand new to this, and thank you for your time!
I believe you left off the .git, which is what the error is complaining about.
Try this,
git remote set-url heroku git#heroku.com:cryptic-plains-9409.git
git push heroku master
Referenced this question:
How does "git push heroku master" know where to push to and how to push to a different repo?

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

Heroku push rejected, no Cedar-supported app detected

I'm creating a Rails app with Rails 3.1.3:
git init
git remote add heroku <my heroku repo>
git add .
git commit -a -m "First commit"
git push heroku master
Got:
Counting objects: 102, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (86/86), done.
Writing objects: 100% (102/102), 315.47 KiB, done.
Total 102 (delta 3), reused 0 (delta 0)
**-----> Heroku receiving push
! Heroku push rejected, no Cedar-supported app detected**
To git#heroku.com:electric-dusk-3217.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to <my heroku rep>
I had a similar problem, but with Django (incorrectly named "requirements.txt"). I think to generalize the other answers here, when you get this error it's because Heroku is missing some key file that it uses to identify your app (and its type).
php: index.php
python: requirements.txt
ruby: Gemfile # note the capitalization
node: package.json
The problem was that my "Gemfile" was named "gemfile"
I ran into this error message, but my problem was that my rails app was not in the root directory of my git repo. After I moved the files into the root dir, everything worked.
Heroku detects a supported app by looking for specific project files. To find the requirements for your language, start here.
For Node.js, you need a package.json.
For Python applications you need a requirements.txt.
etc.
Not associated with a new app, but... I ran into this same error message after installing a custom BUILDPACK on heroku and then forgetting about it. The next time I went to deploy to heroku I saw:
-----> Fetching custom git buildpack... done
! Push rejected, no Cedar-supported app detected
The fix was to check:
heroku config
And, there, I found a Var called BUILDPACK_URL which I had to unset with:
heroku config:unset BUILDPACK_URL
... and voila!
Another cause: I was pushing master, while working on a non-master branch. My master branch didn't have requirements.txt.
I didn't want to push from master, but heroku only pays attention to the master branch. The solution was to push my local branch to heroku's master branch:
git push heroku local_branch:master
Another cause of this error for Rails apps: we had this deploy error occur when we hadn't removed a git merge conflict from our Gemfile.lock file.
I had the same issue. "Gemfile" was included in ".gitignore" and has therefore not been part of the deployment. Heroku requires Gemfile for Rails projects.
I fixed this by making a superficial change to my Gemfile and recommitting. For some reason it wasn't included in my last commit.
I met the same problem here.
My check as follow:
1. Make sure "foreman start" works well locally.
2. Make sure only one new app create on your heroku account.
Hope it help.
I was following the RailsTutorial.org steps and this error showed up. None of the answers on this post worked. Then I saw this comment that led to this answer which was the only thing that worked for me so that might solve other people's problems with the tutorial as well.
When this problem appears with the project based on static files (only html, css and js) it is recommended to follow this guidlines:
https://discussion.heroku.com/t/push-rejected-no-cedar-supported-app-detected/640/3
I also had the problem with django based app. Everything seemed to be ok: file names and other settings.
The problem was that in heroku console there was a BUILDPACK_URL setting defined for node.js - thus django application was rejected.

Resources