Skip to content

Elastic Beanstalk

E. Lynette Rayle edited this page Apr 1, 2022 · 1 revision

Common Commands

eb logs      # equivalent to tail -100
eb logs -a   # download all logs to local directory  in rails app .elasticbeanstalk/l
----------------------------------
Set AWS environment
----------------------------------
eb use _APP_NAME_IN_AWS_

----------------------------------
ssh to AWS machine
----------------------------------
# change to one of the environments above
eb ssh

----------------------------------
linux-1 locations on AWS
----------------------------------
--- app ---
cd /var/app/current
--- scripts run BEFORE deploy -- e.g. 10_bundle_install.sh ---
cd /opt/elasticbeanstalk/hooks/appdeploy/pre
--- scripts run AFTER puma starts -- e.g. 01_rails_support.sh ---
cd /opt/elasticbeanstalk/hooks/appdeploy/post
--- other scripts ---
cd /opt/elasticbeanstalk/support/scripts

-- in app, scripts go in
.ebextensions

----------------------------------
linux-2 locations on AWS
----------------------------------
--- app ---
cd /var/app/current
--- scripts run BEFORE deploy -- e.g. 10_bundle_install.sh ---
cd /opt/elasticbeanstalk/hooks/appdeploy/pre
--- scripts run AFTER puma starts -- e.g. 01_rails_support.sh ---
cd /opt/elasticbeanstalk/hooks/appdeploy/post
--- other scripts ---
cd /opt/elasticbeanstalk/support/scripts

-- in app, scripts go in
.platform
  /confighooks
    /postdeploy -- e.g. 50_restart_sidekiq.sh, 51_chmod_logs.sh
    /predeploy  -- e.g. 03_mute_sidekiq.sh, 09_update_bundler.sh
  /hooks
    /postdeploy -- e.g. 50_restart_sidekiq.sh, 51_chmod_logs.sh
    /predeploy  -- e.g. 03_mute_sidekiq.sh, 09_update_bundler.sh
    


----------------------------------
debugging on AWS
----------------------------------
cd /var/app/current
tail -f -n 50 log/monitor.log
tail -f -n 50 log/performance_cache.log
tail -f -n 50 log/integration.log
tail -f -n 50 log/staging.log
tail -f -n 50 log/production.log
grep 500 log/production.log
grep Timeout log/production.log
grep "RDF::Graph#load failure" log/production.log

-- works in linus-1 only
bundle exec rails c

----------------------------------
working with  environment variables on AWS
----------------------------------
--- list ---
eb printenv
--- set -- no space around = sign; value not in quotes---
eb setenv _NAME_=_VALUE_
--- delete -- leave value blank to delete ---
eb setenv _NAME_