-
Notifications
You must be signed in to change notification settings - Fork 8
Simplify PgSTAC Bootstrap Process #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
02cfa59
feat: Add PgSTAC settings SQL file and update bootstrap process
emmanuelmathot c1024bf
feat: Add EOAPI Helm Chart README and streamline PgSTAC bootstrap pro…
emmanuelmathot 81df848
feat: Enhance debugging output for failed service boot and test failu…
emmanuelmathot 67b85dc
fix: reduce timeout for service boot watch to 2 minutes
emmanuelmathot 673dba2
feat: update pgstac image name to use pgstac-pypgstac variant
emmanuelmathot 3868757
fix: update log extraction for pgstac-migrate pod in CI workflow
emmanuelmathot c8536ab
fix: update wait command to reference pgstac-migrate job in deploymen…
emmanuelmathot 820d499
fix: disable continue-on-error for test runner step in CI workflow
emmanuelmathot 4d4387b
fix: enhance pgstac-migrate job monitoring and increase timeout for s…
emmanuelmathot 84cc3c3
fix: add log extraction for pgstac-migrate pod in CI workflow
emmanuelmathot bc883d7
fix: add error handling to pgstac-migrate job script
emmanuelmathot 817f748
fix: improve database readiness check and add error handling in pgsta…
emmanuelmathot 11e3184
fix: add debugging output for environment variables in pgstac-migrate…
emmanuelmathot ecb1ff8
fix: update postgres user privileges and clarify comments in values.yaml
emmanuelmathot 5d786b7
fix: configure Patroni for schema permissions and update PostgreSQL s…
emmanuelmathot 637dd7f
fix: update schema permissions for eoapi user in values.yaml
emmanuelmathot 41af2a2
fix: update PostgreSQL schema privileges for eoapi user in values.yaml
emmanuelmathot 4050f72
fix: update postgrescluster options to SUPERUSER for enhanced privileges
emmanuelmathot 4daa0df
fix: update database initialization SQL and modify postgrescluster op…
emmanuelmathot 6b338d8
fix: simplify database initialization SQL configuration in values.yaml
emmanuelmathot 3940b88
fix: correct database options formatting in values.yaml
emmanuelmathot b1cf8e8
fix: add CREATE privilege for eoapi user on public schema in initdb.sql
emmanuelmathot 01298f6
fix: update privileges for eoapi user in initdb.sql
emmanuelmathot 0fed24d
fix: update initdb.sql to set default privileges for eoapi user
emmanuelmathot 8ce9093
fix: streamline database initialization and add verification in pgsta…
emmanuelmathot bfd6c14
fix: enhance database initialization verification in pgstac bootstrap…
emmanuelmathot df37cab
fix: enhance search_path verification for PgSTAC functionality in dat…
emmanuelmathot f675e1f
fix: improve database initialization verification by checking eoapi r…
emmanuelmathot 31bf1df
fix: ensure immediate exit on command failure in PgSTAC migration script
emmanuelmathot 255d206
fix: add database owner assignment and remove redundant initializatio…
emmanuelmathot 777266f
fix: streamline PgSTAC migration job by removing redundant PostGIS ex…
emmanuelmathot 6926885
Merge remote-tracking branch 'origin/main' into simplify-migrate
emmanuelmathot c1e0cac
fix: add debugging steps for pgstac-migrate job failures and allow co…
emmanuelmathot 32012e7
fix: enhance logging extraction for pgstac-migrate job by implementin…
emmanuelmathot 6a41836
fix: update initdb ConfigMap to include role creation and privileges …
emmanuelmathot 0482448
fix: ensure exit status is captured after helm test execution
emmanuelmathot 96e0026
fix: add initdb ConfigMap for PostgreSQL setup with necessary roles a…
emmanuelmathot 778088b
fix: update helm render/install step to include an ID for better trac…
emmanuelmathot f613bf0
fix: update database connection settings in pgstac bootstrap ConfigMa…
emmanuelmathot c4c1e28
fix: remove redundant pod log extraction methods for pgstac-migrate
emmanuelmathot 661bba1
fix: remove debugging environment variable prints and unused initCont…
emmanuelmathot e935c60
fix: remove unnecessary sleep step from helm-tests workflow
emmanuelmathot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# EOAPI Helm Chart | ||
|
||
This Helm chart deploys the EOAPI (Earth Observation API) stack, which includes STAC API, raster tile services, vector tile services, and a multidimensional data service. | ||
|
||
## Overview | ||
|
||
The chart sets up: | ||
|
||
- A PostgreSQL database with PostGIS and PgSTAC extensions | ||
- STAC API service for metadata discovery and search | ||
- Titiler for raster tile services | ||
- TIPG for vector tile services | ||
- Optional multidimensional data service | ||
|
||
## Prerequisites | ||
|
||
- Kubernetes 1.16+ | ||
- Helm 3.0+ | ||
- PV provisioner support in the underlying infrastructure | ||
- CrunchyData Postgres Operator (for the PostgreSQL database) | ||
|
||
## Installation | ||
|
||
```bash | ||
# Install Postgres Operator first | ||
helm install --set disable_check_for_upgrades=true pgo oci://registry.developers.crunchydata.com/crunchydata/pgo | ||
|
||
# Then install eoapi | ||
helm install eoapi ./eoapi | ||
``` | ||
|
||
## Configuration | ||
|
||
The chart can be configured via `values.yaml`. See the chart's `values.yaml` file for all available options and detailed descriptions. | ||
|
||
Key configuration sections: | ||
|
||
```yaml | ||
# Services to enable | ||
apiServices: | ||
- raster | ||
- stac | ||
- vector | ||
# - multidim (disabled by default) | ||
|
||
# Ingress configuration | ||
ingress: | ||
enabled: true | ||
className: "nginx" | ||
# ... | ||
|
||
# Database configuration | ||
postgrescluster: | ||
enabled: true | ||
# ... | ||
``` | ||
|
||
## PgSTAC Bootstrap Process | ||
|
||
The chart includes a streamlined process for initializing and setting up the PgSTAC database. | ||
|
||
### PgSTAC Bootstrap Overview | ||
|
||
The setup process consists of two main jobs: | ||
|
||
1. **pgstac-migrate job**: Runs the pypgstac migrate command to initialize the database schema, applies settings, and sets necessary permissions. | ||
2. **pgstac-load-samples job**: (Optional) Loads sample STAC data only when sample loading is enabled. | ||
|
||
### Improvements in PgSTAC Bootstrap | ||
|
||
- Replaced custom Python script with pypgstac migrate command | ||
- Moved SQL settings to a dedicated SQL file for better maintainability | ||
- Separated sample data loading into an optional job | ||
- Uses standard PostgreSQL environment variables | ||
- Ensures the process remains idempotent for safe re-runs | ||
|
||
### PgSTAC Directory Structure | ||
|
||
The codebase has been reorganized to separate different types of files: | ||
|
||
- `initdb-data/settings/`: Contains configuration settings like the PgSTAC settings SQL file | ||
- `initdb-data/samples/`: Contains sample data files that are loaded only when sample loading is enabled | ||
|
||
### PgSTAC Configuration | ||
|
||
- Enable/disable the setup process through `pgstacBootstrap.enabled` | ||
- Control sample data loading: | ||
- New approach: `pgstacBootstrap.settings.loadSamples` (recommended) | ||
- Legacy approach: `pgstacBootstrap.settings.envVars.LOAD_FIXTURES` (deprecated) | ||
|
||
Example configuration: | ||
|
||
```yaml | ||
pgstacBootstrap: | ||
enabled: true | ||
settings: | ||
# General configuration options | ||
loadSamples: true # Set to false to disable sample data loading | ||
|
||
resources: | ||
requests: | ||
cpu: "512m" | ||
memory: "1024Mi" | ||
limits: | ||
cpu: "512m" | ||
memory: "1024Mi" | ||
``` | ||
|
||
## Services | ||
|
||
### STAC API | ||
|
||
The STAC API service provides a standardized way to search and discover geospatial data. | ||
|
||
### Raster Services (Titiler) | ||
|
||
Provides dynamic tiling for raster data through the TiTiler implementation. | ||
|
||
### Vector Services (TIPG) | ||
|
||
Provides vector tile services for PostGIS data through the TIPG implementation. | ||
|
||
### Multidimensional Services (Optional) | ||
|
||
Provides services for multidimensional data (time series, etc.). | ||
|
||
## Persistence | ||
|
||
The chart uses PostgreSQL for data persistence. Make sure to configure appropriate storage for production use. | ||
|
||
## Upgrading | ||
|
||
When upgrading the chart, consider any changes to values.yaml and migrations that might need to be applied. | ||
|
||
## Uninstallation | ||
|
||
```bash | ||
helm delete eoapi | ||
``` | ||
|
||
Note that PVs may need to be manually deleted if you want to remove all data. |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Apply pgstac settings | ||
DELETE FROM pgstac.pgstac_settings WHERE name = 'context'; | ||
INSERT INTO pgstac.pgstac_settings (name, value) VALUES ('context', 'auto'); | ||
|
||
DELETE FROM pgstac.pgstac_settings WHERE name = 'context_estimated_count'; | ||
INSERT INTO pgstac.pgstac_settings (name, value) VALUES ('context_estimated_count', '100000'); | ||
|
||
DELETE FROM pgstac.pgstac_settings WHERE name = 'context_estimated_cost'; | ||
INSERT INTO pgstac.pgstac_settings (name, value) VALUES ('context_estimated_cost', '100000'); | ||
|
||
DELETE FROM pgstac.pgstac_settings WHERE name = 'context_stats_ttl'; | ||
INSERT INTO pgstac.pgstac_settings (name, value) VALUES ('context_stats_ttl', '1 day'); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{{- if .Values.db.enabled }} | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emmanuelmathot is there a reference for what this is doing exactly / what settings these are, etc? If these are settings, do we need to make them configurable in
values
? Am guessing this is something just a bit silly to get things to work, but might be nice to have a comment with a link to what these settings are or so?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the idea is to have them in the values. I actually want to have a proper mechanism via pypgstac cli with something like pypgstac load settings that may be used not only in this chart. PR to come in pgstac.