Skip to content

Instantly share code, notes, and snippets.

@samnang
Forked from wearethefoos/aws-console
Created February 19, 2018 08:15
Show Gist options
  • Select an option

  • Save samnang/b72c617314f99df7bf097b5200c8d0b2 to your computer and use it in GitHub Desktop.

Select an option

Save samnang/b72c617314f99df7bf097b5200c8d0b2 to your computer and use it in GitHub Desktop.

Revisions

  1. samnang revised this gist Feb 19, 2018. No changes.
  2. Wouter de Vos created this gist Apr 16, 2015.
    23 changes: 23 additions & 0 deletions aws-console
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/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/aws-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