diff --git a/upating_unit3d_version.md b/upating_unit3d_version.md index d0d18d4..ffaa0af 100644 --- a/upating_unit3d_version.md +++ b/upating_unit3d_version.md @@ -16,125 +16,98 @@ cd /var/www/html php artisan down ``` -## 3. Update Meilisearch +## 3. Update UNIT3D -- **Stop** the service and install the latest Meilisearch: +> **Note:** Before running the actual update, make sure your environment meets the new release’s minimum requirements. -```bash -sudo apt update -sudo apt upgrade -sudo systemctl stop meilisearch -sudo curl -L https://install.meilisearch.com | sudo sh -sudo mv ./meilisearch /usr/local/bin/ -sudo chmod +x /usr/local/bin/meilisearch -sudo rm -rf /var/lib/meilisearch/data -``` +1. **Fetch and apply updates** + ```bash + cd /var/www/html + php artisan git:update + ``` -- **Restart** Meilisearch: +2. **Review and resolve conflicts** -```bash -sudo chmod +x /usr/local/bin/meilisearch -sudo systemctl start meilisearch -``` + 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. -## 4. Update PHP - -- **Refer** to the **Upgrading PHP Version** documentation. + ![unit3d](https://ptpimg.me/vxefo6.png) -## 5. Update UNIT3D + ````bash + Update config/unit3d.php (yes/no) [yes]: + > yes -- **Proceed** to update UNIT3D after completing the PHP upgrade steps: + git checkout origin/master -- config/unit3d.php + [============================] (Done!) -```bash -cd /var/www/html -php artisan git:update -``` + Update resources/sass/components/_quick_search.scss (yes/no) [yes]: + > yes + ```` -During the update, UNIT3D prompts for action on file differences. Copy the latest backup to `~/tempBackup` before starting. After the update, review `~/tempBackup/fileConflicts.txt` for conflicts. +3. **Run new migrations** + ```bash + php artisan migrate + ``` -## 6. Database Migration Fix -During the update, an error related to the `tickets` table may occur: +## 4. Resume Site Functionality -```sql -2025_02_17_074140_update_columns_to_boolean ......................................................................................... 38.50ms FAIL +On a successful update process; clear the cache, restart the PHP-FPM service, restart the Laravel queues, and finally bring the site live. -In Connection.php line 825: - SQLSTATE[22004]: Null value not allowed: 1138 Invalid use of NULL value (Connection: mysql, SQL: alter table `tickets` modify `staff_read` tinyint(1) not null default '0') - -In Connection.php line 571: - SQLSTATE[22004]: Null value not allowed: 1138 Invalid use of NULL value -``` - -**Resolve** `Null` values in `tickets` table: - -1. Log in to MySQL: - -```bash -mysql -u your_username -p -``` - -**Enter** the MySQL password when prompted. After logging in, select the appropriate database by running: - -```bash -USE your_database_name; -``` - -2. Fix the Null Values: - -**Update** `NULL` entries in the `staff_read` column to `0` by running the following SQL command: - -```sql -UPDATE tickets SET staff_read = 0 WHERE staff_read IS NULL; -``` - -3. Exit MySQL: - -```sql -exit; -``` - -4. Complete migrations: - -```bash -php artisan migrate -``` - ---- - -## 7. Final Reset & Cleanup - -- Clear caches, reinstall dependencies, rebuild assets, and restart services after updating and migrating. - -```bash -sudo -u www-data composer install --prefer-dist --no-dev -o && \ -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 && \ -bun install && \ -bun run build && \ -sudo php artisan migrate && \ -sudo systemctl restart php8.4-fpm && \ -sudo php artisan queue:restart && \ -sudo supervisorctl reread && \ -sudo supervisorctl update && \ -sudo supervisorctl reload && \ -sudo php artisan scout:sync-index-settings && \ -sudo php artisan auto:sync_torrents_to_meilisearch --wipe && \ -sudo php artisan auto:sync_people_to_meilisearch -``` - -- Resume normal site functionality: - -```bash -sudo php artisan scout:sync-index-settings && \ -sudo php artisan auto:sync_torrents_to_meilisearch --wipe && \ -sudo php artisan auto:sync_people_to_meilisearch && \ +```sh 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. + +```sh +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: +```sh +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. + +```sh +sudo supervisorctl reread && \ +sudo supervisorctl update && \ +sudo supervisorctl reload ``` \ No newline at end of file