Skip to content
This repository was archived by the owner on Sep 19, 2023. It is now read-only.

Commit 0334d58

Browse files
add xarray dependency in titiler.application (developmentseed#1321)
* add xarray dependency in titiler.application * use local titiler-xarray in dockerfile * make sure to update titile-xarray version in application pyproject.toml * update docs * remove useless install
1 parent bbfc0be commit 0334d58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+409
-181
lines changed

CHANGES.md

Lines changed: 7 additions & 0 deletions

README.md

Lines changed: 3 additions & 3 deletions

deployment/aws/app.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(
8989
permissions = permissions or []
9090
environment = environment or {}
9191

92-
# COG / STAC / MosaicJSON
92+
# COG / STAC / MosaicJSON / Zarr endpoints
9393
lambda_function = aws_lambda.Function(
9494
self,
9595
f"{id}-lambda",
@@ -122,39 +122,6 @@ def __init__(
122122
)
123123
CfnOutput(self, "Endpoint", value=api.url)
124124

125-
# Xarray
126-
xarray_lambda_function = aws_lambda.Function(
127-
self,
128-
f"{id}-xarray-lambda",
129-
runtime=runtime,
130-
code=aws_lambda.Code.from_docker_build(
131-
path=os.path.abspath(code_dir),
132-
file="lambda/Dockerfile.xarray",
133-
platform="linux/amd64",
134-
build_args={
135-
"PYTHON_VERSION": "3.14",
136-
},
137-
),
138-
handler="handler.handler",
139-
memory_size=memory,
140-
reserved_concurrent_executions=concurrent,
141-
timeout=Duration.seconds(timeout),
142-
environment=environment,
143-
log_retention=logs.RetentionDays.ONE_WEEK,
144-
)
145-
146-
for perm in permissions:
147-
xarray_lambda_function.add_to_role_policy(perm)
148-
149-
xarray_api = apigw.HttpApi(
150-
self,
151-
f"{id}-xarray-endpoint",
152-
default_integration=HttpLambdaIntegration(
153-
f"{id}-xarray-integration", handler=xarray_lambda_function
154-
),
155-
)
156-
CfnOutput(self, "Xarray-Endpoint", value=xarray_api.url)
157-
158125

159126
app = App()
160127
settings = StackSettings()

deployment/aws/lambda/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ WORKDIR /tmp
88
RUN dnf install -y gcc-c++ && dnf clean all
99

1010
RUN python -m pip install pip -U
11-
RUN python -m pip install "titiler-application==2.0.0dev0" "mangum==0.19.0" -t /asset --no-binary pydantic
11+
RUN python -m pip install "titiler-application==2.0.0dev0" "mangum==0.19.0" "cftime" -t /asset --no-binary pydantic,xarray,numpy,pandas
1212

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

deployment/aws/lambda/Dockerfile.xarray

Lines changed: 0 additions & 30 deletions
This file was deleted.

deployment/aws/lambda/xarray_handler.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

docker-compose.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ services:
2828
# - TITILER_API_DISABLE_STAC=TRUE/FALSE
2929
# - TITILER_API_DISABLE_MOSAIC=TRUE/FALSE
3030
# - TITILER_API_DISABLE_COG=TRUE/FALSE
31+
# - TITILER_API_DISABLE_ZARR=TRUE/FALSE
3132
# - TITILER_API_CORS_ORIGIN=url.io,url.xyz
3233
# - TITILER_API_CACHECONTROL=public, max-age=3600
3334
# - TITILER_API_DEBUG=TRUE/FALSE
@@ -82,16 +83,6 @@ services:
8283
- nginx-titiler
8384
command: ["nginx-debug", "-g", "daemon off;"]
8485

85-
titiler-xarray:
86-
extends:
87-
service: titiler
88-
build:
89-
context: .
90-
dockerfile: dockerfiles/Dockerfile.xarray
91-
ports:
92-
- "8082:8082"
93-
command: ["uvicorn", "titiler.xarray.main:app", "--host", "0.0.0.0", "--port", "8082", "--workers", "1"]
94-
9586
otel-collector:
9687
image: otel/opentelemetry-collector-contrib:latest
9788
command: ["--config=/etc/otel-collector-config.yaml"]

dockerfiles/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN python -m pip install -U pip
1717
RUN python -m pip install uvicorn uvicorn-worker gunicorn
1818

1919
COPY src/titiler/ /tmp/titiler/
20-
RUN python -m pip install /tmp/titiler/core /tmp/titiler/extensions["cogeo,stac"] /tmp/titiler/mosaic /tmp/titiler/application --no-cache-dir --upgrade
20+
RUN python -m pip install /tmp/titiler/core /tmp/titiler/extensions["cogeo,stac"] /tmp/titiler/mosaic["mosaicjson"] /tmp/titiler/xarray /tmp/titiler/application --no-cache-dir --upgrade
2121
RUN rm -rf /tmp/titiler
2222

2323
###################################################

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@ filename = "src/titiler/application/pyproject.toml"
249249
search = 'titiler-core[telemetry]=={current_version}'
250250
replace = 'titiler-core[telemetry]=={new_version}'
251251

252+
[[tool.bumpversion.files]]
253+
filename = "src/titiler/application/pyproject.toml"
254+
search = 'titiler-xarray=={current_version}'
255+
replace = 'titiler-xarray=={new_version}'
256+
252257
[[tool.bumpversion.files]]
253258
filename = "src/titiler/application/pyproject.toml"
254259
search = 'titiler-extensions[cogeo,stac]=={current_version}'

src/titiler/application/README.md

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)