我將端口設置爲3000,我application.yml(費加羅管理ENV變量) rails s
使用端口3000 但是當我運行foreman start
(如推薦的Heroku)我得到以下輸出工頭/彪馬沒有使用指定的端口在開發ENV
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
配置/ 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
配置/ application.yml
PORT: "3000"
- 滑軌4.2.0
- 工頭0.78.0
- 紅寶石2.2.0p0
- 彪馬2.11.1
是你的問題,爲什麼你的配置不工作,如何有'工頭start'默認端口3000,或如何能夠使用'foreman'與3000端口?如果是後者,你可以通過在你的Procfile中添加'-p $ PORT'來實現內聯,所以它是:'web:bundle exec puma -p $ PORT -C config/puma.rb' 然後你可以使用: '工頭start -p 3000' – Sid
後者應該解決我的問題,但前者是我的實際問題,爲什麼不是工頭使用3000端口? – Voska
此外,我嘗試在內嵌中添加'-p $ PORT',但那不起作用,它仍然使用端口5000,'工頭啓動-p 3000'工作,但是如何在沒有命令行選項的情況下使其工作? – Voska