[ADMINAPI-1436] - Instance Management - Docker database template setup#388
Draft
DavidJGapCR wants to merge 13 commits into
Draft
[ADMINAPI-1436] - Instance Management - Docker database template setup#388DavidJGapCR wants to merge 13 commits into
DavidJGapCR wants to merge 13 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Docker-based ODS database template restore support (notably a new custom PostgreSQL db-ods image/init), plus documentation and HTTP examples intended to support Instance Management provisioning scenarios.
Changes:
- Add new PostgreSQL
db-odsDocker image and init script that restores minimal/populated template DBs from bind-mounted.sqldumps. - Update V2/V3 docker-compose files and
.envexamples to pass backup-related environment variables and mount a host backup folder intodb-ods. - Extend documentation (
docs/docker.md) and HTTP request examples (docs/http/dbinstances.http) for registering a client, creating instances with theMinimaltemplate, and listing ODS instances.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 25 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/http/dbinstances.http | Adds example requests for client registration, minimal-template DB instance creation, and listing ODS instances. |
| docs/docker.md | Documents ODS DB restore-from-backup behavior and required env vars. |
| Docker/V3/Compose/pgsql/SingleTenant/compose-build-ods.yml | Switches PostgreSQL db-ods to a locally built custom image; adds backup env vars + bind mount. |
| Docker/V3/Compose/pgsql/MultiTenant/compose-build-ods-multi-tenant.yml | Same as above for multi-tenant PostgreSQL db-ods services. |
| Docker/V3/Compose/pgsql/env.example | Adds backup-related env vars for PostgreSQL compose runs. |
| Docker/V3/Compose/mssql/SingleTenant/compose-build-ods.yml | Adds backup-related env vars + bind mount; adjusts API logs volume default. |
| Docker/V3/Compose/mssql/MultiTenant/compose-build-ods-multi-tenant.yml | Same as above for multi-tenant MSSQL db-ods services; adjusts API logs volume default. |
| Docker/V3/Compose/mssql/env.example | Adds backup-related env vars for MSSQL compose runs. |
| Docker/V2/Compose/pgsql/SingleTenant/compose-build-ods.yml | Switches PostgreSQL db-ods to locally built custom image; adds backup env vars + bind mount. |
| Docker/V2/Compose/pgsql/MultiTenant/compose-build-ods-multi-tenant.yml | Same as above for multi-tenant PostgreSQL db-ods services. |
| Docker/V2/Compose/pgsql/env.example | Adds backup-related env vars for PostgreSQL compose runs. |
| Docker/V2/Compose/mssql/SingleTenant/compose-build-ods.yml | Adds backup-related env vars + bind mount; adjusts API logs volume default. |
| Docker/V2/Compose/mssql/MultiTenant/compose-build-ods-multi-tenant.yml | Same as above for multi-tenant MSSQL db-ods services; adjusts API logs volume default. |
| Docker/V2/Compose/mssql/env.example | Adds backup-related env vars for MSSQL compose runs. |
| Docker/Settings/shared/DB-Ods/pgsql/init.sh | New init entrypoint to initialize PGDATA and restore minimal/populated template DBs from .sql dumps. |
| Docker/Settings/shared/DB-Ods/pgsql/Dockerfile | New custom PostgreSQL image definition using the new init entrypoint. |
| Docker/Settings/shared/DB-Ods/mssql/init.sh | Adds validation for backup-related env vars before starting MSSQL setup. |
| @@ -0,0 +1,99 @@ | |||
| #!/bin/bash | |||
Comment on lines
+64
to
+66
| echo "Setting user password..." | ||
| su-exec postgres psql -p "$POSTGRES_PORT" -U "$POSTGRES_USER" \ | ||
| -c "ALTER USER \"${POSTGRES_USER}\" WITH PASSWORD '${POSTGRES_PASSWORD}';" |
Comment on lines
+14
to
+18
| # Validate required backup env variables | ||
| if [[ -z "$SQL_BACKUPS_FOLDER" ]]; then | ||
| echo "ERROR: SQL_BACKUPS_FOLDER is not set. Please set it to the host path containing the .bak files." >&2 | ||
| exit 1 | ||
| fi |
Comment on lines
+194
to
+196
| By default, the `db-ods` container downloads and uses the Ed-Fi minimal template from NuGet at | ||
| build time. If you need to restore from your own backup files instead, you can provide them via a | ||
| bind mount volume. |
Comment on lines
+216
to
+217
| | `MINIMAL_BAK_PATH` / `MINIMAL_SQL_PATH` | Path to the minimal template backup **inside the container**. Defaults to `/sql-backups/EdFi.Ods.Minimal.Template.bak` (MSSQL) or `/sql-backups/EdFi.Ods.Minimal.Template.sql` (PostgreSQL). | | ||
| | `POPULATED_BAK_PATH` / `POPULATED_SQL_PATH` | Path to the populated template backup **inside the container**. Defaults to `/sql-backups/EdFi.Ods.Populated.Template.bak` (MSSQL) or `/sql-backups/EdFi.Ods.Populated.Template.sql` (PostgreSQL). | |
Comment on lines
+23
to
+24
| MINIMAL_BAK_PATH: "${MINIMAL_BAK_PATH:-/sql-backups/EdFi.Ods.Minimal.Template.bak}" | ||
| POPULATED_BAK_PATH: "${POPULATED_BAK_PATH:-/sql-backups/EdFi.Ods.Populated.Template.bak}" |
Comment on lines
+23
to
+24
| MINIMAL_BAK_PATH: "${MINIMAL_BAK_PATH:-/sql-backups/EdFi.Ods.Minimal.Template.bak}" | ||
| POPULATED_BAK_PATH: "${POPULATED_BAK_PATH:-/sql-backups/EdFi.Ods.Populated.Template.bak}" |
Comment on lines
+53
to
+54
| MINIMAL_BAK_PATH: "${MINIMAL_BAK_PATH:-/sql-backups/EdFi.Ods.Minimal.Template.bak}" | ||
| POPULATED_BAK_PATH: "${POPULATED_BAK_PATH:-/sql-backups/EdFi.Ods.Populated.Template.bak}" |
Comment on lines
+63
to
+64
| MINIMAL_BAK_PATH=/sql-backups/EdFi.Ods.Minimal.Template.bak | ||
| POPULATED_BAK_PATH=/sql-backups/EdFi.Ods.Populated.Template.bak |
Comment on lines
+63
to
+64
| MINIMAL_BAK_PATH=/sql-backups/EdFi.Ods.Minimal.Template.bak | ||
| POPULATED_BAK_PATH=/sql-backups/EdFi.Ods.Populated.Template.bak |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.