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


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. WordPress (Managed)
  3. Civicrm (Wordpress) can't connect to database after Cloudron reboot

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

Scheduled Pinned Locked Moved WordPress (Managed)
14 Posts 5 Posters 1.9k Views 5 Watching
  • 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.
    • jeauJ Offline
      jeauJ Offline
      jeau
      App Dev
      wrote on last edited by
      #1

      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)]"]
      )
      
      
      jdaviescoatesJ 1 Reply Last reply
      0
      • jeauJ jeau

        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)]"]
        )
        
        
        jdaviescoatesJ Offline
        jdaviescoatesJ Offline
        jdaviescoates
        wrote on last edited by
        #2

        @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

        humptydumptyH 1 Reply Last reply
        2
        • jdaviescoatesJ jdaviescoates

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

          humptydumptyH Offline
          humptydumptyH Offline
          humptydumpty
          wrote on last edited by
          #3

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

          jdaviescoatesJ 1 Reply Last reply
          2
          • humptydumptyH humptydumpty

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

            jdaviescoatesJ Offline
            jdaviescoatesJ Offline
            jdaviescoates
            wrote on last edited by
            #4

            @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
            1
            • jeauJ Offline
              jeauJ Offline
              jeau
              App Dev
              wrote on last edited by
              #5

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

              jdaviescoatesJ martinkbsM 2 Replies Last reply
              3
              • jeauJ jeau

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

                jdaviescoatesJ Offline
                jdaviescoatesJ Offline
                jdaviescoates
                wrote on last edited by
                #6

                @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
                2
                • jeauJ jeau

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

                  martinkbsM Offline
                  martinkbsM Offline
                  martinkbs
                  wrote on last edited by
                  #7

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

                  girishG 1 Reply Last reply
                  3
                  • martinkbsM martinkbs

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

                    girishG Offline
                    girishG Offline
                    girish
                    Staff
                    wrote on last edited by
                    #8

                    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

                    martinkbsM 1 Reply Last reply
                    3
                    • girishG girish

                      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

                      martinkbsM Offline
                      martinkbsM Offline
                      martinkbs
                      wrote on last edited by
                      #9

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

                      Thanks team!

                      1 Reply Last reply
                      2
                      • jeauJ Offline
                        jeauJ Offline
                        jeau
                        App Dev
                        wrote on last edited by
                        #10

                        thanks @martinkbs I learn every day 👍

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

                        1 Reply Last reply
                        2
                        • jeauJ Offline
                          jeauJ Offline
                          jeau
                          App Dev
                          wrote on last edited by
                          #11

                          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?

                          girishG 1 Reply Last reply
                          0
                          • jeauJ jeau

                            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?

                            girishG Offline
                            girishG Offline
                            girish
                            Staff
                            wrote on last edited by
                            #12

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

                            jeauJ 1 Reply Last reply
                            1
                            • girishG girish

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

                              jeauJ Offline
                              jeauJ Offline
                              jeau
                              App Dev
                              wrote on last edited by
                              #13

                              @girish thanks,

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

                              1 Reply Last reply
                              1
                              • jeauJ Offline
                                jeauJ Offline
                                jeau
                                App Dev
                                wrote on last edited by
                                #14

                                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
                                1
                                • jeauJ jeau referenced this topic on
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Bookmarks
                                  • Search