我有一个成功上传到Heroku的应用程序,并且一切正常。使用rails app:update
命令从6.0.0rc1版本更新到6.0.0之后,我将应用程序部署到了heroku,然后在服务器启动时Heroku崩溃了。
2019-08-20T12:45:56.047319+00:00 heroku[web.1]: State changed from crashed to starting
2019-08-20T12:46:01.995009+00:00 heroku[web.1]: Starting process with command `bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}`
2019-08-20T12:46:04.051365+00:00 app[web.1]: Puma starting in single mode...
2019-08-20T12:46:04.051387+00:00 app[web.1]: * Version 3.12.1 (ruby 2.6.1-p33), codename: Llamas in Pajamas
2019-08-20T12:46:04.051389+00:00 app[web.1]: * Min threads: 5, max threads: 5
2019-08-20T12:46:04.051390+00:00 app[web.1]: * Environment: production
2019-08-20T12:46:08.886669+00:00 heroku[web.1]: State changed from starting to crashed
2019-08-20T12:46:08.769945+00:00 app[web.1]: * Listening on tcp://0.0.0.0:32178
2019-08-20T12:46:08.770225+00:00 app[web.1]: bundler: failed to load command: puma (/app/vendor/bundle/ruby/2.6.0/bin/puma)
2019-08-20T12:46:08.770272+00:00 app[web.1]: Errno::ENOENT: No such file or directory @ rb_sysopen - tmp/pids/server.pid
2019-08-20T12:46:08.770276+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/launcher.rb:133:in `initialize'
2019-08-20T12:46:08.770277+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/launcher.rb:133:in `open'
2019-08-20T12:46:08.770278+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/launcher.rb:133:in `write_pid'
2019-08-20T12:46:08.770280+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/launcher.rb:106:in `write_state'
2019-08-20T12:46:08.770281+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/single.rb:103:in `run'
2019-08-20T12:46:08.770282+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/launcher.rb:186:in `run'
2019-08-20T12:46:08.770284+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/cli.rb:80:in `run'
2019-08-20T12:46:08.770285+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/bin/puma:10:in `<top (required)>'
2019-08-20T12:46:08.770287+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/bin/puma:23:in `load'
2019-08-20T12:46:08.770289+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/bin/puma:23:in `<top (required)>'
2019-08-20T12:46:08.867275+00:00 heroku[web.1]: Process exited with status 1
由于某些原因,服务器启动时未创建tmp/pids/server.pid
。
您能帮我解决这个问题吗? 我在Google中找不到解决方案
答案 0 :(得分:2)
好吧,我通过从在rails升级期间添加的pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
中删除行config/puma.rb
解决了问题:)
答案 1 :(得分:1)
您可以使用tmp/pids
文件将.keep
文件夹添加到版本控制中。这会将文件夹置于版本控制中,因此当将其克隆到Heroku时,该文件夹就在其中。
您可能还需要编辑.gitignore文件,以便它不会忽略tmp/pids
目录。
答案 2 :(得分:0)
您需要修改.gitignore
文件,以使用tmp/pids
文件显式进入.keep
目录。确保您的.gitignore
如下所示:
/tmp/*
/tmp/pids/*
!/tmp/.keep
!/tmp/pids
!/tmp/pids/.keep
然后是touch tmp/pids/.keep
。