Civicrm (Wordpress) can't connect to database after Cloudron reboot
-
@jeau this, like most problems with WordPress on here, is quite likely something to do with using WordPress (Managed) which is locked down, instead of WordPress (Developer) which is more like how WordPress should be and needs to be for lots of plugins to work properly.
-
@jdaviescoates maybe the “developer” wording has to be changed to something more accurate but i can’t think of anything more fitting lol.
-
@humptydumpty imho WordPress (Managed) should cease to exist and WordPress (Developer) should just be called WordPress
-
@jdaviescoates @humptydumpty I don't know if the problem comes from Wordpress Managed or not,
I spend time trying a lot of things in vain. Then I reread the error message and I remembered that the mysql credentials were stored in hard in the Civicrm configuration file (not via Cloudron variables). I solved my problem by entering the right information
But is it possible that Cloudron changes the credentials of an app after a reboot? it seems strange, am I wrong?
-
@jeau said in Civicrm (Wordpress) can't connect to database after Cloudron reboot:
I don't know if the problem comes from Wordpress Managed or not,
Me neither, that's just my go to response for any issues with WordPress here because it seems to very often be the case that that is what's causing the problems .
Of course, there will always be exceptions to the rule.
@jeau said in Civicrm (Wordpress) can't connect to database after Cloudron reboot:
I solved my problem by entering the right information
-
@jeau @jdaviescoates The mysql host IP changes every time the server is restarted.
If you access the SSH console of your server and enter the following command, you will see the current IP.
docker inspect mysql | grep IPAddress
root@xxxxxxxxx:~# docker inspect mysql | grep IPAddress "SecondaryIPAddresses": null, "IPAddress": "", "IPAddress": "172.18.0.18",
If you restart and repeat the process, you will see how the IP has changed (at least in its last two digits).
This host value is important when you make external connections to the WordPress database through an SSH tunnel.
-
What @martinkbs said is most likely the issue. Docker provides a dynamic IP and this changes on docker restart (and thus server reboot). You have to use environment variables ideally.
That said, in 7.4, the docker containers now have a static IP - https://git.cloudron.io/cloudron/box/-/commit/582994b9d646989b42e27dde1ae0c27bbb964834
-
It doesn't work. I checked the data and it's not the latest
Here is how I proceed
- I restore my application from the backup that preceded the problem on Monday reboot.
- if I try to access CiviCRM, I get the error message indicated at the beginning of this thread.
- I change the identifiers in the CIviCRM configuration file,
- it works then, I can access the CiviCRM backend but the database is not the right one...
I had made a clone of this application a while ago (I don't remember when?). I deleted it this weekend, is it possible that in my application CiviCRM tries to use the database of the cloned application that disappeared?
-
@jeau said in Civicrm (Wordpress) can't connect to database after Cloudron reboot:
I deleted it this weekend, is it possible that in my application CiviCRM tries to use the database of the cloned application that disappeared?
yes, it's entirely possible that after the clone, the cloned app is still using the same database as the main app. This is the reason to use the environment variables, they automatically change per app.
If you have the backups, you can import it then - https://docs.cloudron.io/backups/#import-app-backup .
-
I recovered the backup and restarted the cloned app that I had deleted before the reboot. So the problem was not the reboot but the deletion.
It works. The database is accessible even if the application is stopped. This is quite confusing for me.
Maybe a warning should be added in the doc
https://docs.cloudron.io/backups/#clone-appThe problem makes a lot of sense and I made a mistake, but I think other people can do the same.
I will take some time to fix it.
Thanks for all
-