Skip to content

Instantly share code, notes, and snippets.

@zetavg
Last active August 29, 2015 14:15
Show Gist options
  • Save zetavg/9ec46f825eebadf06615 to your computer and use it in GitHub Desktop.
Save zetavg/9ec46f825eebadf06615 to your computer and use it in GitHub Desktop.
`bin/rake` tasks and `bin/rails console` with ease on AWS OpsWorks Instances running Passenger Rails App Server.
# $ curl -L http://git.io/opsrp_setapp > set-app.sh
# $ . set-app.sh app_name
#
# cd into app directory and sets the environment variables
# on AWS OpsWorks Instances running Passenger Rails App Server.
APP_NAME=$1 && \
cd "/srv/www/${APP_NAME}/current" && \
export RAILS_ENV=production && \
\
cat "/etc/apache2/sites-enabled/${APP_NAME}.conf" | grep 'SetEnv ' > "/tmp/${APP_NAME}_env" && \
sed -i "s/ *SetEnv \"/export /g" "/tmp/${APP_NAME}_env" && \
sed -i "s/\" /=/g" "/tmp/${APP_NAME}_env" && \
chmod +x "/tmp/${APP_NAME}_env" && \
. "/tmp/${APP_NAME}_env"
@zetavg
Copy link
Author

zetavg commented Feb 16, 2015

curl -L http://git.io/opsrp_setapp > set-app.sh
. set-app.sh 

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