Configuration files and scripts for the blog post: Faster Rails 3 deployments to AWS Elastic Beanstalk http://horewi.cz/faster-rails-3-deployments-to-aws-elastic-beanstalk.html
#!/usr/bin/env bash | |
mkdir /var/app/ondeck/vendor /var/app/ondeck/public /var/app/support/bundle /var/app/support/assets /var/app/support/cache | |
ln -s /var/app/support/bundle /var/app/ondeck/vendor | |
ln -s /var/app/support/assets /var/app/ondeck/public | |
ln -s /var/app/support/cache /var/app/ondeck/vendor | |
sed -i 's/"rake/"bundle exec rake/' /opt/elasticbeanstalk/hooks/appdeploy/pre/11_asset_compilation.sh |
#!/usr/bin/env bash | |
. /opt/elasticbeanstalk/support/envvars | |
cd /var/app/ondeck | |
bundle pack --all |
# .ebextensions/app.config | |
option_settings: | |
- option_name: RACK_ENV | |
value: staging | |
- option_name: RAILS_ENV | |
value: staging | |
- option_name: BUNDLE_DISABLE_SHARED_GEMS | |
value: 1 | |
- option_name: BUNDLE_BIN | |
value: bin | |
- option_name: BUNDLE_PATH | |
value: vendor/bundle | |
files: | |
/opt/elasticbeanstalk/hooks/appdeploy/pre/01a_bootstrap.sh: | |
mode: "00755" | |
owner: root | |
group: root | |
source: https://s3.amazonaws.com/mybucket/bootstrap.sh | |
/opt/elasticbeanstalk/hooks/appdeploy/pre/10a_bundle_pack.sh: | |
mode: "00755" | |
owner: root | |
group: root | |
source: https://s3.amazonaws.com/mybucket/bundle_pack.sh | |
/opt/elasticbeanstalk/hooks/appdeploy/post/01_update_cache.sh: | |
mode: "00755" | |
owner: root | |
group: root | |
source: https://s3.amazonaws.com/mybucket/update_cache.sh | |
sources: | |
/var/app/support: https://s3.amazonaws.com/mybucket/bundle.tar.gz | |
/var/app/support: https://s3.amazonaws.com/mybucket/assets.tar.gz | |
packages: | |
yum: | |
git: [] | |
container_commands: | |
01_cronjobs: | |
command: "cat .ebextensions/crontab | crontab" | |
leader_only: true |
#!/usr/bin/env bash | |
. /opt/elasticbeanstalk/support/envvars | |
if [ "$RAILS_ENV" != "staging" ]; then | |
exit | |
fi | |
cd /var/app/support | |
tar zcf bundle.tar.gz bundle cache | |
s3put -b mybucket -p /var/app/support -g public-read bundle.tar.gz | |
tar zcf assets.tar.gz assets | |
s3put -b mybucket -p /var/app/support -g public-read assets.tar.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment