I set the port as 3000 in my application.yml (figaro managing env variables)
rails s
uses port 3000
but when I run foreman start
(as recommended by Heroku) I get the following output
14:53:23 web.1 | started with pid 24425
14:53:23 web.1 | [24425] Puma starting in cluster mode...
14:53:23 web.1 | [24425] * Version 2.11.1 (ruby 2.2.0-p0), codename: Intrepid Squirrel
14:53:23 web.1 | [24425] * Min threads: 5, max threads: 5
14:53:23 web.1 | [24425] * Environment: development
14:53:23 web.1 | [24425] * Process workers: 2
14:53:23 web.1 | [24425] * Preloading application
14:53:24 web.1 | WARNING: Skipping key "PORT". Already set in ENV.
14:53:25 web.1 | [24425] * Listening on tcp://0.0.0.0:5000
14:53:25 web.1 | [24425] Use Ctrl-C to stop
14:53:25 web.1 | [24425] - Worker 0 (pid: 24426) booted, phase: 0
14:53:25 web.1 | [24425] - Worker 1 (pid: 24427) booted, phase: 0
Procfile
web: bundle exec puma -C config/puma.rb
config/puma.rb
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
on_worker_boot do
ActiveRecord::Base.establish_connection
end
config/application.yml
PORT: "3000"
- Rails 4.2.0
- Foreman 0.78.0
- Ruby 2.2.0p0
- Puma 2.11.1
foreman start
default to port 3000, or how to be able to useforeman
with port 3000? If it's the latter, you can just do it inline by adding-p $PORT
to your Procfile so it's:web: bundle exec puma -p $PORT -C config/puma.rb
Then you can use:foreman start -p 3000
– Sid-p $PORT
inline, but that didn't work, it was still using port 5000,foreman start -p 3000
worked, but how do I make that work without the command line option? – Voskaforeman start
if you useweb: bundle exec puma -p ${PORT:-3000} -e ${RACK_ENV:-development} -C config/puma.rb
in Procfile – Sid