Setup of Mastodon with remote PostgreSQL database


I’m trying to setup Mastodon on a VPS under one of my dedicated servers (I’m using SolusVM and a virtual machine just for this purpose), which has 6 vCPUs and 8 GB of RAM, along with 120 GB of SSD space. The dedicated server itself has 128 GB of DDR3 ECC RAM, a modern Intel Xeon CPU, etc. Basically it hosts a number of clients for our web-hosting company, GekkoFyre Networks, but still has enough spare resources for this VM instance.

Anyway! When I try to execute, RAILS_ENV=production bundle exec rake db:schema:load_if_ruby, I get the following error:

warning: parser/current is loading parser/ruby26, which recognizes
warning: 2.6.2-compliant syntax, but you are running 2.6.1.
warning: please see
FATAL:  no pg_hba.conf entry for host "<redacted>", user "db01_<redacted>_draconity", database "postgres", SSL off
Couldn't create 'db01_draconity' database. Please check your configuration.
rake aborted!
PG::ConnectionBad: FATAL:  no pg_hba.conf entry for host "<redacted>", user "db01_<redacted>_draconity", database "postgres", SSL off
/home/mastodon/.rbenv/versions/2.6.1/bin/bundle:23:in `load'
/home/mastodon/.rbenv/versions/2.6.1/bin/bundle:23:in `<main>'
Tasks: TOP => db:schema:load_if_ruby => db:create
(See full trace by running task with --trace)

These are my database settings under .env.production:


The PostgreSQL database is on a remote host, but under the same dedicated server so the latency is practically nil. All of the firewall ports are open, for both machines, and these are my /var/lib/pgsql/9.4/data/pg_hba.conf settings:

host db01_draconity db01_<redacted>_draconity <redacted>/32 md5
host db01_draconity db01_<redacted>_draconity <redacted>/32 md5

There are settings for other databases and remote hosts, all of which work fine. The PostgreSQL server version is 9.4 too, by the way, so I’m not sure if that matters. I’d sincerely appreciate any assistance on this matter, thank you.

Did you create the database in question? it looks like rails is trying to connect to the postgres database, which you haven’t allowed. My understanding is that it does this as a fallback if the database specified in database.yml (db01_draconity) doesn’t exist.

Hello @nightpool! Oh, that’s where the database information is supplied, proper. Nevermind though, I went ahead and simply installed PostgreSQL on the virtual machine provided for Mastodon, so I’m out of the woods now. Thanks! :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.