generated from worldbank/template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Setup database ingestion * Update path to requirements in CI * Refactor project structure for cdk deployment * Update tests for new deployment structure * Update timeout of lambda function * Add custom domain for API Separate settings into deployment and application. * Transition to API Gateway v2 * Update path to requirements in CI workflow * Update memory setting for lambda to improve performance * Add pytest dependency installation to CI workflow * Update pattern for env files
- Loading branch information
Showing
27 changed files
with
237 additions
and
140 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -100,4 +100,8 @@ db.env | |
# data | ||
*.parquet | ||
*.duckdb | ||
.pgdata | ||
.pgdata | ||
space2stats_api/space2stats_env | ||
*.env | ||
cdk.out | ||
lambda_layer |
This file contains 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 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,7 @@ | ||
## Deployment Notes | ||
|
||
- Create database instance | ||
- Update configuration in `db.env` | ||
- Ingest parquet file with `load_to_prod.sh` (may require `chmod +x load_to_prod.sh`) | ||
- Create index on hex_id (for performance):`CREATE INDEX idx_hex_id ON space2stats (hex_id)` - critical for performance of our queries | ||
- Test with the [example notebook](notebooks/space2stats_api_demo.ipynb) |
This file contains 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 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 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,30 @@ | ||
#!/bin/bash | ||
|
||
|
||
# Load environment variables from db.env file | ||
if [ -f db.env ]; then | ||
export $(cat db.env | grep -v '#' | awk '/=/ {print $1}') | ||
fi | ||
|
||
# Check if required environment variables are set | ||
if [ -z "$DB_HOST" ] || [ -z "$DB_PORT" ] || [ -z "$DB_NAME" ] || [ -z "$DB_USER" ] || [ -z "$DB_PASSWORD" ]; then | ||
echo "One or more required environment variables are missing." | ||
exit 1 | ||
fi | ||
|
||
# Directory containing the Parquet chunks | ||
CHUNKS_DIR="parquet_chunks" | ||
|
||
# Name of the target table | ||
TABLE_NAME="space2stats" | ||
PARQUET_FILE=space2stats_updated.parquet | ||
|
||
echo "Starting" | ||
|
||
ogr2ogr -progress -f "PostgreSQL" \ | ||
PG:"host=$DB_HOST port=$DB_PORT dbname=$DB_NAME user=$DB_USER password=$DB_PASSWORD" \ | ||
"$PARQUET_FILE" \ | ||
-nln $TABLE_NAME \ | ||
-append \ | ||
-lco SPATIAL_INDEX=NONE | ||
|
Oops, something went wrong.