Deploying Rails Application to Elastic Beanstalk Using EB CLI 3.0X

I am trying to redistribute a RoR application using EB CLI 3.0x

I have previously successfully implemented my application using EB CLI 2 on an Amazon Linux 2014.03 stack with Ruby Puma 2.0. However, deploying an application using CLI 3.0 on Amazon Linux 2014.09 with Puma 2.0 is giving me errors.

The first problem was renaming postgresql-dev

to postgresql92-dev

or postgresql93-dev

, which was pretty common for everyone. But to this I face the following problems:

In the deployment environment does not work bundle install

, and db migrate / seed

etc.

Moreover, there are no environment variables in the instance. In my deployment with EB CLI 2 and Amazon Linux 2014.03, I could write my configurations .ebextension

and use environment variables in /opt/elasticbeanstalk/containerfiles/envvars

. The previous deployment initializes variables of type $EB_CONFIG_APP_PIDS

and $EB_CONFIG_APP_CURRENT

that I could use in my config files.

However, the newer version gives me a rather empty envvars

file in /opt/elasticbeanstalk/support/envvars

, and none of the previous environment variables are present. Also I had to manually set up my database and connect it to my application.

I wonder if anyone has encountered similar issues and if there is any solution for a simple migration from an older version of Elastic Beanstalk CLI to a newer version.

It would be great if someone could point me to a newer version .ebextensions

written to run automatically sidekiq

/ cron services

etc.

+3


source to share


1 answer


Even if this is an old thread:

AWS has changed the way we get these variables, for example:

EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)

      

A complete list of CONTAINER variables can be obtained with:



/opt/elasticbeanstalk/bin/get-config container --output=yaml
---
app_staging_dir: "/var/app/ondeck"
instance_port: '80'
gem_dir: "/opt/elasticbeanstalk/support/gems/puma"
http_port: '80'
app_deploy_dir: "/var/app/current"
node_install_dir: "/opt/elasticbeanstalk/support/node-install"
puma_version: 2.9.1
node_version: 0.10.33
app_log_dir: "/var/app/containerfiles/logs"
ruby_version: 2.1.5
script_dir: "/opt/elasticbeanstalk/support/scripts"
source_bundle: "/opt/elasticbeanstalk/deploy/appsource/source_bundle"
app_pid_dir: "/var/app/containerfiles/pids"
puma_pid_dir: "/var/run/puma"
app_asset_dir: "/var/app/containerfiles/assets"
tarball_url: https://s3-eu-west-1.amazonaws.com/elasticbeanstalk-env-resources-eu-west-1/stalks/eb_ruby_puma_3.11.1/lib/tarballs
puma_log_dir: "/var/log/puma"
app_user: webapp
support_dir: "/opt/elasticbeanstalk/support"

      

Other category configurations and parameters can be run

/opt/elasticbeanstalk/bin/get-config -h
Usage: get-config CATEGORY [OPTIONS]

Categories:
    optionsettings                   environment option settings that affect instance
    container                        container specific configurations
    addons                           addon configurations
    environment                      environment variables
    meta                             EB environment meta-data

Options:
    -k, --key KEY                    Key of specific configurations.
        --output OUTPUT_FORMAT       Output format. Can be JSON or YAML. Default is JSON.
    -n, --namespace NAMESPACE        Otion Setting namespace for retrieval. Only applied to Category optionsettings.
    -o, --option-name OPTION_NAME    Option Setting name for retrieval. Only applied to Category optionsettings.
    -a, --add-on ADDON               Add-on name. Only applied to Category addons.
    -h, --help                       Help

      

Hope this helps people to upgrade their stacks to 2014.09 and beyond.

+4


source







All Articles