How to run seed.rb file on Amazon ec2

后端 未结 3 600
感情败类
感情败类 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:31

    You need to create keypair to access the amazon instance(which i think you already have). Make sure that ssh access is enabled in the current selected security group.

    You can connect to the amazon instance using

    ssh -i path/to/keypair.pub ec2-user@ec2-an-ip-address.compute-1.amazonaws.com

    Then cd into the app directory and run bundle exec rake db:seed RAILS_ENV='staging' assuming that you're running the app in staging environment.

提交回复
热议问题