Search code examples
ruby-on-rails-4amazon-web-servicesamazon-elastic-beanstalkdbmigrate

Rake db:migrate on aws elastic beanstalk


I'm trying to do rake db:migrate on aws, but can't figure out how

Here is my .ebextensions/.config file, but it doesn't work

packages:
  yum:
    postgresql-devel: []

# Run rake tasks before an application deployment
container_commands:
  01bundler-pg:
    command: bundle config build.pg --with-pg-config=/usr/bin/pg_config
  db:
      command: "bundle exec rake db:migrate"
      leader_only: true

Solution

  • You didn't specify the error message you get and the configuration you picked (e.g. 64bit Amazon Linux 2014.03 v1.0.9 running Ruby 2.1).
    However, it seems that you have an error with the file name. You called it .config while the file name should have a prefix. try renaming it to myapp.config.
    That said, if you picked the ruby version of the elastic beanstalk instance type, then you don't need to migrate manually as beanstalk will do it for you (as part of its 12_db_migration.sh script).
    If you still need to perform some kind of custom manual migration, go for it.