fix: Fixes documentation and migration code.
All checks were successful
Release code / build (push) Successful in 9m48s

This commit is contained in:
Tera << 8 2024-12-26 14:59:01 -05:00
parent 84e1a437a4
commit 862f307e56
Signed by: imterah
GPG key ID: 8FA7DD57BA6CEA37
2 changed files with 17 additions and 13 deletions

View file

@ -15,14 +15,18 @@ Below are new environment variables that may need to be set up:
* `HERMES_SQLITE_FILEPATH`: Path for the SQLite database to use.
* `HERMES_POSTGRES_DSN`: PostgreSQL DSN for Golang. An example value which should work with minimal changes for PostgreSQL databases is `postgres://username:password@localhost:5432/database_name`.
## Migration steps
1. Add the supporting environment variable for Prisma: `DATABASE_URL` -> `postgresql://$POSTGRES_USERNAME:$POSTGRES_PASSWORD@nextnet-postgres:5432/$POSTGRES_DB`.
2. Remove all old environment variables.
3. Add these variables:
1. Remove all old environment variables.
2. Add these variables:
- `HERMES_MIGRATE_POSTGRES_DATABASE` -> `$POSTGRES_DB`
- `HERMES_DATABASE_BACKEND` -> `postgresql`
- `HERMES_POSTGRES_DSN` -> `postgres://$POSTGRES_USERNAME:$POSTGRES_PASSWORD@nextnet-postgres:5432/$POSTGRES_DB`
- `DATABASE_URL` -> `postgresql://$POSTGRES_USERNAME:$POSTGRES_PASSWORD@nextnet-postgres:5432/$POSTGRES_DB?schema=nextnet`
4. Switch the API docker image from `ghcr.io/imterah/nextnet:latest` to `ghcr.io/imterah/hermes-backend-migration:latest`
5. Go get the container logs, and make sure no errors get output to the console.
6. Copy the backup as instructed in the log file.
7. DO NOT RESTART THE CONTAINER IF SUCCESSFUL. YOU WILL LOSE ALL YOUR DATA. If the migration fails, follow the steps mentioned in the logs.
8. If successful, switch the API docker image from `ghcr.io/imterah/hermes-backend-migration:latest` to `ghcr.io/imterah/hermes:latest`.
3. Switch the API docker image from `ghcr.io/imterah/nextnet:latest` to `ghcr.io/imterah/hermes-backend-migration:latest`
4. Change the exposed ports from `3000:3000` to `3000:8000`.
5. Start the Docker compose stack.
6. Go get the container logs, and make sure no errors get output to the console.
7. Copy the backup as instructed in the log file.
8. DO NOT RESTART THE CONTAINER IF SUCCESSFUL. YOU WILL LOSE ALL YOUR DATA. If the migration fails, follow the steps mentioned in the logs. You do not need to copy the DB backup if it failed to connect or read the database.
9. If successful, remove the environment variable `HERMES_MIGRATE_POSTGRES_DATABASE`.
10. Switch the API docker image from `ghcr.io/imterah/hermes-backend-migration:latest` to `ghcr.io/imterah/hermes:latest`.
11. Start the backend.