Created
May 18, 2015 16:44
-
-
Save clok/13938dda289176d584fe to your computer and use it in GitHub Desktop.
ElasticBeanstalk Rails Console and Rake Task Runners
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Rails console script that can be run on AWS Elastic Beanstalk. | |
# | |
# Run this script from the app dir (/var/app/current) as root (sudo script/rails-console) | |
# | |
set -xe | |
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir) | |
EB_APP_DEPLOY_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_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_PID_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_pid_dir) | |
EB_LOG_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_log_dir) | |
. $EB_SUPPORT_DIR/envvars | |
. $EB_SCRIPT_DIR/use-app-ruby.sh | |
cd $EB_APP_DEPLOY_DIR | |
su -s /bin/bash -c "bundle exec rails c" $EB_APP_USER |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Rails console script that can be run on AWS Elastic Beanstalk. | |
# | |
# Run this script from the app dir (/var/app/current) as root (sudo script/run-rake-task $1 $2 $3) | |
# | |
set -xe | |
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir) | |
EB_APP_DEPLOY_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_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_PID_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_pid_dir) | |
EB_LOG_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_log_dir) | |
. $EB_SUPPORT_DIR/envvars | |
. $EB_SCRIPT_DIR/use-app-ruby.sh | |
cd $EB_APP_DEPLOY_DIR | |
echo '--------' | |
su -s /bin/bash -c "bundle exec rake $1 $2 $3" $EB_APP_USER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment