I wonder if you have a few tips on how to minimise issues with wordpress and mariadb on fly.io
I keep getting “database connection error” while using the Wordpress admin UI, but I can make changes, so I don’t think it’s a problem with authentication.
I’ve got one container and one volume for each (wp and mariadb), and both are using official docker images.
The wordpress is configurated with my-maria-container.internal as host.
I’ve upped both to 512MB RAM, and looking at the monitor screens it’s doesn’t seem to exceed this limit.
# mysql --version
mysql Ver 15.1 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
Then I used the db user according to the wp config and got this:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 500
Server version: 10.9.2-MariaDB-1:10.9.2+maria~ubu2204 mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
So to confirm, you were on the wordpress container and used the mysql cli to connect to the mariadb container? It seems like everything is working correctly?
I’m not sure I understand what “but I can make changes” means. Maybe this isn’t a database issue?
Yes. I had signed into the wp container and connected to Maria DB.
My issue is that I can indeed, log into Wordpress, and I can edit settings and update themes, etc, but every time I do so, I get a “connection error” message and have to reload the page. Except yesterday when I also started to get continuous 500 errors.
The DB connection seems fine, but this error seems to hint at some connectivity issue, just not authentication issue. Wordpress lists this error possibly due to “wrong db credentials”, “db timeout”, or “corrupt db tables”.
Well, it’s not “wrong db credentials” or “db timeout”. Maybe it is “corrupt db tables”? Not sure where to go from here, but perhaps the next step is to try a clean install.
Hmmm, it’s a fresh install, but I’ll see if I can ‘repair’ the tables first, then a fresh install perhaps with some optimisations I read in this fly.io thread.
Update: not sure how to rebuild tables without PhpMyAdmin, but I tried redeploying with optimisation new values in CMD, but couldn’t start the instance due to “allocation errors”. Maybe the volume needs to be killed? Removed the settings and could finish deployment, but still have the same errors as before…
Update: I set the debug flag in Wordpress and now receive the exposed error:
Warning: mysqli_real_connect(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/wp-includes/wp-db.php on line 1753 Warning: mysqli_real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/wp-includes/wp-db.php on line 1753
php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
Update, I added some optimisation options to the DB vars and seemed to be fast at first but went back to network errors… Here’s the DB TOML:
# fly.toml file generated for wp-maria on 2022-09-13T16:41:11+02:00
app = "wp-maria"
kill_signal = "SIGINT"
kill_timeout = 5
[mounts]
source = "mariadata"
destination = "/data"
[env]
MARIADB_DATABASE = "wordpress"
MARIADB_USER = REDACTED
[build]
image = "mariadb:10"
[experimental]
cmd = [
"--datadir","/data/maria",
"--innodb_buffer_pool_size", "400M", <-- 80% of total RAM
"--query_cache_type", "1",
"--query_cache_limit", "5M", <-- based on some guide where the total RAM was 1G and this value 10M
"--query_cache_size", "40M" <-- based on some guide where the total RAM was 1G and this value 80M
]
When changing the cache values and redeploying the DB, the site is initially very fast, then goes back to unresponsive.