4

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
Nikita Misharin
  • 1,961
  • 1
  • 11
  • 20

1 Answers1

4

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.

Tal
  • 7,827
  • 6
  • 38
  • 61
  • Hey! I have 12_db_migration.sh in my .ebextensions/ruby.config file, but it still doesn't execute migration. Can you please help? – Disha Apr 21 '16 at 06:02
  • @disha why do you even have ruby.config? beanstalk runs migration automatically assuming you picked ruby as the application type when you've set up the env. – Tal Apr 27 '16 at 17:34
  • I had picked up ruby as the application type but still it didn't run migration in the first place. Putting a container command did the trick. It is working now. – Disha Apr 28 '16 at 04:52