Rails Heroku starting Unicorn with Procfile - ruby-on-rails

I am trying to run a Rails app on Heroku using Unicorn.
I realized this morning that Heroku was starting Webrick instead of Unicorn.
I believe the problem was that the "Procfile" shows uppercase P on my iMac, but when I send to GIT it ends up lowercase. I fixed the case and sent it to Github. I view on Github and the case is correct.
Now my issue is I can't tell if Unicorn is running or not. How can I tell? What should I look for?
Thanks for the help!
PS -- Also, how can I tell for sure that the Git repository on Heroku has the Uppercase "Procfile"?

Type heroku ps -a <your_app_name> to see your running processes on Heroku. If you want to see the files you have on remote, either clone from Heroku remote or run heroku run bash -a <your_app_name> and then type ls.

Related

Unable to deploy rails test app to Heroku

I'm working through the odin project's web development course and I'm getting tripped up on the last part of the installations project where you are tasked with deploying a rails app to Heroku. I've been working on this for about a week but I refuse to give up but I realize that I need some help.
Here's the link to the tutorial I'm trying to work through (on a mac):
http://installfest.railsbridge.org/installfest/deploy_a_rails_app
I have a Heroku account set up, and am running Ruby 2.3.0 and rails 4.2.5.1. Rubygems are at 2.6.1 (but I tried them at 2.5.1 too).
Everything works fine but when I get to heroku run rake db:migrate I always get the time out error:
[~/railsbridge/test_app] ruby-2.3.0 $ git push heroku master
Everything up-to-date
[~/railsbridge/test_app] ruby-2.3.0 $ heroku run rake db:migrate
Running rake db:migrate on powerful-journey-35824... up, run.9421
▸ ETIMEDOUT: connect ETIMEDOUT 50.19.103.36:5000
I saw another post suggesting that the problem is a result of the connection I'm using blocking port 5000 (I'm at a library). I checked port 5000 on canyouseeme.org as well but it also timed out.
I then tried deploying the app detached using heroku run:detached rake db:migrate and it seems to work until I open heroku again and it shows that the page I'm looking for doesn't exist.
Basically what I'm asking is, does anyone have any idea why this test app isn't getting pushed from my terminal to the heroku deployment page?
I'm a python/django guy, but taking a guess the "everything up to date" message is likely because you have not commited your changes to git. Try:
git commit -a
git push heroku master
Now run your rake command.

'You do not have access to the app' when trying to access heroku console

I recently started collaborating in a project on Heroku using Ruby on Rails. I was added as a collaborator and added the remote to my environment. After some development, I pushed some changes and had no problems:
$ git push staging
Where staging is the name of my remote.
Later, when trying to run "rake test" on Heroku, I recieved an error:
$heroku run rake test --app staging
Running `rake test` attached to terminal... failed
! You do not have access to the app staging.
Which is odd, as I was perfectly able to push my own changes. I checked the Heroku dashboard and saw that my push was logged there. I then tried to view the logs using the console, and the same problem occured.
$ heroku logs --app staging
! You do not have access to the app staging.
Finally, I tried to access the console, but it failed as well.
$ heroku run rails console --app staging
Running `rails console` attached to terminal... failed
! You do not have access to the app staging.
At this point I updated my Heroku toolbelt installation, and used "heroku auth" to verify that my email was showing up, but the error persists. I'm currently contacting Heroku support but I'm hoping someone with a similar issue could aid me in parallel.
Thanks!
So just in case anyone is having a similar problem, this occurs because I was mixing the name of my Heroku Apps with the name of my git remotes. So when I was calling --app staging (the name of my remote), I should have been using the actual name of the app, as found in Heroku.
Be sure to run heroku login before using Heroku toolbelt commands for the first time. It will not tell you that you have not signed in before.
This happen also when you haven't added heroku git remote repository.
You can add it with this command:
git remote add heroku https://git.heroku.com/<your project>.git
You can also type
heroku git:remote -a AppName
I had the same problem because I had created multiple remotes on heroku (e.g. a remote called "staging" for staging, and the default remote "heroku" for prod).
Solution
Use these two options to let heroku know which app and remote you're referring to:
-a your_app_name, and
--remote name_of_remote
Examples
For example, for the remote called staging:
heroku run env -a your_app_name --remote staging
or like this for the production remote:
heroku run env -a your_app_name --remote heroku
Extra Info
The above code runs the simple command env, but you can replace that with whatever commands you want to run on heroku.
Replace the name of the remote. By default, heroku creates one remote called heroku, which is typically the production remote. You can get your remotes with the command: git remote.
This was caused of your ssh key is no more permited to access. Make sure your ssh key is same. You can also regenarate your ssh key and add this to heroku.
You can also run:
heroku run rake test --remote staging
Not sure what happens under the hood, but locally the CLI tool figures out which app you mean based on your git remote.
I had the same problem in my case I was not pushing from master so I had to use this:
git push heroku :main
I had the same problem. It was cause I was not login in Heroku.
First I type:
heroku login
then i type:
heroku git:remote -a restserver-node-jngs
and it works.
I hope it be helpfull for someone.

Deploy to multiple heroku instances using a ruby script

I have three heroku apps with same code-base, one points to admin interface, one user interface and last to staging application for testing.if i do a single change then i have to deploy to all three instances one by one that is a very tedious task, i need a help in writing a script which deploy to all three instances at once. i saw this post which says that Capistrano can't be used for this.
Deploying on Heroku with Capistrano?
As per my opinion this could be the answer
git push heroku master -a app_a
heroku run rake db:migrate -a app_a
git push heroku master -a app_b
heroku run rake db:migrate -a app_b
git push heroku master -a app_c
heroku run rake db:migrate -a app_c
if anything i am missing please add it to this answer.
I am writing a ruby gem for it, and after that i will update my answer.

Restarting Teambox Server

I'm running Teambox (a Ruby on Rails app) and have the server running with:
script/server -e production
Knowing absolutely nothing about Ruby on Rails I just wandered how I could restart the server to get it to update changes I've made to the config?
If you ran it with that command line it's probably running actively in the console, just CTRL+C.
If you ran it daemonize you will need to find the process and kill it.

how can I have a teammate restart heroku server from his machine

I have a rails app up on heroku. Sometimes the server bombs out and I have to go to the console and execute heroku restart so that servers get restarted. This seems to fix the problem.
However, I am not on my machine all the time. I would like to have a team member have this capability as well.
For this to happen...what does he need to do? Does he need to first have access to the github repository so that he can push and pull code to the repository and then install heroku on his machine?
Can this be done without git hub? can he just install heroku?
He needs the Heroku gem ($ sudo gem install heroku). He needs a SSH key, and a Heroku account that takes the key ($ heroku keys:add (pathToKey)). He needs to have his account added to the Heroku project as a collaborator. And then it’s all fine, he could say $ heroku restart --app (appName).

Resources