Skip to content

Instantly share code, notes, and snippets.

@stanlemon
Created March 16, 2013 19:31
Show Gist options
  • Save stanlemon/5177925 to your computer and use it in GitHub Desktop.
Save stanlemon/5177925 to your computer and use it in GitHub Desktop.
A sample ./.openshift/action_hooks/deploy for Red Hat's OpenShift platform to install composer dependencies upon deployment.
#!/bin/bash
# This deploy hook gets executed after dependencies are resolved and the
# build hook has been run but before the application has been started back
# up again. This script gets executed directly, so it could be python, php,
# ruby, etc.
export COMPOSER_HOME="$OPENSHIFT_DATA_DIR/.composer"
if [ ! -f "$OPENSHIFT_DATA_DIR/composer.phar" ]; then
curl -s https://getcomposer.org/installer | /usr/local/zend/bin/php -- --install-dir=$OPENSHIFT_DATA_DIR
else
/usr/local/zend/bin/php $OPENSHIFT_DATA_DIR/composer.phar self-update
fi
( unset GIT_DIR ; cd $OPENSHIFT_REPO_DIR ; /usr/local/zend/bin/php $OPENSHIFT_DATA_DIR/composer.phar install )
@harikt
Copy link

harikt commented Apr 13, 2014

one suggestion /usr/local/zend/bin/php is different from that of php -v version. So rather than /usr/local/zend/bin/php I am preferring just php .

Thank you for sharing the snippet.

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