In Error Logs, I’m intermittently receiving the following errors. It causes the site to be unreachable for 15-30 seconds until it returns.
Info Error Message:
PG::ConnectionBad (FATAL: the database system is in recovery mode) /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/pg-1.2.3/lib/pg.rb:58:in `initialize’
Env Error Message:
One really odd thing I’ve noticed looking at these logs is that it appears to be looking for the folder at /var/www/… but that folder does on exist on the server. Should it? Any help is appreciated.
If the database is broken, then the site is necessarily broken. You need to figure out why. The most common reasons are lack of ram and disk space. My guess is RAM. How much ram do you have? What does free -h output?
That’s the path inside the container. If you ./launcher enter app you’ll see it there.
Well, you have 646M available, and 4GB is enough that swap is not typically recommended. How big is your database? How much traffic do you have? Is anything other than Discourse running on the server?
Nothing besides discourse is running on the server.
To get the size I ran
./launcher enter app
rails db
SELECT pg_size_pretty(pg_database_size(current_database()));
The resulting output was 4650 MB (1 row)
As for traffic:
We had 1,200 pageviews yesterday, 12,400 in the last week. Approximately 160 users in the last week & about 80 concurrent users at any given moment.
You are the man. The 1 GB swap seems to have ended all crashing problems. I’m honestly glad it was a RAM issue & not a DB issue. I’m gonna increase my RAM amount on the server over the weekend. Thanks so much to all who helped in this thread!
Honestly not sure. Before this we had done a rebuild & server restart after changing the hardware a while back. I would assume after a reboot any system changes would’ve been seen by Discourse.
After installing the swap file there were times when over 4 GB of “memory” was being used, so it appears that was definitely the issue in our busiest times which coincides with the time periods when the server crashed. We upgraded today & the site is running very well now.
But they aren’t. There are settings that control, e.g., how much RAM the database can use that are embedded in app.yml. You can edit them by hand or re-run discourse-setup.