Prior to this migration, I used Makara gem to split DB connections for writing and reading as follows:

production:
  <<: *default
  url: postgresql-makara:///
  makara:
    sticky: true
    connections:
      - role: master
        name: primary
        url: <%= ENV["DATABASE_URL"] %>
      - name: replica
        url: <%= ENV["ANALYTICS_URL"] %>

and this is my current database.yml file after migration to rails 6

default: &default
  adapter: postgresql
  encoding: unicode
development:
  primary:
    <<: *default
    database: hot_seller_development
  follower:
    <<: *default
    database: hot_seller_development
    replica: true

production:
  primary:
    <<: *default
    url: <%= ENV['DATABASE_URL'] %>
  follower:
    <<: *default
    url: <%= ENV['ANALYTICS_URL'] %>
    replica: true

my Heroku app is connected to Amazon RDS and whenever I push this change to production environment, the postgres log says,

"2021-09-28 11:13:06 UTC:ec2-52-XXXX.compute-1.amazonaws.com(57186):ucorXXX@d1XXX:[8428]:LOG: could not receive data from client: Connection reset by peer" <-- this is db with write access

2021-09-28 11:14:06 UTC:ec2-XXXXX.compute-1.amazonaws.com(47640):anal@d1octXXXX:[445]:ERROR: permission denied for relation users <-- this is db with read access

It seems my app is relegated to using db with read access because it could not connect with db with write access..

Does anyone had similar issues and share with me how you came to resolve? Also How would you test this?

Thanks in advance!

0

There are 0 answers