Use PostgreSQL with Nexus instead of In-Memory H2 #2509
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.
✅ Checklist
Enable foobar integrationrather than515 foobar).develop.🚦 Depends on
N/A
A H2 database for a Nexus server is prone to data corruption. We have experienced this in production multiple times (like: #2481 ). In this PR, we replace the in-memory H2 database with a PostgreSQL one, using the following guidance.
This change requires the following:
networking.py).PG_TRGMextension, as is required by Nexus. We also add additional environment variables to the Nexus container, to instruct it to connect to PostgreSQL instead of H2 (seesoftware_repositories.py).data.py).init_db.mustache.sql) we rely on the existing SRE provisioning manager component. This class already does the same for the Guacamole containers (seesre_provisioning_manager.py).🌂 Related issues
Closes #2481
🔬 Tests
We have verified that after deploying this change Nexus is working as expected:
And that the PostgreSQL database is created and populated by the Nexus container: