From 35cf0765ad32de4b04f90924eba18ceee0be6879 Mon Sep 17 00:00:00 2001 From: hrodmn Date: Tue, 16 Sep 2025 09:25:27 -0500 Subject: [PATCH 1/4] chore: add action to deploy the dev stack --- .github/workflows/deploy-dev.yml | 63 ++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/deploy-dev.yml diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml new file mode 100644 index 0000000..a7d88e8 --- /dev/null +++ b/.github/workflows/deploy-dev.yml @@ -0,0 +1,63 @@ +name: CDK Deploy Dev Workflow 🚀 + +permissions: + id-token: write + contents: read + +on: + workflow_dispatch: + inputs: + branch: + description: 'Branch to deploy' + required: true + default: 'main' + pull_request: + types: [labeled, synchronize] + +jobs: + deploy: + name: Deploy to dev 🚀 + runs-on: ubuntu-latest + environment: dev + if: > + github.event_name != 'pull_request' || + (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-dev')) + env: + UV_PYTHON: 3.12 + CDK_DEFAULT_ACCOUNT: ${{ vars.CDK_DEFAULT_ACCOUNT }} + CDK_DEFAULT_REGION: ${{ vars.CDK_DEFAULT_REGION }} + STAGE: ${{ vars.STAGE }} + VPC_ID: ${{ vars.VPC_ID }} + TITILER_MULTIDIM_PYTHONWARNINGS: ignore + TITILER_MULTIDIM_DEBUG: true + TITILER_MULTIDIM_READER_ROLE_ARN: ${{ vars.TITILER_MULTIDIM_READER_ROLE_ARN }} + + steps: + - name: Determine branch to deploy + id: set_branch + run: | + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + echo "branch=${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT + elif [ "${{ github.event_name }}" == "pull_request" ]; then + echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT + else + echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT + fi + + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ steps.set_branch.outputs.branch }} + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ vars.AWS_ROLE_ARN }} + role-session-name: test-deploy + aws-region: us-west-2 + + - name: Run titiler-cmr deployment + uses: "./.github/actions/cdk-deploy" + with: + dir: "./infrastructure/aws" + env_aws_secret_name: "" From dbb37d7ab9249ab28f7f489b1e2c443455559d46 Mon Sep 17 00:00:00 2001 From: hrodmn Date: Tue, 16 Sep 2025 09:43:16 -0500 Subject: [PATCH 2/4] need libexpat here, too :/ --- infrastructure/aws/lambda/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/infrastructure/aws/lambda/Dockerfile b/infrastructure/aws/lambda/Dockerfile index 893fe82..86c99ce 100644 --- a/infrastructure/aws/lambda/Dockerfile +++ b/infrastructure/aws/lambda/Dockerfile @@ -14,6 +14,8 @@ COPY src/titiler/ ./src/titiler/ RUN uv export --locked --no-editable --no-dev --extra lambda --format requirements.txt -o requirements.txt && \ uv pip install --compile-bytecode --no-binary pydantic --target /asset -r requirements.txt +# copy libexpat.so.1 into /asset which is included in LD_LIBRARY_PATH +RUN cp /usr/lib64/libexpat.so.1 /asset/ # Reduce package size and remove useless files RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[0-9]*//'); cp $f $n; done; From 52dd8e6f1eca1e758c90e2835edfa3b210984fc6 Mon Sep 17 00:00:00 2001 From: hrodmn Date: Tue, 16 Sep 2025 11:16:46 -0500 Subject: [PATCH 3/4] clean up a few things --- README.md | 7 ++----- src/titiler/multidim/factory.py | 25 +------------------------ 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index ee309f4..7271706 100644 --- a/README.md +++ b/README.md @@ -45,11 +45,8 @@ uv run pytest tests/test_app.py::test_get_info ## VEDA Deployment -The Github Actions workflow defined in [.github/workflows/ci.yml](./.github/workflows/ci.yml) deploys code to AWS for the VEDA project. - -* There are 2 stacks - one production and one development. -* The production stack is deployed when the `main` branch is tagged, creating a new release. The production stack will deploy to a stack with an API Gateway associated with the domain prod-titiler-xarray.delta-backend.com/. -* The development stack will be deployed upon pushes to the `dev` and `main` branches. The development stack will deploy to a stack with an API Gateway associated with the domain dev-titiler-xarray.delta-backend.com/. +* **Production deployments** are handled in the [NASA-IMPACT/veda-deploy](https://github.com/NASA-IMPACT/veda-deploy) repository. +* **Test/dev stack deployments** can be triggered by applying the `deploy-dev` label to a pull request in this repository. ## New Deployments diff --git a/src/titiler/multidim/factory.py b/src/titiler/multidim/factory.py index 88f2267..f451c07 100644 --- a/src/titiler/multidim/factory.py +++ b/src/titiler/multidim/factory.py @@ -96,30 +96,7 @@ def map_viewer( "Identifier selecting one of the supported TileMatrixSetIds", ], url: Annotated[Optional[str], Query(description="Dataset URL")] = None, - variable: Annotated[ - Optional[str], - Query(description="Xarray Variable"), - ] = None, - group: Annotated[ - Optional[int], - Query( - description="Select a specific zarr group from a zarr hierarchy, can be for pyramids or datasets. Can be used to open a dataset in HDF5 files." - ), - ] = None, - decode_times: Annotated[ - bool, - Query( - title="decode_times", - description="Whether to decode times", - ), - ] = True, - drop_dim: Annotated[ - Optional[str], - Query(description="Dimension to drop"), - ] = None, - datetime: Annotated[ - Optional[str], Query(description="Slice of time to read (if available)") - ] = None, + reader_params=Depends(self.reader_dependency), tile_format: Annotated[ Optional[ImageType], Query( From be9971fdb6ecdf025a7f438a9403f3c38670c0b0 Mon Sep 17 00:00:00 2001 From: hrodmn Date: Tue, 16 Sep 2025 11:25:28 -0500 Subject: [PATCH 4/4] revert to custom optional deps for map endpoint --- src/titiler/multidim/factory.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/titiler/multidim/factory.py b/src/titiler/multidim/factory.py index f451c07..5fa31f3 100644 --- a/src/titiler/multidim/factory.py +++ b/src/titiler/multidim/factory.py @@ -96,7 +96,36 @@ def map_viewer( "Identifier selecting one of the supported TileMatrixSetIds", ], url: Annotated[Optional[str], Query(description="Dataset URL")] = None, - reader_params=Depends(self.reader_dependency), + variable: Annotated[ + Optional[str], + Query(description="Xarray Variable"), + ] = None, + group: Annotated[ + Optional[int], + Query( + description="Select a specific zarr group from a zarr hierarchy, can be for pyramids or datasets. Can be used to open a dataset in HDF5 files." + ), + ] = None, + decode_times: Annotated[ + bool, + Query( + title="decode_times", + description="Whether to decode times", + ), + ] = True, + sel: Annotated[ + Optional[str], + Query( + description="Xarray Indexing using dimension names `{dimension}={value}`.", + ), + ] = None, + method: Annotated[ + Optional[Literal["nearest", "pad", "ffill", "backfill", "bfill"]], + Query( + alias="sel_method", + description="Xarray indexing method to use for inexact matches.", + ), + ] = None, tile_format: Annotated[ Optional[ImageType], Query(