2023-12-07 01:16:59 +02:00

41 lines
2.7 KiB
Markdown

### Hot to run locally and test
1. Start docker compose from this dir
2. Start persistence-service with profile: dev
* this will create the tenant sync exchange
* startup might fail due to tenant-usermanagement not being up. but you need the tenant sync queue first)
3. Start tenant-user-management with profiles: dev, redaction, migration
* this will migrate the master DB and sync KC
* it will also send a message to persistence service to run the migration
* in case the message doesn't arrive - restart persistence and/or this service - the tenant migration in this service is idempotent
4. Persistence service should now queue 1869 files to layout-parser
5. Start layout-parser with profile: dev
6. Start redaction-service with profile: dev
7. Debug issues & repeat
8. UI is available at htpp://localhost:4200/ui -> login with manageradmin/OsloImWinter!23
9. To start clean. docker compose down and up again.
Useful info:
* This docker compose contains a dump from staging from ~2 weeks ago
* KC credentials are: admin / secretPasswordForAdmin1234
* To use different data you need a tenant-manager database dump from an environment of your choice
* this can be obtained via kubectl port forward like so: `kubectl -n <namespace> port-forward services/main-db-postgresql 5432`
* followed by a dump: `pg_dumpall -U tenantmanager -h 127.0.0.1 > main.sql`
* And a tenant database:
* this can be obtained via kubectl port forward like so: `kubectl -n <namespace> port-forward services/tenant-db-postgresql 5432`
* followed by a dump: `pg_dumpall -U tenantmanager -h 127.0.0.1 > tenant.sql`
* And a KC database:
* this can be obtained via kubectl port forward like so: `kubectl -n <namespace> port-forward services/keycloak-postgresql 5432`
* followed by a dump: `pg_dumpall -U tenantmanager -h 127.0.0.1 > tenant.sql`
* You can now use the migration/utils/database Dockerfile to create a fat DB image with the data ( replace data.sql with your dump and tag accordingly)
* For a minio dump you need a similar command ( port fwd sometimes crashes sine clone command uses a lot of connections ):
* open port forward `while true; do kubectl -n redaction-staging port-forward statefulset/redaction-staging-minio 9000 --request-timeout=10m; done`
* Install mc minio command line utility
* create an alias `mc alias set <mirror_name> http://localhost:9000 minioadminuser minioadminpassword`
* run: `while true; do mc mirror <mirror_name>/<bucket_name> ./<bucket_name>; done`
* use migration/utils/minio/Dockerfile to create an image -> you need to copy it to where the export is.
* After you have the images, replace the images in compose with the ones you want