A confusion with the pg gem compiled against some previous version of homebrew, leading to the reinstallation of postgresql, led to uninstalling and reinstalling the pg gem.
gem uninstall pg gem install pg
Subsequently, the rails console and server can be activated, and while the former can be used, the server returns an error when previously this had never been seen. Needless to say, nothing else changed in the application in the meantime.
Processing by HomeController#hello as HTML
Completed 500 Internal Server Error in 5ms (Allocations: 3461)
ActiveRecord::ConnectionNotEstablished (No connection pool for 'ActiveRecord::Base' found for the 'reading' role.):
pointing to an issue with config/database.yml
There, the default suggestion fro Rails 7 indicates:
# On macOS with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
but /usr/local is an empty directory and the install command with those options fails
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
the simple gem install command yields:
gem install pg
Building native extensions. This could take a while...
Successfully installed pg-1.4.3
Parsing documentation for pg-1.4.3
Installing ri documentation for pg-1.4.3
Done installing documentation for pg after 0 seconds
1 gem installed
database.yml is configured by stock rails installation:
default: &default
adapter: postgresql
encoding: unicode
# https://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
primary:
<<: *default
database: mrt_development
username: deploy_root
password: [...]
primary_replica:
<<: *default
database: mrkt_test
username: deploy_readonly
password: password
replica: true
The [rails guide][1] provides no indications as to 'reading' roles.
What should be done to get a proper connection running? [1]: https://guides.rubyonrails.org/configuring.html#database-pooling
Update
Interesting behaviour observed: a deployment has led to the same error being generated on the remote server.