2

I currently have an app deployed to Engine Yard. I am not familiar with importing chef recipes to Engine Yard's repo, etc. like a PhantomJS install. It appears the instance uses Amazon Linux. Is there a best practice, or even walkthrough, that would help me deploy either Xvfb or PhantomJS to my Engine Yard instance? Also, it is being used as a Rails application server.

Dave Schweisguth
  • 36,475
  • 10
  • 98
  • 121
rantingsonrails
  • 568
  • 4
  • 18

1 Answers1

1

I suggest the PhantomJS gem. It automatically installs PhantomJS the first time it's used, in a private location whose location you can get from an API. It provides a recent PhantomJS, currently 2.1.1. It works for me on both MacOS and Linux.

I haven't used that gem on Engine Yard, but I don't think there should be any Engine Yard-specific issues.

I use Cucumber, Capybara and poltergeist, so I have this in features/support/poltergeist.rb:

require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
  Capybara::Poltergeist::Driver.new(app, phantomjs: Phantomjs.path)
end

Using Selenium-Webdriver directly, I'd expect what rantingsonrails suggested would work:

Selenium::WebDriver::PhantomJS.path = Phantomjs.path
Dave Schweisguth
  • 36,475
  • 10
  • 98
  • 121
  • How did you implement the gem on engineyard, aka making sure the install is in the path etc? Did you have to run something like this in a deploy hook? `phantom_path = Phantomjs.path` `Selenium::WebDriver::PhantomJS.path = phantom_path` – rantingsonrails Jun 09 '16 at 15:58
  • I just deployed successfully running essentially the code in the last comment as an initializer. Just wanted to see if there was a best practice when using that gem with a PAAS? – rantingsonrails Jun 09 '16 at 17:09
  • I added to my answer. I'd say that's exactly how the gem and the drivers were designed to be used. – Dave Schweisguth Jun 09 '16 at 17:18