upating_unit3d_version/upating_unit3d_version.md

2.4 KiB

Updating UNIT3D

Update UNIT3D to the latest version by reviewing the release notes and following the steps below:

1. Create Backup

UNIT3D offers built-in backups. Refer to the Backups documentation for usage.

[!IMPORTANT]
Ensure a complete backup is on hand before proceeding.

2. Enter Maintenance Mode

cd /var/www/html
php artisan down

3. Update UNIT3D

Proceed to update UNIT3D:

Copy the latest backup to ~/tempBackup before starting.

cd /var/www/html
php artisan git:update 2>&1 | tee ~/tempBackup/updateLogs.txt

3.1 UNIT3D fetches the new code and prompts for action on file conflicts. It is suggested to accept the updated files. After the update, review ~/tempBackup/updateLogs.txt for conflicts. Any modifications will need to be re-implemented with the new code.

3.2 Run new migrations

3.3 Install new packages

3.4

4. Resume Site Functionality

On a successful update process; clear the cache, restart the PHP-FPM service, restart the Laravel queues, and finally bring the site live.

sudo php artisan set:all_cache && \
sudo systemctl restart php8.4-fpm && \
sudo php artisan queue:restart && \
sudo php artisan up

[!TIP]
If running external Unit3d-Announce, restart the supervisor services.

sudo supervisorctl reread && \
sudo supervisorctl update && \
sudo supervisorctl reload 

Troubleshooting Clean-up

During the update, an error related to a migration is a common occurance. It is important to review the error being described and make changes accordingly to clear any issues with the data at hand.

The below list of commands to finish a complete update process:

Finish any migrations not completed:
sudo php artisan migrate

Reinstall dependencies:
sudo -u www-data composer install --prefer-dist --no-dev -o

Clear caches:

sudo php artisan cache:clear  && \
sudo php artisan queue:clear  && \
sudo php artisan auto:email-blacklist-update && \
sudo php artisan auto:cache_random_media && \
sudo php artisan set:all_cache  

Rebuild static assets:
bun install && bun run build

Restart the PHP-FPM service:
sudo systemctl restart php8.4-fpm

Restart the Laravel queues:
sudo php artisan queue:restart

Bring the site live:
sudo php artisan up

[!TIP]
If running external Unit3d-Announce, restart the supervisor services.

sudo supervisorctl reread && \
sudo supervisorctl update && \
sudo supervisorctl reload