Skip to content

Instantly share code, notes, and snippets.

@satyatechsavy
Created February 22, 2016 11:47
Show Gist options
  • Save satyatechsavy/9cebd2f5e8b85753bd2e to your computer and use it in GitHub Desktop.
Save satyatechsavy/9cebd2f5e8b85753bd2e to your computer and use it in GitHub Desktop.
AWS EB-Extension to install PhantomJS
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/04_install_phantomjs":
mode: "000777"
owner: root
group: root
content: |
#!/usr/bin/env bash
set -xe
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)
EB_APP_USER=$(/opt/elasticbeanstalk/bin/get-config container -k app_user)
EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir)
. $EB_SUPPORT_DIR/envvars
command -v phantomjs >/dev/null 2>&1 || {
echo "PhantomJS needs to be installed now";
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
mkdir -p /opt/phantomjs
bzip2 -d phantomjs-1.9.8-linux-x86_64.tar.bz2
tar -xvf phantomjs-1.9.8-linux-x86_64.tar --directory /opt/phantomjs/ --strip-components 1
ln -s /opt/phantomjs/bin/phantomjs /usr/bin/phantomjs
echo "PhantomJS is installed successfully";
}
@ralphioooo
Copy link

Hi there, I'm trying to install Phantom JS on a PHP version of Elastic beanstalk. Not having much luck however. Get this error:
Command failed on instance. Return code: 1 Output: (TRUNCATED)...-config container -k app_user + EB_APP_USER=webapp ++ /opt/elasticbeanstalk/bin/get-config container -k support_dir + EB_SUPPORT_DIR= + . /envvars /opt/elasticbeanstalk/hooks/appdeploy/pre/04_install_phantomjs: line 10: /envvars: No such file or directory. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/04_install_phantomjs failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment