Issue with Matomo 4.0.0 package update: "The directory "/app/code/tmp/cache/tracker/" does not exist and could not be created"
-
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?
-
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):
- 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
- Download from the /tmp directory the matomo-mysqldump.sql file.
- Deploy a new instance of Matomo (on a new domain of course for now)
- 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
- 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
- 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.
- In the Terminal of the original Matomo app instance, run this command:
-
@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.
-
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.
-
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
-
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.
-
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):
- 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
- Download from the /tmp directory the matomo-mysqldump.sql file.
- Deploy a new instance of Matomo (on a new domain of course for now)
- 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
- 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
- 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.
- In the Terminal of the original Matomo app instance, run this command:
-
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.