Running a rails server in production locally (InvalidMessage error)

前端 未结 5 2080
隐瞒了意图╮
隐瞒了意图╮ 2020-12-28 17:10

I\'m running Ruby 2.5.1 and Rails 5.2.0. I ran rails s -e production, and it gives this error:

/home/roy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5         


        
5条回答
  •  别那么骄傲
    2020-12-28 17:48

    I had this similar issue when working with a Rails 5 application in production, royketelaar's answer and gib's answer

    Just to add a few things:

    After deleting the credentials.yml.enc and master.key files,

    And running the command below to generate a new secret_key_base, credentials.yml.enc and master.key files (my editor is VS Code and not Nano):

    EDITOR="code --wait" bin/rails credentials:edit
    

    Ensure that uncomment the following configuration in your config/environments/production.rb file:

    config.require_master_key = true
    

    For your production environment, since the master.key file containing the master key which is used for decrypting the credentials.yml.enc is not recommended to be committed to version system control, save the master key in a RAILS_MASTER_KEY environment variable using the figaro gem.

    That's all.

    I hope this helps

提交回复
热议问题