Your software
My Mautic version is: 4.4.0
My PHP version is: 7.4
My Database type and version is: MySQL 5+
Your problem
My problem is: Saw the tweet announcement about minor update to v4.4.0 - did an composer update and was greeted with “New Mautic Installation” page.
These errors are showing in the log:
Steps I have tried to fix the problem:
- Noticed that local.php was gone after the composer update.
- Restored only local.php file from v4.3.1 backup … Mautic site back up at v4.4.0 but I don’t know if that broke anything else …
1 Like
I experienced the same issue. Did a VM snapshot just before, so decided to rollback.
I have scripted the composer update for Mautic. I always do scripts for composer stuff after years of working with Drupal. The basic steps are:
- Copy local.php to safety
- Do a dry run composer: update composer update --with-all-dependencies --dry-run
- If looks OK run for real
- Copy back local.php
- Run migrations: /usr/bin/php /var/www/mautic/bin/console doctrine:migration:migrate
- Clear cache: rm -rf /var/www/mautic/docroot/var/cache/*
I’ve used this process on that last few Mautic updates without issue.
Mautic seems to be evolving rapidly, so having a snapshot is not a bad idea as well.
3 Likes
I think that should be probably documented. Especially if you said you tested it with success since few updates, it’s great to know it!
Hi folks!
@favourchi is working on updating the docs relating to installing/updating Mautic over this next week - it would be great to share some insights with her for the composer based side of things. Please drop into #composer on Slack (get an invite at Mautic Community On Slack) if you would like to contribute to making the docs better!
2 Likes
Here’s my script, I don’t do Slack but by all means share this with anyone, there’s nothing fancy in it but it does what I need.
#!/bin/bash
BLUE='\033[0;34m'
GREEN='\033[0;32m'
NC='\033[0m'
# Set these for your installation
MDIR="/var/www/mautic"
BDIR="/var/www/backup"
COMPOSER="/usr/local/bin/composer"
# Are we running as the mautic user? (probably www-data)
if [[ $EUID -ne 33 ]]; then
echo "This script must be run as www-data"
exit 1
fi
# Save local.php
cp $MDIR/docroot/app/config/local.php $BDIR
# Do dry run
cd $MDIR
composer update --with-all-dependencies --dry-run
# Check we are happy to run for real
while true; do
read -p "Are you happy to run this for real?" yn
case $yn in
[Yy]* ) composer update --with-all-dependencies; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
# Copy local.php back
cp $BDIR/local.php $MDIR/docroot/app/config
chmod g+w $MDIR/docroot/app/config/local.php
# Done
echo "Mautic Upgraded, running any migrations."
# Run any migration
/usr/bin/php /var/www/mautic/bin/console doctrine:migration:migrate
# Clear the cache
rm -rf $MDIR/docroot/var/cache/*
# Done
echo "Mautic updated, migrated and cache cleared"
2 Likes