Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Civicrm (Wordpress) can't connect to database after Cloudron reboot

    WordPress (Managed)
    5
    14
    100
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • jeau
      jeau App Dev last edited by

      Hello

      I have a strange problem. Civicrm (a plugin installed in wordpress) fails to connect to the database with a reboot of the Cloudron installation.

      Here is the error message :

      Initialization Error
      
      Array
      (
          [callback] => Array
              (
                  [0] => CRM_Core_Error
                  [1] => simpleHandler
              )
      
          [code] => -24
          [message] => DB Error: connect failed
          [mode] => 16
          [debug_info] =>  [nativecode=Access denied for user '2820e61febc4492f'@'268a10b5-de5d-4d68-97d5-5ae1f75a144d.cloudron' (using password: YES)]
          [type] => DB_Error
          [user_info] =>  [nativecode=Access denied for user '2820e61febc4492f'@'268a10b5-de5d-4d68-97d5-5ae1f75a144d.cloudron' (using password: YES)]
          [to_string] => [db_error: message="DB Error: connect failed" code=-24 mode=callback callback=CRM_Core_Error::simpleHandler prefix="" info=" [nativecode=Access denied for user '2820e61febc4492f'@'268a10b5-de5d-4d68-97d5-5ae1f75a144d.cloudron' (using password: YES)]"]
      )
      
      
      jdaviescoates 1 Reply Last reply Reply Quote 0
      • jdaviescoates
        jdaviescoates @jeau last edited by

        @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.

        I use Cloudron with Gandi & Hetzner

        humptydumpty 1 Reply Last reply Reply Quote 2
        • humptydumpty
          humptydumpty @jdaviescoates last edited by

          @jdaviescoates maybe the “developer” wording has to be changed to something more accurate but i can’t think of anything more fitting lol.

          jdaviescoates 1 Reply Last reply Reply Quote 2
          • jdaviescoates
            jdaviescoates @humptydumpty last edited by

            @humptydumpty imho WordPress (Managed) should cease to exist and WordPress (Developer) should just be called WordPress

            I use Cloudron with Gandi & Hetzner

            1 Reply Last reply Reply Quote 1
            • jeau
              jeau App Dev last edited by

              @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?

              jdaviescoates martinkbs 2 Replies Last reply Reply Quote 3
              • jdaviescoates
                jdaviescoates @jeau last edited by

                @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

                👍

                I use Cloudron with Gandi & Hetzner

                1 Reply Last reply Reply Quote 2
                • martinkbs
                  martinkbs @jeau last edited by

                  @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.

                  girish 1 Reply Last reply Reply Quote 3
                  • girish
                    girish Staff @martinkbs last edited by

                    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

                    martinkbs 1 Reply Last reply Reply Quote 3
                    • martinkbs
                      martinkbs @girish last edited by

                      @girish That's a small change that will save a lot of headaches... 👍

                      Thanks team!

                      1 Reply Last reply Reply Quote 2
                      • jeau
                        jeau App Dev last edited by

                        thanks @martinkbs I learn every day 👍

                        @girish Sure, I will use the environment variables in the Civicrm configuration file

                        1 Reply Last reply Reply Quote 2
                        • jeau
                          jeau App Dev last edited by

                          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?

                          girish 1 Reply Last reply Reply Quote 0
                          • girish
                            girish Staff @jeau last edited by

                            @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 .

                            jeau 1 Reply Last reply Reply Quote 1
                            • jeau
                              jeau App Dev @girish last edited by

                              @girish thanks,

                              I have the tgz backup file but not the Backup config file

                              1 Reply Last reply Reply Quote 1
                              • jeau
                                jeau App Dev last edited by

                                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-app

                                The 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

                                1 Reply Last reply Reply Quote 1
                                • First post
                                  Last post
                                Powered by NodeBB