Fixes #209 - Impossible to run platform services on a shared database #212
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix Impossible to run platform services on a shared database (#209)
What does this PR do?
This pull request adds the
flyway. schemas
property to the docker application profile of each platform service to save theflyway_schema_history
table in the same schema used by the service and not in thepublic
schema. This prevents conflict and fixes the issue of running multiple platform services on a shared database.Changes made:
How to test:
Build code...
git clone git@github.com:opendatamesh-initiative/odm-platform.git cd ./odm-platform mvn clean install -DskipTests
Run Postgres container...
Run registry container...
docker build -t odmp-postgres-registry . -f product-plane-services/registry-server/Dockerfile \ --build-arg DATABASE_URL=jdbc:postgresql://odmp-postgres:5432/odmpdb \ --build-arg DATABASE_USERNAME=postgres \ --build-arg DATABASE_PASSWORD=postgres \ --build-arg FLYWAY_SCRIPTS_DIR=postgresql docker run --name odmp-postgres-registry -d --network odmp-network -p 8001:8001 odmp-postgres-registry
Run notification container...
docker build -t odmp-postgres-notification . -f product-plane-services/notification-server/Dockerfile\ --build-arg DATABASE_URL=jdbc:postgresql://odmp-postgres:5432/odmpdb \ --build-arg DATABASE_USERNAME=postgres \ --build-arg DATABASE_PASSWORD=postgres \ --build-arg FLYWAY_SCRIPTS_DIR=postgresql docker run --name odmp-postgres-notification -d --network odmp-network -p 8006:8006 odmp-postgres-notification
Restart containers...
The restart of services MUST be completed successfully.
🔴 WARNING 🔴 Before running the new version of a service during an upgrade, the existing flyway_schema_history table must be copied from the previous schema (typically public) to the specific schema used by the service. For example, for the registry service, the following instruction should be executed in PostgreSQL to replicate the flyway_schema_history table within the
ODMREGISTRY
schema