Saltar al contenido principal

⬆️ Upgrading

When a new version of Monitron SaaS is released, follow these steps to upgrade safely.


📋 Before You Upgrade

aviso

Always back up before upgrading!

1. Back Up Your Database

# MySQL
mysqldump -u monitron_user -p monitron > backup_$(date +%Y%m%d).sql

# PostgreSQL
pg_dump -U monitron_user monitron > backup_$(date +%Y%m%d).sql

2. Back Up Your .env File

cp /var/www/monitron/.env /var/www/monitron/.env.backup

3. Back Up Uploaded Files

cp -r /var/www/monitron/storage/app/public /tmp/monitron-uploads-backup

🔄 Upgrade Steps

Step 1: Enable Maintenance Mode

cd /var/www/monitron
php artisan down

This shows a "503 Service Unavailable" page to visitors and pauses all monitoring.

Step 2: Replace Application Files

Upload or extract the new version files, but preserve these files/folders:

Keep TheseWhy
.envYour configuration
storage/Logs, cache, uploads
storage/installed.lockPrevents reinstall wizard
# Example using rsync (preserves .env, storage, and vendor)
rsync -av --exclude='.env' --exclude='storage/' --exclude='vendor/' \
/path/to/new-version/ /var/www/monitron/

Step 3: Install Updated Dependencies

composer install --no-dev --optimize-autoloader

Step 4: Run Database Migrations

php artisan migrate --force

The --force flag is required in production.

Step 5: Clear All Caches

php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan optimize

Step 6: Restart Queue Workers

php artisan queue:restart
# or
sudo supervisorctl restart monitron-worker:*

Step 7: Disable Maintenance Mode

php artisan up

✅ Post-Upgrade Checklist

  • Dashboard loads correctly
  • Monitors are running (check Last Check column)
  • Queue workers are processing (check supervisorctl status)
  • Notifications are working (trigger a test)
  • Status pages are accessible
  • AI features work (if enabled)
  • Check storage/logs/laravel.log for errors

🆘 Rollback

If something goes wrong:

# 1. Enable maintenance mode
php artisan down

# 2. Restore your database backup
mysql -u monitron_user -p monitron < backup_YYYYMMDD.sql

# 3. Restore the previous version files
# (replace with your backup method)

# 4. Restore .env if overwritten
cp .env.backup .env

# 5. Clear caches
php artisan config:clear
php artisan cache:clear

# 6. Disable maintenance mode
php artisan up