Can you run a rails console or rake command in the elastic beanstalk environment?

后端 未结 11 1115
一整个雨季
一整个雨季 2020-12-12 21:03

I have set up a RoR environement on AWS\' elastic beanstalk. I am able to ssh into my EC2 instance. My home directory is /home/ec2-user, which is effective

11条回答
  •  忘掉有多难
    2020-12-12 21:24

    None of these were working for me, including the aws-console script. I finally ended up creating a script directory in /var/app/current and then creating a rails file in that directory as outline by this answer on another SO question.

    eb ssh myEnv
    cd /var/app/current
    sudo mkdir script
    sudo vim script/rails
    

    Add this to file and save:

    echo #!/usr/bin/env ruby
    # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
    
    APP_PATH = File.expand_path('../../config/application',  __FILE__)
    require File.expand_path('../../config/boot',  __FILE__)
    require 'rails/commands'
    

    Then make it executable and run it:

    sudo chmod +x script/rails
    sudo script/rails console
    

    And it worked.

提交回复
热议问题