1

I am upgrading my rails app from Sqlite3 to Postgresql. I am using Ansible to setup my server and Capistrano to deploy. 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.

On the capistrano step:

deploy:assets:precompile I get this error

     $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.

Here is my database yml file.

   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. 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. 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)

EDIT: OK I am onto something. i discovered that this capistrano step:

         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. I'm guessing I'm missing something somewhere. :cry:

Gabriel
  • 621
  • 7
  • 19

1 Answers1

1

I GOT IT. I'M A GENIUS.

I had to rereun the webserver playbook to get my database.yml file onto the server.

Gabriel
  • 621
  • 7
  • 19