Heroku dyno using thin instead of unicorn - heroku

I upgraded my app from Rails 3 to 4 and I'd like to start using Unicorn as my server. I've followed the Heroku documentation adding the Procfile and config/unicorn.rb, but when I push it runs thin.
=== web (2X): bin/rails server -p $PORT -e $RAILS_ENV
web.1: up 2014/09/09 17:45:54 (~ 1m ago)
Thin isn't in my Gemfile and I'm wondering what other potential conflicts could exist to prevent Unicorn from loading.
Procfile:
bundle exec unicorn -p $PORT -c ./config/unicorn.rb

Related

How to start the rails console on Heroku with a multi-buildpack?

I'm deploying to heroku with the multi-buildpack on the cedar stack using a custom procfile:
web: bundle exec unicorn -p $PORT -E $RACK_ENV -c ./config/unicorn.rb
worker: bundle exec sidekiq -e production -C config/sidekiq.yml
console: bundle exec irb -r ./console
When I boot my console with heroku run console I get LoadError: cannot load such file -- ./console and a virgin irb session.
How can I initialize the console with rails and my application environment loaded?
So running irb is obviously wrong.
What I needed was console: bundle exec rails console

Why is my middleman heroku app ignoring the Procfile?

I've been struggling trying to launch my middleman repo to heroku. I've followed a tutorial http://randomerrata.com/post/56163474367/middleman-on-heroku, but have had continued issues. Although installing the puma gem, for some reason the procfile is being ignored and the heroku app keeps pointing to
web bundle exec sudo unicorn_rails -c ./config/unicorn.rb -p $PORT -D --env production
Any idea how to get this thing to stop pointing to the unicorn rails and use puma?
Perhaps it would be worth checking out middleman-heroku as a different route to take. Alternatively I would check that your Gemfile.lock is up to date and committed.
I would try tailing the logs with heroku logs -t to see if you can see what's happening.
Is your Procfile called Procfile with a capital P?
What does it look like, can you post it here?
My Procfile has web: bundle exec puma -p $PORT. Is Puma listed in your Gemfile?

How can I run multiple apps of multiple bundle with foreman

I have a ruby app that depends of several web-services i've built.
To start all together I've got the following Procfile:
mondodb: /home/dwaynemac/mongodb/bin/mongod
accounts: ./script/start_accounts.sh
contacts: ./script/start_contacts.sh
activity: ./script/start_activity_stream.sh
web: ./script/start.sh
Each of this start_xxx.sh script do something like:
cd ../activity_stream; bundle exec unicorn -p 3003 -c ./config/unicorn.rb
If I manually run these previous line activity_stream runs ok. But when ran from foreman some gems are not recognized. As if the bundle was not correctly built.
Example error:
activity_stream/config/boot.rb:2:in `require': no such file to load -- grape (LoadError)
Use the subcontractor gem to change working directory:
image_fallback: subcontract -d lib/rack/img_fallback/ -- bundle exec unicorn -c unicorn.conf config.ru
You will have to use a new bash shell for each app you want to boot up.
# Procfile
app1: sh -c 'cd path/to/app1 && bundle exec rackup config.ru -p $PORT'
app2: sh -c 'cd path/to/app2 && bundle exec rackup config.ru -p $PORT'
Then use foreman
foreman start --procfile path/to/Procfile
More info here http://www.seanbehan.com/how-to-boot-up-multiple-sinatra-applications-at-the-same-time-with-foreman

How to run Rack-based application (not Rails) with Unicorn

How can I run a Rack-based application (not Rails) with unicorn? Let's assume I have a "hello world" response simple rack app with the name of server.ru, and config file at the same directory with the name of unicorn.conf, how am I supposed to run it? In Thin, for example, I would do something like:
bundle exec rackup server.ru -s thin -E production -p 4001
How would I do the same to run under Unicorn?
Unicorn does not give any special treatment to Rails 3+ applications, so the behavior is exactly the same for Rails 3+ applications and non-Rails Rack applications. Just run
unicorn
in your app's root. To run with a specific port, pass -p/--port with the port:
unicorn -p 4001
You can also specify the rackup file:
unicorn server.ru
You can see all the options by running unicorn --help. Of course, you should prepend bundle exec to these commands as needed by your setup.
You can make a setting file for unicorn like this:
working_directory "/path/to/your/app"
listen 4001
pid "/tmp/unicorn.pid"
And then launch unicorn with the following command:
unicorn -c /path/to/your/setting/file.rb

Heroku Cedar: how to stop using WEBrick

In my Gemfile I have:
gem 'thin'
But when I push my application to Heroku Cedar, WEBrick is still used ("Booting WEBrick" in logs).
Where might be a problem?
You just need to create a Procfile and add the following line:
web: bundle exec rails server -p $PORT thin -e $RACK_ENV
Push that to Heroku and you'll be all set.

Resources