Example of application built with titiler.xarray
package
Source Code: https://github.com/developmentseed/titiler-multidim
# It's recommended to install dependencies in a virtual environment
uv sync --dev
export TEST_ENVIRONMENT=true # set this when running locally to mock redis
uv run uvicorn titiler.multidim.main:app --reload
To access the docs, visit http://127.0.0.1:8000/api.html.
Tests use data generated locally by using tests/fixtures/generate_test_*.py
scripts.
Install the package using uv
with all development dependencies:
uv sync
uv run pre-commit install
To run all the tests:
uv run pytest
To run just one test:
uv run pytest tests/test_app.py::test_get_info
- Production deployments are handled in the 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.
The following steps detail how to to setup and deploy the CDK stack from your local machine.
-
Install CDK and connect to your AWS account. This step is only necessary once per AWS account.
# Download titiler repo git clone https://github.com/developmentseed/titiler-xarray.git # Install with the deployment dependencies uv sync --group deployment # Install node dependency uv run npm --prefix infrastructure/aws install # Deploys the CDK toolkit stack into an AWS environment uv run npm --prefix infrastructure/aws run cdk -- bootstrap # or to a specific region and or using AWS profile AWS_DEFAULT_REGION=us-west-2 AWS_REGION=us-west-2 AWS_PROFILE=myprofile npm --prefix infrastructure/aws run cdk -- bootstrap
-
Update settings
Set environment variable or hard code in
infrastructure/aws/.env
file (e.gSTACK_STAGE=testing
). -
Pre-Generate CFN template
uv run npm --prefix infrastructure/aws run cdk -- synth # Synthesizes and prints the CloudFormation template for this stack
-
Deploy
STACK_STAGE=staging uv run npm --prefix infrastructure/aws run cdk -- deploy titiler-xarray-staging # Deploy in specific region AWS_DEFAULT_REGION=us-west-2 AWS_REGION=us-west-2 AWS_PROFILE=smce-veda STACK_STAGE=production uv run npm --prefix infrastructure/aws run cdk -- deploy titiler-xarray-production
Important
In AWS Lambda environment we need to have specific version of botocore, S3FS, FSPEC and other libraries.
To make sure the application will both work locally and in AWS Lambda environment you can install the dependencies using python -m pip install -r infrastructure/aws/requirement-lambda.txt