在Heroku Rails独角兽堆栈中使用无头浏览器 [英] Using a headless browser with Heroku Rails Unicorn stack
问题描述
是的,有人已经编写了一个包含PhantomJS的构建包(互联网和开源非常棒)。你希望在Heroku dyno上运行无头PhantomJS,你需要:
多buildpack必须配置作为正式的Heroku buildpack。然后您需要将其他两个buildpack URL添加到 .buildpacks
文件中。在上面的链接中有关于配置每个buildpack的更多详细信息。
使用这个,您应该能够部署您的Rails应用程序,运行您的PhantomJS代码/测试,全部一个单一的dyno无头。
I have seen posts that you can change the build on Heroku, to use PhantomJS with the Cedar stack, but is it possible to run a headless browser on the unicorn stack?
Yes, and someone already wrote a buildpack for including PhantomJS (the internet and open source are amazing).
If you want to run headless PhantomJS on a Heroku dyno, you will need to:
- Switch to Heroku multi-buildpack: https://github.com/ddollar/heroku-buildpack-multi
- Setup Ruby buildpack for your app: https://github.com/heroku/heroku-buildpack-ruby
- Setup PhantomJS buildpack for your needs: https://github.com/stomita/heroku-buildpack-phantomjs
The multi buildpack must be configured as the official Heroku buildpack. You then need to add the other two buildpack URLs to the .buildpacks
file. There are additional details for configuring each buildpack at the links above.
Using this, you should be able to deploy your Rails app, run your PhantomJS code/tests, all on a single dyno headlessly.
这篇关于在Heroku Rails独角兽堆栈中使用无头浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!