Skip to content

Commit 8a645ab

Browse files
authored
chore: add action to deploy the dev stack (#94)
1 parent bad0b50 commit 8a645ab

File tree

4 files changed

+77
-9
lines changed

4 files changed

+77
-9
lines changed

.github/workflows/deploy-dev.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CDK Deploy Dev Workflow 🚀
2+
3+
permissions:
4+
id-token: write
5+
contents: read
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
branch:
11+
description: 'Branch to deploy'
12+
required: true
13+
default: 'main'
14+
pull_request:
15+
types: [labeled, synchronize]
16+
17+
jobs:
18+
deploy:
19+
name: Deploy to dev 🚀
20+
runs-on: ubuntu-latest
21+
environment: dev
22+
if: >
23+
github.event_name != 'pull_request' ||
24+
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-dev'))
25+
env:
26+
UV_PYTHON: 3.12
27+
CDK_DEFAULT_ACCOUNT: ${{ vars.CDK_DEFAULT_ACCOUNT }}
28+
CDK_DEFAULT_REGION: ${{ vars.CDK_DEFAULT_REGION }}
29+
STAGE: ${{ vars.STAGE }}
30+
VPC_ID: ${{ vars.VPC_ID }}
31+
TITILER_MULTIDIM_PYTHONWARNINGS: ignore
32+
TITILER_MULTIDIM_DEBUG: true
33+
TITILER_MULTIDIM_READER_ROLE_ARN: ${{ vars.TITILER_MULTIDIM_READER_ROLE_ARN }}
34+
35+
steps:
36+
- name: Determine branch to deploy
37+
id: set_branch
38+
run: |
39+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
40+
echo "branch=${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT
41+
elif [ "${{ github.event_name }}" == "pull_request" ]; then
42+
echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
43+
else
44+
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
45+
fi
46+
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
with:
50+
ref: ${{ steps.set_branch.outputs.branch }}
51+
52+
- name: Configure AWS credentials
53+
uses: aws-actions/configure-aws-credentials@v2
54+
with:
55+
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
56+
role-session-name: test-deploy
57+
aws-region: us-west-2
58+
59+
- name: Run titiler-cmr deployment
60+
uses: "./.github/actions/cdk-deploy"
61+
with:
62+
dir: "./infrastructure/aws"
63+
env_aws_secret_name: ""

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,8 @@ uv run pytest tests/test_app.py::test_get_info
4545

4646
## VEDA Deployment
4747

48-
The Github Actions workflow defined in [.github/workflows/ci.yml](./.github/workflows/ci.yml) deploys code to AWS for the VEDA project.
49-
50-
* There are 2 stacks - one production and one development.
51-
* 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/.
52-
* 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/.
48+
* **Production deployments** are handled in the [NASA-IMPACT/veda-deploy](https://github.com/NASA-IMPACT/veda-deploy) repository.
49+
* **Test/dev stack deployments** can be triggered by applying the `deploy-dev` label to a pull request in this repository.
5350

5451
## New Deployments
5552

infrastructure/aws/lambda/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ COPY src/titiler/ ./src/titiler/
1414
RUN uv export --locked --no-editable --no-dev --extra lambda --format requirements.txt -o requirements.txt && \
1515
uv pip install --compile-bytecode --no-binary pydantic --target /asset -r requirements.txt
1616

17+
# copy libexpat.so.1 into /asset which is included in LD_LIBRARY_PATH
18+
RUN cp /usr/lib64/libexpat.so.1 /asset/
1719

1820
# Reduce package size and remove useless files
1921
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;

src/titiler/multidim/factory.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,18 @@ def map_viewer(
113113
description="Whether to decode times",
114114
),
115115
] = True,
116-
drop_dim: Annotated[
116+
sel: Annotated[
117117
Optional[str],
118-
Query(description="Dimension to drop"),
118+
Query(
119+
description="Xarray Indexing using dimension names `{dimension}={value}`.",
120+
),
119121
] = None,
120-
datetime: Annotated[
121-
Optional[str], Query(description="Slice of time to read (if available)")
122+
method: Annotated[
123+
Optional[Literal["nearest", "pad", "ffill", "backfill", "bfill"]],
124+
Query(
125+
alias="sel_method",
126+
description="Xarray indexing method to use for inexact matches.",
127+
),
122128
] = None,
123129
tile_format: Annotated[
124130
Optional[ImageType],

0 commit comments

Comments
 (0)