Skip to main content

Update

Process for updating ION Guard to a newer version safely and with rollback capability.

Command

cd /home/iongrade/ionguard
./scripts/upgradeToNewestVersion.sh -v 0.2.0

Parameters

FlagRequiredDescription
-v VERSIONYesTarget version (e.g., 0.2.0)
-bNoSkip rebuilding the Docker images
-qNoQuick update — graceful PHP-FPM reload instead of a full restart
-uNoSkip upgrade warnings

Update flow

The script runs the following steps in order:

1. Download the package

On-premises: Downloads the encrypted package from the distribution server and decrypts it with the facility passphrase.

SaaS: Updates via git fetch and git checkout of the version tag.

2. Stop workers

Queue workers (Horizon), the scheduler, and MQTT listeners are stopped to prevent processing during the migration.

3. Back up the current code

The app/ directory is atomically renamed to app_old/. This enables instant rollback in case of failure.

4. Extract the new version

The new code and deployment files are extracted into the correct directories.

5. Database migration

php artisan migrate --force
Automatic rollback

If the migration fails, the script automatically restores app_old/ to app/ and restarts the services with the previous version. The update is aborted with an error message.

6. Clear cache and optimize

php artisan optimize:clear
php artisan optimize

7. Restart the services

All containers are restarted with the new code.

8. Permissions

File permissions are readjusted via setPermissions.sh.

9. Cleanup

The app_old/ directory is removed after confirming everything is working.

Quick update

The -q flag performs a graceful reload of PHP-FPM instead of restarting all containers. This minimizes downtime for minor updates that do not change the infrastructure:

./scripts/upgradeToNewestVersion.sh -v 0.2.1 -q

Post-update verification

After the update, check:

# Check version
./scripts/getVersion.sh

# Health check
./scripts/healthcheck.sh

# Container status
./scripts/comp.sh ps

# Error logs
./scripts/comp.sh logs -f ionguard_php --tail 50

Manual rollback

If you need to perform a manual rollback (in case the automatic one did not occur):

# If app_old/ still exists
mv app app_bad && mv app_old app

# Revert migrations (if the migration was applied)
./scripts/comp.sh exec -T ionguard_php php artisan migrate:rollback

# Restart
./scripts/restartAllServices.sh
Caution

Before updating, always check the release notes of the target version for specific instructions or breaking changes.