简体   繁体   中英

Heroku rails 4 + puma deployment

I have being trying to deploy my rails 4 app to heroku and use Puma. The puma configuration I have used from https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#adding-puma-to-your-application

But still I am getting error. Please let me know what changes to do to make it work. Error is

> 2016-04-15T02:37:43.118777+00:00 heroku[web.1]: State changed from down to starting
2016-04-15T02:37:43.118406+00:00 heroku[web.1]: Unidling
2016-04-15T02:37:45.374269+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
2016-04-15T02:37:47.238844+00:00 app[web.1]: [3] Puma starting in cluster mode...
2016-04-15T02:37:47.238871+00:00 app[web.1]: [3] * Version 3.3.0 (ruby 2.2.4-p230), codename: Jovial Platypus
2016-04-15T02:37:47.238872+00:00 app[web.1]: [3] * Min threads: 5, max threads: 5
2016-04-15T02:37:47.238880+00:00 app[web.1]: [3] * Process workers: 2
2016-04-15T02:37:47.238879+00:00 app[web.1]: [3] * Environment: production
2016-04-15T02:37:47.238880+00:00 app[web.1]: [3] * Preloading application
2016-04-15T02:37:49.185177+00:00 app[web.1]: [3] * Listening on tcp://0.0.0.0:14560
2016-04-15T02:37:49.185334+00:00 app[web.1]: [3] Use Ctrl-C to stop
2016-04-15T02:37:49.189100+00:00 app[web.1]: [3] - Worker 0 (pid: 6) booted, phase: 0
2016-04-15T02:37:49.190620+00:00 app[web.1]: [3] - Worker 1 (pid: 10) booted, phase: 0
2016-04-15T02:37:49.338111+00:00 heroku[web.1]: State changed from starting to up
2016-04-15T02:37:51.250717+00:00 heroku[router]: at=info method=GET path="/" host=vna-web.herokuapp.com request_id=69b23803-e2c4-4915-adef-d9358590c11f fwd="116.75.138.168" dyno=web.1 connect=1ms service=79ms status=500 bytes=1669
2016-04-15T02:37:51.568588+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=vna-web.herokuapp.com request_id=ff467b63-8cbc-4a5e-ab93-e8d87020cdf2 fwd="116.75.138.168" dyno=web.1 connect=1ms service=4ms status=200 bytes=143
2016-04-15T02:37:59.640100+00:00 heroku[web.1]: Restarting
2016-04-15T02:37:59.640965+00:00 heroku[web.1]: State changed from up to starting
2016-04-15T02:37:59.523049+00:00 heroku[api]: Deploy 2ffe40b by saurabh@toptal.com
2016-04-15T02:37:59.523049+00:00 heroku[api]: Release v19 created by saurabh@toptal.com
2016-04-15T02:37:59.706827+00:00 heroku[slug-compiler]: Slug compilation started
2016-04-15T02:37:59.706838+00:00 heroku[slug-compiler]: Slug compilation finished
2016-04-15T02:38:01.362522+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-04-15T02:38:01.726315+00:00 app[web.1]: [3] - Gracefully shutting down workers...
2016-04-15T02:38:01.838999+00:00 app[web.1]: [3] === puma shutdown: 2016-04-15 02:38:01 +0000 ===
2016-04-15T02:38:01.839020+00:00 app[web.1]: [3] - Goodbye!
2016-04-15T02:38:02.019288+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
2016-04-15T02:38:02.645079+00:00 heroku[web.1]: Process exited with status 0
2016-04-15T02:38:03.855263+00:00 app[web.1]: Puma starting in single mode...
2016-04-15T02:38:03.855304+00:00 app[web.1]: * Version 3.3.0 (ruby 2.2.4-p230), codename: Jovial Platypus
2016-04-15T02:38:03.855306+00:00 app[web.1]: * Min threads: 1, max threads: 16
2016-04-15T02:38:03.855307+00:00 app[web.1]: * Environment: production
2016-04-15T02:38:05.694384+00:00 app[web.1]: * Listening on tcp://0.0.0.0:10578
2016-04-15T02:38:05.694550+00:00 app[web.1]: Use Ctrl-C to stop
2016-04-15T02:38:05.829089+00:00 heroku[web.1]: State changed from starting to up
2016-04-15T02:38:11.021955+00:00 heroku[router]: at=info method=GET path="/" host=vna-web.herokuapp.com request_id=705c318d-1856-4378-bc8b-de9727a887c1 fwd="116.75.138.168" dyno=web.1 connect=1ms service=71ms status=500 bytes=1669

Below is Procfile

web: bundle exec puma -C config/puma.rb

Puma config file at 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
  # Worker specific setup for Rails 4.1+
  # See: https://devcenter.heroku.com/articles/deploying-rails-  
  # applications-   with-the-puma-web-server#on-worker-boot
  ActiveRecord::Base.establish_connection
end

I even tried to deploy by removing puma, thinking it would run on webrick, but still puma error were getting thrown.

The error was not with Puma. The error got resolved after executing

heroku run rake db:migrate

I refereed https://devcenter.heroku.com/articles/getting-started-with-rails4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM