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

    Solved Issue with Matomo 4.0.0 package update: "The directory "/app/code/tmp/cache/tracker/" does not exist and could not be created"

    Matomo
    5
    13
    357
    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.
    • d19dotca
      d19dotca last edited by d19dotca

      I updated my Matomo package as 4.0.0 was pushed out today, however upon upgrading I ran into this message and could not login as the login page wasn't even loading due to this error:

      The directory "/app/code/tmp/cache/tracker/" does not exist and could not be created.
      

      It seems that 4.0.0 may need a new directory created that doesn't yet exist and since it's in app/code it's not able to create it either.

      I've rolled back my install to the version prior from backup and all is well again. Will need to try to fix this before upgrading to 4.0.0.

      Has anyone else run into this issue with Matomo 4.0.0? Is it just me?

      --
      Dustin Dauncey
      www.d19.ca

      girish 1 Reply Last reply Reply Quote 0
      • d19dotca
        d19dotca last edited by

        Ran a test but will do a final switchover tomorrow, but for reference for anyone who comes across this in the future, it's as simple as these steps to migrate to a new Matomo instance (based on my initial test tonight) (steps mostly taken from https://docs.cloudron.io/guides/import-mysql/ and applied to Matomo):

        1. In the Terminal of the original Matomo app instance, run this command: mysqldump -h${CLOUDRON_MYSQL_HOST} -u${CLOUDRON_MYSQL_USERNAME} -p${CLOUDRON_MYSQL_PASSWORD} --single-transaction --routines --triggers ${CLOUDRON_MYSQL_USERNAME} > /tmp/matomo-mysqldump.sql
        2. Download from the /tmp directory the matomo-mysqldump.sql file.
        3. Deploy a new instance of Matomo (on a new domain of course for now)
        4. Put the new instance of Matomo into Recovery Mode and then enter the Terminal and run this command to clear out the database (a clean start): mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -Nse 'show tables' | while read table; do mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -e "SET FOREIGN_KEY_CHECKS = 0; drop table $table"; done
        5. Upload the matomo-mysqldump.sql file that had been downloaded from step 3 above to /tmp directory on new Matomo instance, then run this command to import the database: mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} < /tmp/matomo-mysqldump.sql
        6. Restart the app instance. Test, and then move old Matomo instance to a new domain, and put new Matomo instance on old domain so that website analytic agents don't need to be updated to any new domain. 😉 Adapt to your needs as necessary though.

        --
        Dustin Dauncey
        www.d19.ca

        1 Reply Last reply Reply Quote 3
        • robi
          robi last edited by

          This looks like a config & packaging bug.

          /tmp reference should be configured appropriately.

          Life of Advanced Technology

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

            @d19dotca said in Issue with Matomo 4.0.0 package update: "The directory "/app/code/tmp/cache/tracker/" does not exist and could not be created":

            It seems that 4.0.0 may need a new directory created that doesn't yet exist and since it's in app/code it's not able to create it either.

            The /app/code/tmp is already symlinked to /run/matomo/tmp. I checked a new install and it had this directory created (by matomo). Also, our cloudron.io, matomo instance updated fine as well. I also deleted tracker directory and restarted the app. Matomo creates that directory again.

            Do you have the logs before this error message? Would be good to know where in the start up script it fails.

            1 Reply Last reply Reply Quote 0
            • imc67
              imc67 translator last edited by

              Our Matomo update to 4.0.0 on two Cloudrons went fine.

              However good to know: one instance has a database of 1.2G and it took quite some time (I guess 3 minutes on a 10 core/68GB) to update/convert the database. In the meanwhile the instance showed only a warning page that the database needs to be updated while it was actually already busy. I "knew" that because it was the second instance and the update/conversion of first instance (much smaller) went fine.

              1 Reply Last reply Reply Quote 1
              • nebulon
                nebulon Staff last edited by

                @d19dotca is this still an issue now or was it just temporary?

                d19dotca 1 Reply Last reply Reply Quote 0
                • d19dotca
                  d19dotca @nebulon last edited by

                  I will try the upgrade again later today and let you know. I anticipate the same issue but if it happens again I’ll be sure to grab the full logs from the app too before I restore from backup.

                  --
                  Dustin Dauncey
                  www.d19.ca

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

                    @d19dotca So, to get out of this. After update, if it fails, repair the app and then go to terminal and create the directory "mkdir -p /run/matomo/tmp/cache/tracker" and then run '/app/pkg/start.sh'.

                    1 Reply Last reply Reply Quote 0
                    • d19dotca
                      d19dotca last edited by

                      Ran into the same issue, trying to repair now.

                      --
                      Dustin Dauncey
                      www.d19.ca

                      1 Reply Last reply Reply Quote 0
                      • d19dotca
                        d19dotca last edited by

                        The repair seemed to work. Unsure why I had to do this though when others didn't, not sure what's special about my install, but it seems to be working now. 🙂 Thank you for the help!

                        --
                        Dustin Dauncey
                        www.d19.ca

                        1 Reply Last reply Reply Quote 0
                        • d19dotca
                          d19dotca last edited by d19dotca

                          Actually, I get a different but possibly related error? I went into the System Check and see one error there now about another missing file on the File Integrity line:

                          Errors below may be due to a partial or failed upload of Matomo files.
                          --> Try to reupload all the Matomo files in BINARY mode. <--
                          
                          Missing file: /app/code/misc/user/index.html
                          

                          Does anyone else see that message too in the System Check, or is it just me again? lol

                          Here's what's in the directory when I check in on it (it's definitely missing the index.html file):

                          root@b11704ef-8d66-4b9c-a43b-57483d5ce25b:/app/code/misc/user# ls -alh
                          total 96K
                          drwxr-xr-x 2 www-data www-data 4.0K Nov 27 02:52 .
                          drwxr-xr-x 3 www-data www-data 4.0K Nov 27 02:52 ..
                          -rw-r--r-- 1 www-data www-data 1.2K Nov 28 05:41 .htaccess
                          -rw-r--r-- 1 www-data www-data 1.4K Nov 27 02:52 favicon.png
                          -rw-r--r-- 1 www-data www-data 9.3K Nov 27 02:52 logo-header.png
                          -rw-r--r-- 1 www-data www-data  65K Nov 27 02:52 logo.png
                          

                          --
                          Dustin Dauncey
                          www.d19.ca

                          1 Reply Last reply Reply Quote 0
                          • d19dotca
                            d19dotca last edited by

                            I can confirm when I deploy a fresh Matomo instance, it doesn't have the issue of the missing index.html file. No idea why my instance seems to be running into multiple issues with file integrity, but I'm perhaps going to check next to see if I can migrate the data from one to a new instance so I know it's in a cleaner state at that point.

                            --
                            Dustin Dauncey
                            www.d19.ca

                            1 Reply Last reply Reply Quote 1
                            • d19dotca
                              d19dotca last edited by

                              Ran a test but will do a final switchover tomorrow, but for reference for anyone who comes across this in the future, it's as simple as these steps to migrate to a new Matomo instance (based on my initial test tonight) (steps mostly taken from https://docs.cloudron.io/guides/import-mysql/ and applied to Matomo):

                              1. In the Terminal of the original Matomo app instance, run this command: mysqldump -h${CLOUDRON_MYSQL_HOST} -u${CLOUDRON_MYSQL_USERNAME} -p${CLOUDRON_MYSQL_PASSWORD} --single-transaction --routines --triggers ${CLOUDRON_MYSQL_USERNAME} > /tmp/matomo-mysqldump.sql
                              2. Download from the /tmp directory the matomo-mysqldump.sql file.
                              3. Deploy a new instance of Matomo (on a new domain of course for now)
                              4. Put the new instance of Matomo into Recovery Mode and then enter the Terminal and run this command to clear out the database (a clean start): mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -Nse 'show tables' | while read table; do mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -e "SET FOREIGN_KEY_CHECKS = 0; drop table $table"; done
                              5. Upload the matomo-mysqldump.sql file that had been downloaded from step 3 above to /tmp directory on new Matomo instance, then run this command to import the database: mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} < /tmp/matomo-mysqldump.sql
                              6. Restart the app instance. Test, and then move old Matomo instance to a new domain, and put new Matomo instance on old domain so that website analytic agents don't need to be updated to any new domain. 😉 Adapt to your needs as necessary though.

                              --
                              Dustin Dauncey
                              www.d19.ca

                              1 Reply Last reply Reply Quote 3
                              • d19dotca
                                d19dotca last edited by d19dotca

                                Okay so after multiple file integrity issues ("X does not exist"), I opted to install a new Matomo instance, and migrated the data from old to new. It seems to be working well and passes all system checks now. I think this can be marked resolved. I still don't know how it ever got into that state, but it's good again. 🙂

                                --
                                Dustin Dauncey
                                www.d19.ca

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