Heroku-Buildpack-Multi causing app to crash

自古美人都是妖i 提交于 2019-12-12 06:00:19

问题


I'm have a Rails 4 app on Heroku that I'm trying to deploy with two buildpacks. I'm not sure if I'm missing a step or if there is a bug, but when I push the code, the app deploys successfully. When I open it however, it crashes.

I've tried using the command heroku buildpacks:set https://github.com/bobbus/image-optim-buildpack.git and heroku buildpacks:set https://github.com/ddollar/heroku-buildpack-multi.git, but am only able to set one at a time, not both. It doesn't seem to matter which one I set, the app always crashes. Searching through the logs, I see the following:

heroku[web.1]: State changed from crashed to starting
heroku[web.1]: Starting process with command `bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}`
app[web.1]: bash: bundle: command not found
heroku[web.1]: Process exited with status 127
heroku[web.1]: State changed from starting to crashed

I'm no expert on bundler, but it seems like for some reason it's not recognizing the bundle command in my Procfile.

Here is my Procfile, which I should note has worked perfectly up until now.

web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}

I've also tried clearing out the buildpacks (heroku buildpacks:clear) and creating a .buildpacks file instead, but that yielded the same error.

Here is my .builcpacks file:

https://github.com/ddollar/heroku-buildpack-multi.git
https://github.com/bobbus/image-optim-buildpack.git

The documentation in the Heroku Dev Center and on the buildpacks themselves is pretty sparse as far as I can tell.


回答1:


If the two build packs you listed are the only two you're loading, I think you're missing the Ruby buildpack, which is where the "bundler" is defined:

https://github.com/heroku/heroku-buildpack-ruby

Note: If I were debugging this, I would ditch the buildpack-multi, and use just the Ruby buildpack to see if you can get that through the bundler error, then try to load another buildpack, and so on.


I see what you mean about the documentation. Pretty weak. Let me know if this helps.




回答2:


Using the .buildpacks multi manager isnt required because Heroku supports multiple buildpacks natively by passing --index when setting a buildpack for example:

  • heroku buildpacks:set https://github.com/heroku/heroku-buildpack-ruby --index 1
  • heroku buildpacks:set https://github.com/shunjikonishi/heroku-buildpack-ffmpeg --index 2
  • Change something in your git repo && then do a -> git push heroku master

The Deploy will detect your buildpacks and will run them. To check what buildpacks are currently set in your app run: heroku buildpacks



来源:https://stackoverflow.com/questions/32482945/heroku-buildpack-multi-causing-app-to-crash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!