如何运行在Amazon EC2 seed.rb文件 [英] How to run seed.rb file on Amazon ec2
问题描述
最近我使用弹性魔豆主办我的Ruby on Rails应用程序在亚马逊EC2 。一切正常,除了我的seeds.rb文件。我的seeds.rb文件没有在承载的时间执行。我使用 ActiveAdmin 也和我确定我的seeds.rb文件中的第一管理。
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 time of hosting. I am using ActiveAdmin also and I define first admin on my seeds.rb file.
如何创建亚马逊第一管理员用户通过导轨控制台? 有什么办法打开控制台的Rails在Amazon EC2上?的我试图做到这一点使用腻子,但不知道如何做到这一点。请给我一些指点。
How can I create first admin user on Amazon by rails console? Is there any way to open Rails Console on Amazon EC2 ? I am trying to do this using putty but don't know how to do this. Please give me some pointers..
推荐答案
您需要创建密钥对访问亚马逊实例(我想你已经有了)。确保ssh连接,那么在当前选定的安全组启用。
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路径/要/ keypair.pub ec2-user@ec2-an-ip-address.compute-1.amazonaws.com
然后cd进入应用程序目录,然后运行捆绑EXEC耙分贝:种子RAILS_ENV ='分期'
假设你正在运行的临时环境的应用程序。
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.
这篇关于如何运行在Amazon EC2 seed.rb文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!