Skip to content

Instantly share code, notes, and snippets.

@zetavg
Last active August 29, 2015 14:14
Show Gist options
  • Save zetavg/c970ceee0d4f4c632b4b to your computer and use it in GitHub Desktop.
Save zetavg/c970ceee0d4f4c632b4b to your computer and use it in GitHub Desktop.
`bin/rake` tasks and `bin/rails console` with ease on AWS OpsWorks Instances running Unicorn Rails App Server.
# $ curl -L http://git.io/opsru_setapp > set-app.sh
# $ . set-app.sh app_name
#
# cd into app directory and sets the environment variables
# on AWS OpsWorks Instances running Unicorn Rails App Server.
APP_NAME=$1 && \
cd "/srv/www/${APP_NAME}/current" && \
export RAILS_ENV=production && \
cat "/srv/www/${APP_NAME}/shared/config/unicorn.conf" | grep ENV > "/tmp/${APP_NAME}_env" && \
sed -i "s/ENV\['/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 Jan 25, 2015

curl -L http://git.io/opsru_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