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?
Related
I have a simple web app on heroku running on Passenger and I am trying to make the emails asynchronous. I set it all up with Sidekiq in my dev environment and then I realized I have to start a new dyno on Heroku to run the Sidekiq worker and have to pay $34/m. I am trying to see if I can run Sidekiq on the web dyno with Passenger and save the $34/m cost for now till its worth that investment.
I found a post here that explains how to do this with Unicorn. I am wondering if I can do the same thing with Passenger.
If that doesn't work I will look at using sucker_punch or use unicorn instead but will be good if I can Sidekiq working on the same dyno with Passenger.
I am on rails 3.1, sidekiq 3.1.4 and passenger 4.0.5 - can upgrade here if I have to.
Thanks for your thoughts.
-S
You can. There's no difference between Passenger and Unicorn when it comes to achieving this goal. Instead of specifying web: bundle exec unicorn ... in your Procfile, you just set web: bundle exec passenger in your Procfile. Instead of setting a Unicorn config file, you set equivalent Passenger command line arguments or configuration.
I have been deploying a Rails 3.2 application to heroku for several weeks now. I have also been executing rake tasks on the Cedar stack where my application is located.
One day after a deploy I noticed that rake was no longer working. I get, for example, the following:
$:~/dev/my_project$ heroku run rake -T
Running `rake -T` attached to terminal... up, run.7566
bundler: command not found: rake
Install missing gem executables with `bundle install`
Trying to run commands with bundle exec yields the same results.
What I've tried:
heroku run bundle install. This works and informs me that gems were installed into ./vendor/bundle. However, heroku run ls ./vendor/bundle yields only the following:
$:~/dev/my_project$ heroku run ls ./vendor/bundle/
Runningls ./vendor/bundle/attached to terminal... up, run.3458
bin ruby
bundle package. Although the deployment works it does not help my problem.
fiddling around with the rubygems-bundler gem (although I think this is now part of core bundler). This does not seem to have any effect.
On Heroku, gems are installed within the vendor/bundle/ruby/<version>/gems directory. I just checked my Heroku instance and confirmed this.
You are going to want to use bundle exec rake task because the gems are not in the users PATH.
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
I have a program that I wrote using ruby. It doesn't have any web interface, but I use bundler for dependency management.
On my local system, running the app is as simple as typing rake app:start, and it loads up just fine.
When I deploy to heroku, however, my app crashes with a cannot load such file -- bundler error.
My Procfile looks has this entry app: bundle exec rake app:start.
Any help is greatly appreciated.
The problem was that Heroku was not changing the GEM_HOME field to the vendor/bundle directory.
By adding the following config vars to Heroku, my app ran as expected:
GEM_HOME: /app/vendor/bundle/ruby/1.9.1
PATH: /app/vendor/bundle/ruby/1.9.1/bin:bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin
Adding these was done via the heroku config:set CONFIG_NAME=VALUE command.
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.