I have a Rails 4 app using ruby 2.3 that I want to deploy using AWS Ebs. I'm pointing the db connection to an existing db, I'm using the cli to initialize and create. When I get to the create part i keep getting an error message that says:
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/12_db_migration.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
Which of course means the migration failed. When i checked the logs it says tables already exist, I did some research and found you can include settings in .ebextensions/
to specify not to run migrations or run bundle on test and dev. Here is my .ebextensions/ruby-settings.config
:
option_settings:
BUNDLE_WITHOUT: "test:development"
RAILS_ENV: production
RACK_ENV: production
RAILS_SKIP_MIGRATIONS: true
However it still fails to deploy and gives the same error message. Question is, what am i doing wrong here? I've tried rewriting this config file different ways based on tutorials i found on this blog and the AWS docs page here.
Any thoughts on what I'm doing wrong are helpful as i am at a loss currently.
I found that the answer to my problem was that i had added .ebextensions to my .gitignore. Early in the process of deployment .elasticbeanstalk had been added to ignore and I assumed the same needed to be done to .ebextensions. A minor oversight that led to a lot of frustration.
It is worth noting that when I did have a spacing issue in my config files, the ebcli threw an error at me. I believe that what error2007s posted was valid, however other formats are acceptable. For example, here is my current format for one of my config files:
option_settings:
aws:ec2:vpc:
VPCId: vpc-xxxxxxxx
Subnets: subnet-yyyyyyy,subnet-zzzzzzzz,subnet-wwwwwww,subnet-eeeeeeeee
aws:autoscaling:launchconfiguration:
SecurityGroups: sg-00000000
etc...
I would also recommend using .ebextensions to set your environment variables, as I did:
option_settings:
aws:elasticbeanstalk:application:environment:
RAILS_SKIP_MIGRATIONS: true
RAILS_ENV: production