How to run seed.rb file on Amazon ec2

后端 未结 3 572
感情败类
感情败类 2021-01-07 06:47

Recently I hosted my Ruby on Rails application on Amazon EC2 using Elastic Beanstalk. Everything works fine except my seeds.rb file. My seeds.rb file is not executed at the

3条回答
  •  再見小時候
    2021-01-07 07:11

    In case you're here and the above solutions didn't work for you.

    Apart from using the command provided in this answer above by benchwarmer:

    https://stackoverflow.com/a/17232607/1216245

    I had to run the seed command providing env vars for the master key and all rds settings.

    bundle exec rake db:seed RAILS_ENV=production RAILS_MASTER_KEY= RDS_HOSTNAME= RDS_PASSWORD=<...> RDS_USERNAME=<...> RDS_DB_NAME=<...> RDS_PORT=<...>

    And it worked, finally :)

    You can check all this in the Configuration panel for your environment in the AWS console (dashboard).

提交回复
热议问题