-
Notifications
You must be signed in to change notification settings - Fork 6
Disasters/add STAC metadata #433
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
Open
kyle-lesinger
wants to merge
15
commits into
dev
Choose a base branch
from
disasters/addSTACmetadata
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2042ccb
add event name metadata update
kyle-lesinger 69eeb50
add event name metadata update
kyle-lesinger 69b0761
add event name metadata update
kyle-lesinger fe9c368
simplify logic
kyle-lesinger 533b10a
simplify logic
kyle-lesinger 9308635
simplify logic
kyle-lesinger eca5ef8
simplify logic
kyle-lesinger cf3e09f
add monty metadata
kyle-lesinger 681c5e2
remove eager loading (s3 credential issue)
kyle-lesinger 360ff89
add lru cache
kyle-lesinger 78ae72d
update s3 discovery with better object names
kyle-lesinger e758b4c
Update STAC metadata extraction to use GeoTIFF attributes and disaste…
kyle-lesinger f837ed9
Merge branch 'dev' into disasters/addSTACmetadata
smohiudd 5fac100
update with json script and changed file paths
kyle-lesinger 3122286
fix missing commas
kyle-lesinger 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "EVENT_BUCKET": "veda-tf-state-shared-disasters", | ||
| "STAC_INGESTOR_API_URL": "https://dev.disasters.openveda.cloud/api/ingest/", | ||
| "STAC_URL": "https://dev.disasters.openveda.cloud/api/stac", | ||
| "INGEST_API_KEYCLOAK_APP_SECRET": "", | ||
| "ASSUME_ROLE_READ_ARN": "", | ||
| "ASSUME_ROLE_WRITE_ARN": "", | ||
| "VECTOR_SECRET_NAME": "null", | ||
| "SM2A_BASE_URL": "https://airflow.disasters.openveda.cloud", | ||
| "CLOUDFRONT_TO_INVALIDATE": null, | ||
| "CLOUDFRONT_PATH_TO_INVALIDATE": null | ||
| } |
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,81 @@ | ||
| # AWS DAGs Variables Configuration | ||
|
|
||
| This JSON file contains the configuration variables that Airflow needs to run the VEDA data pipelines. | ||
|
|
||
| ## How to Use | ||
|
|
||
| ### Option 1: Upload to AWS Secrets Manager (Recommended for Production) | ||
| ```bash | ||
| aws secretsmanager create-secret \ | ||
| --name veda-pipeline-dev/airflow/variables/aws_dags_variables \ | ||
| --secret-string file://aws_dags_variables.json \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This flag will not work like this - it doesn't unpack the file contents into valid json |
||
| --region us-west-2 | ||
| ``` | ||
|
|
||
| Or update an existing secret: | ||
| ```bash | ||
| aws secretsmanager update-secret \ | ||
| --secret-id veda-pipeline-dev/airflow/variables/aws_dags_variables \ | ||
| --secret-string file://aws_dags_variables.json \ | ||
| --region us-west-2 | ||
| ``` | ||
|
|
||
| ### Option 2: Add via Airflow UI (Quick Fix for Development) | ||
| 1. Navigate to Airflow UI → Admin → Variables | ||
| 2. Click "+" to add a new variable | ||
| 3. Key: `aws_dags_variables` | ||
| 4. Value: Paste the JSON content from `aws_dags_variables.json` | ||
| 5. Click Save | ||
|
|
||
| ## Required Fields to Update | ||
|
|
||
| Before using this file, you MUST update the following placeholder values: | ||
|
|
||
| ### 1. INGEST_API_KEYCLOAK_APP_SECRET | ||
| - **Description**: Keycloak client secret for authenticating with the STAC ingestor API | ||
| - **How to get it**: Contact your Keycloak administrator or retrieve from AWS Secrets Manager | ||
| - **Example**: `"a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6"` | ||
|
|
||
| ### 2. ASSUME_ROLE_READ_ARN | ||
| - **Description**: IAM Role ARN that Airflow workers assume to read data from S3 | ||
| - **Format**: `arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME` | ||
| - **Example**: `"arn:aws:iam::114506680961:role/veda-data-access-role-dev"` | ||
|
|
||
| ### 3. ASSUME_ROLE_WRITE_ARN | ||
| - **Description**: IAM Role ARN that Airflow workers assume to write data to S3 | ||
| - **Format**: `arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME` | ||
| - **Example**: `"arn:aws:iam::114506680961:role/veda-data-write-role-dev"` | ||
|
|
||
| ## Pre-configured Fields (Disasters-specific) | ||
|
|
||
| These fields are already configured for the disasters environment: | ||
|
|
||
| - **EVENT_BUCKET**: `veda-tf-state-shared-disasters` - S3 bucket for events and processing data | ||
| - **STAC_INGESTOR_API_URL**: `https://dev.disasters.openveda.cloud/api/ingest/` - Disasters STAC ingestor endpoint | ||
| - **STAC_URL**: `https://dev.disasters.openveda.cloud/api/stac` - Public STAC catalog endpoint | ||
| - **SM2A_BASE_URL**: `https://airflow.disasters.openveda.cloud` - Airflow base URL | ||
|
|
||
| ## Optional Fields | ||
|
|
||
| These fields are set to `null` or default values and may not be needed: | ||
|
|
||
| - **VECTOR_SECRET_NAME**: AWS Secrets Manager secret name for vector database credentials | ||
| - **CLOUDFRONT_TO_INVALIDATE**: CloudFront distribution ID to invalidate after updates | ||
| - **CLOUDFRONT_PATH_TO_INVALIDATE**: CloudFront path pattern to invalidate | ||
|
|
||
| ## Terraform Integration | ||
|
|
||
| This configuration matches the terraform variables in `infrastructure/terraform.tfvars`. | ||
| When deployed via Terraform, these values are automatically synced to AWS Secrets Manager. | ||
|
|
||
| ## Verification | ||
|
|
||
| After updating the Airflow variable, verify it's accessible: | ||
|
|
||
| ```python | ||
| from airflow.models.variable import Variable | ||
| import json | ||
|
|
||
| vars = Variable.get("aws_dags_variables", deserialize_json=True) | ||
| print(vars["STAC_INGESTOR_API_URL"]) # Should print: https://dev.disasters.openveda.cloud/api/ingest/ | ||
| ``` | ||
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 @@ | ||
| {"EVENT_BUCKET": "veda-tf-state-shared-disasters", "STAC_INGESTOR_API_URL": "https://dev.disasters.openveda.cloud/api/ingest/", "STAC_URL": "https://dev.disasters.openveda.cloud/api/stac", "INGEST_API_KEYCLOAK_APP_SECRET": "", "ASSUME_ROLE_READ_ARN": "", "ASSUME_ROLE_WRITE_ARN": "", "VECTOR_SECRET_NAME": "null", "SM2A_BASE_URL": "https://airflow.disasters.openveda.cloud", "CLOUDFRONT_TO_INVALIDATE": null, "CLOUDFRONT_PATH_TO_INVALIDATE": null} |
54 changes: 54 additions & 0 deletions
54
dags/veda_data_pipeline/utils/LUT/event-hazard-location.json
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,54 @@ | ||
| { | ||
| "202603_Flood_HI": { | ||
| "hazard": ["Flood", "Landslide"], | ||
| "location": ["Hawaii"] | ||
| }, | ||
| "202601_WinterWx_US": { | ||
| "hazard": ["WinterWx"], | ||
| "location": ["Virginia", "Texas", "Tennessee", "South Carolina", "Mississippi"] | ||
| }, | ||
| "202512_Flood_WA": { | ||
| "hazard": ["Flood"], | ||
| "location": ["Washington", "Landslide"] | ||
| }, | ||
| "202510_Hurricane_Melissa": { | ||
| "hazard": ["Tropical Cyclone", "Hurricane", "Flood", "Landslide"], | ||
| "location": ["Jamaica"] | ||
| }, | ||
| "202510_Flood_AK": { | ||
| "hazard": ["Flood"], | ||
| "location": ["Alaska"] | ||
| }, | ||
| "202507_Flood_TX": { | ||
| "hazard": ["Flood"], | ||
| "location": ["Texas"] | ||
| }, | ||
| "202506_Fire_NM": { | ||
| "hazard": ["Fire", "Flood"], | ||
| "location": ["New Mexico"] | ||
| }, | ||
| "202504_SevereWx_US": { | ||
| "hazard": ["SevereWx", "Flood"], | ||
| "location": ["Arkansas", "Alabama", "Louisiana", "Mississippi", "Missouri", "Tennessee"] | ||
| }, | ||
| "202503_SevereWx_US": { | ||
| "hazard": ["SevereWx"], | ||
| "location": ["Arkansas", "Alabama", "Kentucky", "Louisiana", "Mississippi", "Missouri", "Tennessee"] | ||
| }, | ||
| "202502_Flood_OhioValley": { | ||
| "hazard": ["Flood", "Landslide"], | ||
| "location": ["Kentucky", "Tennessee", "Virginia", "West Virginia"] | ||
| }, | ||
| "202501_Fire_CA": { | ||
| "hazard": ["Fire"], | ||
| "location": ["California"] | ||
| }, | ||
| "202410_Hurricane_Milton": { | ||
| "hazard": ["Tropical Cyclone", "Hurricane", "Flood"], | ||
| "location": ["Florida"] | ||
| }, | ||
| "202409_Hurricane_Helene": { | ||
| "hazard": ["Tropical Cyclone", "Hurricane", "Flood", "Landslide"], | ||
| "location": ["Alabama", "North Carolina", "South Carolina", "Tennessee", "Virginia"] | ||
| } | ||
| } |
Oops, something went wrong.
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.
the aws_dags_variables in secrets manager is generated during the deployment of self managed airflow using values from the deployment secret. We do not want to edit aws_dags_variables directly but I also am admittedly having a hard time finding the definitions for the deployment envs that we can and should modify (https://github.com/NASA-IMPACT/self-managed-apache-airflow/blob/e67e48baad16674e5f14a14cbf55290c36304ccd/infrastructure/secrets/main.tf#L56)
I found some base docs in veda-deploy but we need more clear definitions of how to update deployment envs (I think we lost them in a refactor) https://github.com/NASA-IMPACT/veda-deploy?tab=readme-ov-file#aws-secrets-requirements-for-sm2a
Let's work to improve the deployment env definitions with some of the definitions you have here but not overwriting the terraformed secret.