Skip to content

Instantly share code, notes, and snippets.

@vertis
Created April 16, 2014 01:02
Show Gist options
  • Select an option

  • Save vertis/10794648 to your computer and use it in GitHub Desktop.

Select an option

Save vertis/10794648 to your computer and use it in GitHub Desktop.
commands:
01_fix_owner:
command: "mv /tmp/10_fixing_permission.sh /opt/elasticbeanstalk/hooks/appdeploy/pre/10_fixing_permission.sh"
files:
/tmp/10_fixing_permission.sh:
content: |
#!/usr/bin/env bash
. /opt/elasticbeanstalk/support/envvars
cd $EB_CONFIG_APP_ONDECK
if [ -f Gemfile ]; then
echo "running 'bundle install' with Gemfile:"
cat Gemfile
bundle install
if [ $? != 0 ]; then
echo "ERROR: bundle install failed!"
exit 1
else
echo "bundle install succeeded"
fi
else
echo "no Gemfile found! Skipping bundle install stage!"
fi
if [ -f Gemfile.lock ]; then
echo "encountered a Gemfile.lock, setting proper permissions"
chown $EB_CONFIG_APP_USER:$EB_CONFIG_APP_USER Gemfile.lock
else
echo "no Gemfile.lock file found, so no permissions to set on it"
fi
if [ "$BUNDLE_DISABLE_SHARED_GEMS" = "1" ]; then
cd $EB_CONFIG_APP_ONDECK;
chown -R webapp:webapp ./$BUNDLE_PATH;
echo "Modified the owner of '$BUNDLE_PATH' files";
fi
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment