From 72314748385399c9a9e2b0ba9b429bff709cd03c Mon Sep 17 00:00:00 2001 From: acsok Date: Fri, 14 Jun 2024 12:47:28 -0400 Subject: [PATCH] Revised based on testing while running the upgrades the second time --- .../Database Migration Scripts.md | 34 ++++++++++++++----- .../Postgres + docker compose setup.md | 8 ++--- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/content/VCS-Documentation/server-install/Database Migration Scripts.md b/content/VCS-Documentation/server-install/Database Migration Scripts.md index e816bb4f8..9bca8c201 100644 --- a/content/VCS-Documentation/server-install/Database Migration Scripts.md +++ b/content/VCS-Documentation/server-install/Database Migration Scripts.md @@ -10,6 +10,13 @@ This directory contains scripts for migrating an SQLite database to a Postgres d - Liquibase installed (Automated with [[Postgres + docker compose setup]]) - Execution of Liquibase scripts (Automated with [[Postgres + docker compose setup]]) - SQLite database file(s) to be migrated(for existing server upgrades only) +- sqlite3 installed (for existing server upgrades only) +``` +sudo zypper refresh +``` +``` +sudo zypper install sqlite3 +``` ## Setup @@ -24,9 +31,19 @@ chmod +x update_server_id.sh ``` #### Existing Server Upgrade Only -For single server grab the `vcs.db` file, and rename it `serverID.db`(use the actual server id of the server, in case of `vcs.db-wall` and `vcs.db-shm` rename those with the server id as well). -For multi server gather all the `vcs.db` files and rename as mentioned in the single server step. +For single server grab the `vcs.db` file, and rename it `serverID.db`(use the actual server id of the server, in case of `vcs.db-wal` and `vcs.db-shm` rename those with the server id as well). +Example: +``` +cp /usr/vcs/database/vcs.db './Test VM.db' +``` +``` +cp /usr/vcs/database/vcs.db-shm './Test VM.db-shm' +``` +``` +cp /usr/vcs/database/vcs.db-wal './Test VM.db-wal' +``` +For multi server do the same with their own server id. Move the database file(s) to the scripts directory(`/usr/vcs/docker/migration-scripts`) ## Running the Migration @@ -48,20 +65,21 @@ Example: `docker exec -i artsentry-services-postgres-1 psql -U vcs -d postgres Run the `update_server_id.sh` script with the `server_id` and the `docker_command` parameter: -Example of running the script with Docker instance of Postgres: +Example of running the script with Docker instance of Postgres(replace server_id, name of docker container, user, and database with the correct information): -```bash -./update_server_id.sh 'server_id' 'docker exec -i artsentry-services-postgres-1 psql' > migration.log +``` +./update_server_id.sh 'server_id' docker exec -i artsentry-services-postgres-1 psql -U vcs -d postgres > migration.log ``` #### Existing Server Upgrade To run the migration process, execute the `database_migration.sh` script with `docker_command` parameter: -Example of running the script with Docker instance of Postgre: +Example of running the script with Docker instance of Postgres(replace server_id, name of docker container, user, and database with the correct information): -```bash -./database_migration.sh 'docker exec -i artsentry-services-postgres-1 psql' ``` +./database_migration.sh docker exec -i artsentry-services-postgres-1 psql -U vcs -d postgres > migration.log +``` +>This step takes some time to finish. If anything fails, failure will be shown in the console, otherwise messages are piped into migration.log #### Start VCS Server After completing the required steps in [[Postgres + docker compose setup]] and executing the script(s) above, start the VCS Server diff --git a/content/VCS-Documentation/server-install/Postgres + docker compose setup.md b/content/VCS-Documentation/server-install/Postgres + docker compose setup.md index bc75e2e41..0ac8dd047 100644 --- a/content/VCS-Documentation/server-install/Postgres + docker compose setup.md +++ b/content/VCS-Documentation/server-install/Postgres + docker compose setup.md @@ -43,10 +43,10 @@ export DATABASE_URL=jdbc:postgresql://localhost:5445/postgres ### Initialize docker and docker compose **New Server Install** -`docker.zip` and `initialize_docker.sh` will be extracted into `/usr/vcs`(or install dir) at installation of VCSServer +`docker.zip` and `initialize_docker.sh` will be extracted into `/usr/vcs`(or install dir) at the installation of VCSServer **Existing Server Upgrade** -Copy `docker.zip` and `initialize_docker.sh` to `/usr/vcs`(or install dir) from the the upgrade_package +`docker.zip` and `initialize_docker.sh` should have been copied into `/usr/vcs`(or install dir) from the the upgrade_package (First step in [[Server Install]]) The initialize script will install docker and the docker compose plugin. Navigate to `/usr/vcs` and run the `initialize_docker.sh` script ```bash @@ -154,7 +154,7 @@ docker login ghcr.io -u USERNAME Change the directory to `/usr/vcs/docker`, make sure the `.env` file is located in `/usr/vcs/compose-cfg` and is configured as described above. To start all the services that VCS requires, run: -```bash +``` docker compose --env-file ../compose-cfg/.env up -d ``` @@ -166,7 +166,7 @@ docker compose --env-file ../compose-cfg/.env stop Note: Since the `.env` file is not located next to the compose file it needs to be specified to each docker compose command. To remove all the docker images -```bash +``` docker compose --env-file ../compose-cfg/.env down ```