简体   繁体   English

Capistrano 将我的应用程序从 Sqlite3 更新到 Rails,Gem::LoadError

[英]Capistrano updating my app from Sqlite3 to Rails, Gem::LoadError

I am upgrading my rails app from Sqlite3 to Postgresql.我正在将我的 Rails 应用程序从 Sqlite3 升级到 Postgresql。 I am using Ansible to setup my server and Capistrano to deploy.我正在使用 Ansible 设置我的服务器并使用 Capistrano 进行部署。 I was able to successfully run ansible and now I'm trying to deploy my branch to an existing server that had Sqlite3 installed on it.我能够成功运行 ansible,现在我正在尝试将我的分支部署到安装了 Sqlite3 的现有服务器上。

On the capistrano step:在 capistrano 步骤上:

deploy:assets:precompile I get this error deploy:assets:precompile我得到这个错误

     $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
      01 rake aborted!
      01 Gem::LoadError: Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).

But I don't understand.但我不明白。 I have Postgresql set up in my branch I'm trying to deploy.我在尝试部署的分支中设置了 Postgresql。

Here is my database yml file.这是我的数据库 yml 文件。

   default: &default
   adapter: postgresql
   encoding: unicode
   pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
   timeout: 5000

development:
  <<: *default
  database: {appname}_development

test:
  <<: *default
  database: {appname}_test

staging:
  <<: *default
  database: {appname}_staging
  username: <%= Rails.application.secrets[:db_username] %>
  password: <%= Rails.application.secrets[:db_password] %>

Obviously changed {appname} with my actual application's name.显然用我的实际应用程序名称更改了 {appname} 。 I didn't include a production key cause this app does not have a production website only a staging server.我没有包含生产密钥,因为这个应用程序没有生产网站,只有一个登台服务器。 It is more of a playground I use for rails.它更像是我用于铁轨的游乐场。

Does anyone have any experience with fixing this issue?有没有人有解决这个问题的经验? I'm really not sure if there is an issue with the Capfile or if I'm missing something.我真的不确定 Capfile 是否有问题,或者我是否遗漏了什么。 Thanks (and let me know if you need more of my code)谢谢(如果您需要更多我的代码,请告诉我)

Worth noting this app is still running Rails 5.1 (I'm going to update this next I just wanted to get it on a Postgres db first)值得注意的是这个应用程序仍在运行 Rails 5.1(我接下来要更新它,我只是想先在 Postgres db 上获取它)

EDIT: OK I am onto something.编辑:好的,我正在做某事。 i discovered that this capistrano step:我发现这个 capistrano 步骤:

         04 ln -s /var/www/{appname}/shared/config/database.yml /var/www/{appname}/releases/20190923224949/config/database.yml

Is not updating my database yml to be the updated postgres db.没有将我的数据库 yml 更新为更新的 postgres db。 I'm guessing I'm missing something somewhere.我猜我在某个地方遗漏了一些东西。 :cry: :哭:

I GOT IT.我知道了。 I'M A GENIUS.我是天才。

I had to rereun the webserver playbook to get my database.yml file onto the server.我不得不重新运行网络服务器剧本以将我的 database.yml 文件放到服务器上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM