I am very new to Heroku.
I uploaded my Rails app to Heroku and would like to run it with Thin instead of Webrick. Following Heroku’s guide I am supposed to use web: bundle exec rails server thin -p $PORT -e $RACK_ENV to create the procfile. However I always get the response web:: command not found.
What am I missing?
You’re not supposed to run web: bundle exec rails server thin -p $PORT -e $RACK_ENV as a command, rather you create a new file called Procfile with that as its contents.
Either create the file and paste it in using your editor, or just do:
echo "web: bundle exec rails server thin -p \$PORT -e \$RACK_ENV" > Procfile
Have you bundled thin into your application?
gem 'thin'
If not, you're looking at Rails trying to use the default server. Personally, I would look at using Unicorn on Heroku, but be careful with how many workers you might need.
http://neilmiddleton.com/the-procfile-is-your-friend. Cached version: https://web.archive.org/web/20130926005616/http://www.neilmiddleton.com/the-procfile-is-your-friend
http://neilmiddleton.com/getting-more-from-your-heroku-dynos
Related
I'm trying to deploy my production app on Heroku. I'm using both private_pub and Puma in my app.
I wanted to start both using this procfile :
web: bundle exec puma -C config/puma.rb
web: bundle exec rackup private_pub.ru -s thin -p $PORT -E production
But it fails, it seems like you can have only one web process running at a time on Heroku apps. Is there a way to initialize both ?
ok, so basically you cannot run the 2 processes on heroku at the same time. An easy alternative is to create a dedicated heroku app which sole purpose will be to maintain the Pubsub server running. To do so, just follow this tutorial
I am going through the "Getting Started with Ruby on Heroku" instructions.
https://devcenter.heroku.com/articles/getting-started-with-ruby#deploy-the-app
Step by step. I'm at "Deploy the app". I have executed the heroku ps:scale web=1 command. I have not made any changes to the standard default sample application.
But when I go to the app, it says Application Error... check the logs.
In the log, I see the following lines:
2015-01-24T07:55:37.733478+00:00 heroku[web.1]: Starting process with command bundle exec puma -t 5:5 -P ${PORT:-3000} -e ${RACK_ENV:-development}
2015-01-24T07:55:40.024681+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/puma-2.9.1/lib/puma/cli.rb:294:in `parse_options': invalid option: -P (OptionPar
ser::InvalidOption)
It looks to me that the Heroku command for starting the web server is incorrect. From what I can see, the -P parameter should be in lowercase.
Is there some way to fix this command?
Your app seems to be configured with puma server incorrectly. This may be an issue with your procfile as indicated by D-side. Your procfile should live inside the root of your app.
When you deploy to heroku, it will look at this file and issue the commands to deal some of the server configuration.
See here
https://devcenter.heroku.com/articles/getting-started-with-ruby#define-a-procfile
When you find your procfile you'll be able to make any adjustments. They give the example.
web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}
I'm deploying a rails app into production.
I'm struggling to find a explanation on where one sets the rails_env to production. Is it done in Unicorn or Nginx.
The app currently thinks that it is in development
I've tried to boot unicorn using sudo service unicorn start -E production
Start your Nginx daemon (it depends on your OS). And than unicorn like this:
$ unicorn_rails -E production -c /var/www/unicorn/config/unicorn.rb -D
I have a Rails app which uses a Procfile to start sidekiq automatically on heroku. I'd like it to start sidekiq automatically on localhost (I currently just 'bundle exec sidekiq' in a separate window). Here's my procfile:
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
worker: bundle exec sidekiq
How would I do this? I do have foreman installed locally
You can create a Procfile.dev file that's meant to be used in development. To use it, just do 'foreman start -f Procfile.dev' from the terminal. Passing the -f option allows you to set the path the Procfile to use.
By the way, would probably be good to gitignore your Procfile.dev, as well. That way, others in your team could have their own Procfile.dev.
Hope that helps!
I am trying to start faye with foreman. My procfile lookd like this:
web: bundle exec rails server thin -p $PORT -e $RACK_ENV
worker: bundle exec sidekiq
redis: bundle exec redis-server
faye: bundle exec rackup faye.ru -s thin -E production
When I run bundle exec foreman start
the web, worker and redis servers all start correctly, but not the faye server.
In the console I get: 10:53:56 faye.1 | started with pid 10907
and then nothing more from faye.
If I run the faye server using the command in the procfile: bundle exec rackup faye.ru -s thin -E production, faye starts correctly. What am I doing wrong?
When you run this locally:
bundle exec rackup faye.ru -s thin -E production
rackup will use it's default port, which is 9292.
When it's run on Herkou, it may not start if that port is already in use. Heroku dynamically assigns the $PORT variable to a valid free port as far as I am aware.
My guess is that Faye is either starting on a different port or not starting at all.
It looks like faye is running OK. Try to visit http://localhost:{PORT}/faye.js to see if it's responding. It should come back with JS. Make sure you use the right port when calling faye server. Once you start making requests you should see faye logs being spit by foreman.
This is Foreman's missing output issue.
If you are not seeing any output from your program, there is a likely chance that it is buffering stdout. Many languages such as Ruby and Python buffer stdout by default.
Faye doesn't set $stdout.sync = true and therefore its output is missing.
I've had the same issue some time ago and tried to fix it but my pull request was rejected.