Skip to content

Commit

Permalink
merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Mar 13, 2024
2 parents 42eff0c + 02617ac commit cc782df
Show file tree
Hide file tree
Showing 36 changed files with 317 additions and 163 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.15.6
current_version = 0.17.0
commit = True
tag = True
tag_name = {new_version}
Expand Down
14 changes: 11 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Set update schedule for GitHub Actions

version: 2
updates:
- package-ecosystem: github-actions
directory: /

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
# Check for updates to GitHub Actions every week
interval: "weekly"
groups:
all:
patterns:
- "*"
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: install siege
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/check_charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -33,16 +33,16 @@ jobs:
fi
- name: Set up Helm
uses: azure/setup-helm@v1
uses: azure/setup-helm@v4
with:
version: v3.9.2

- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.2.1
uses: helm/chart-testing-action@v2.6.1

- name: Run chart-testing (list-changed)
id: list-changed
Expand All @@ -56,7 +56,7 @@ jobs:
run: ct lint --chart-dirs deployment/k8s --target-branch ${{ github.event.repository.default_branch }}

- name: Build container
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
if: steps.list-changed.outputs.changed == 'true'
with:
# See https://github.com/developmentseed/titiler/discussions/387
Expand All @@ -67,7 +67,7 @@ jobs:
tags: "titiler:dev"

- name: Create kind cluster
uses: helm/kind-action@v1.2.0
uses: helm/kind-action@v1.9.0
if: steps.list-changed.outputs.changed == 'true'

- name: Load container image in kind cluster
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
- name: Upload Results
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
Expand All @@ -79,7 +79,7 @@ jobs:
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -161,17 +161,17 @@ jobs:
type=raw,value=latest,enable={{is_default_branch}}
# Uvicorn
# - name: Build and push uvicorn
# uses: docker/build-push-action@v5
# with:
# platforms: linux/amd64,linux/arm64
# context: .
# file: dockerfiles/Dockerfile.uvicorn
# push: ${{ github.event_name != 'pull_request' }}
# tags: ${{ steps.meta-uvicorn.outputs.tags }}
# labels: ${{ steps.meta-uvicorn.outputs.labels }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
- name: Build and push uvicorn
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
file: dockerfiles/Dockerfile.uvicorn
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-uvicorn.outputs.tags }}
labels: ${{ steps.meta-uvicorn.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

# Gunicorn
- name: Build and push
Expand Down Expand Up @@ -204,7 +204,7 @@ jobs:
shell: bash

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy_mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8

Expand Down
63 changes: 63 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,69 @@

## Unreleased

### titiler.core

* Add `use_epsg` parameter to WMTS endpoint to resolve ArcMAP issues and fix XML formating (author @gadomski, https://github.com/developmentseed/titiler/pull/782)
* Add more OpenAPI metadata for algorithm (author @JinIgarashi, https://github.com/developmentseed/titiler/pull/783)

### titiler.application

* fix invalid url parsing in HTML responses

## 0.17.0 (2024-01-17)

### titiler.core

* update `rio-tiler` version to `>6.3.0`
* use new `align_bounds_with_dataset=True` rio-tiler option in GeoJSON statistics methods for more precise calculation

## 0.16.2 (2024-01-17)

### titiler.core

* fix leafletjs template maxZoom to great than 18 for `/map` endpoint (author @Firefishy, https://github.com/developmentseed/titiler/pull/749)

## 0.16.1 (2024-01-08)

### titiler.core

* use morecantile `TileMatrixSet.cellSize` property instead of deprecated/private `TileMatrixSet._resolution` method

### titiler.mosaic

* use morecantile `TileMatrixSet.cellSize` property instead of deprecated/private `TileMatrixSet._resolution` method

## 0.16.0 (2024-01-08)

### titiler.core

* update FastAPI version lower limit to `>=0.107.0`
* fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument (author @jasongi, https://github.com/developmentseed/titiler/pull/744)

### titiler.extensions

* fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument (author @jasongi, https://github.com/developmentseed/titiler/pull/744)

### titiler.application

* fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument (author @jasongi, https://github.com/developmentseed/titiler/pull/744)

## 0.15.8 (2024-01-08)

### titiler.core

* use morecantile `TileMatrixSet.cellSize` property instead of deprecated/private `TileMatrixSet._resolution` method [backported from 0.16.1]

### titiler.mosaic

* use morecantile `TileMatrixSet.cellSize` property instead of deprecated/private `TileMatrixSet._resolution` method [backported from 0.16.1]

## 0.15.7 (2024-01-08)

### titiler.core

* update FastAPI version upper limit to `<0.107.0` to avoid starlette breaking change (`0.28`)

### titiler.application

* add simple *auth* (optional) based on `global_access_token` string, set with `TITILER_API_GLOBAL_ACCESS_TOKEN` environment variable (author @DeflateAwning, https://github.com/developmentseed/titiler/pull/735)
Expand Down
2 changes: 1 addition & 1 deletion deployment/aws/lambda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM --platform=linux/amd64 public.ecr.aws/lambda/python:${PYTHON_VERSION}
WORKDIR /tmp

RUN pip install pip -U
RUN pip install "titiler.application==0.15.6" "mangum>=0.10.0" -t /asset --no-binary pydantic
RUN pip install "titiler.application==0.17.0" "mangum>=0.10.0" -t /asset --no-binary pydantic

# 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;
Expand Down
14 changes: 6 additions & 8 deletions deployment/azure/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
### Function

TiTiler is built on top of [FastAPI](https://github.com/tiangolo/fastapi), a modern, fast, Python web framework for building APIs. As for AWS Lambda we can make our FastAPI application work on Azure Function by wrapping it within the [Azure Function Python worker](https://github.com/Azure/azure-functions-python-worker).
TiTiler is built on top of [FastAPI](https://github.com/tiangolo/fastapi), a modern, fast, Python web framework for building APIs. We can make our FastAPI application work as an Azure Function by wrapping it within the [Azure Function Python worker](https://github.com/Azure/azure-functions-python-worker).

If you are not familiar with **Azure functions** we recommend checking https://docs.microsoft.com/en-us/azure/azure-functions/ first.

Minimal TiTiler Azure function code:
```python
import azure.functions as func
from titiler.application.routers import cog, mosaic, stac, tms
from titiler.application.main import cog, mosaic, stac, tms
from fastapi import FastAPI


Expand All @@ -20,14 +20,12 @@ app.include_router(mosaic.router, prefix="/mosaicjson", tags=["MosaicJSON"])
app.include_router(tms.router, tags=["TileMatrixSets"])


def main(
async def main(
req: func.HttpRequest, context: func.Context,
) -> func.HttpResponse:
return func.AsgiMiddleware(app).handle(req, context)
return await func.AsgiMiddleware(app).handle_async(req, context)
```

Note: there is a `bug` in `azure.functions.AsgiMiddleware` which prevent using `starlette.BaseHTTPMiddleware` middlewares (see: https://github.com/Azure/azure-functions-python-worker/issues/903).

#### Requirements
- Azure CLI: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
- Azure Function Tool: https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local
Expand All @@ -42,8 +40,8 @@ $ cd titiler/deployment/azure

$ az login
$ az group create --name AzureFunctionsTiTiler-rg --location eastus
$ az storage account create --name TiTilerStorage --sku Standard_LRS
$ az functionapp create --consumption-plan-location eastus --runtime python --runtime-version 3.8 --functions-version 3 --name titiler --os-type linux
$ az storage account create --name titilerstorage --sku Standard_LRS -g AzureFunctionsTiTiler-rg
$ az functionapp create --consumption-plan-location eastus --runtime python --runtime-version 3.8 --functions-version 3 --name titiler --os-type linux -g AzureFunctionsTiTiler-rg -s titilerstorage
$ func azure functionapp publish titiler
```

Expand Down
41 changes: 19 additions & 22 deletions deployment/azure/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@
from starlette_cramjam.middleware import CompressionMiddleware

from titiler.application import __version__ as titiler_version
from titiler.application.custom import templates
from titiler.application.routers import cog, mosaic, stac, tms
from titiler.application.main import cog, mosaic, stac, templates, tms
from titiler.application.settings import ApiSettings
from titiler.core.errors import DEFAULT_STATUS_CODES, add_exception_handlers

# from titiler.core.middleware import (
# CacheControlMiddleware,
# LoggerMiddleware,
# LowerCaseQueryStringMiddleware,
# TotalTimeMiddleware,
# )
from titiler.core.middleware import (
CacheControlMiddleware,
LoggerMiddleware,
LowerCaseQueryStringMiddleware,
TotalTimeMiddleware,
)
from titiler.mosaic.errors import MOSAIC_STATUS_CODES

api_settings = ApiSettings()
Expand Down Expand Up @@ -68,19 +66,18 @@
},
)

# see https://github.com/encode/starlette/issues/1320
# app.add_middleware(
# CacheControlMiddleware,
# cachecontrol=api_settings.cachecontrol,
# exclude_path={r"/healthz"},
# )
app.add_middleware(
CacheControlMiddleware,
cachecontrol=api_settings.cachecontrol,
exclude_path={r"/healthz"},
)

# if api_settings.debug:
# app.add_middleware(LoggerMiddleware, headers=True, querystrings=True)
# app.add_middleware(TotalTimeMiddleware)
if api_settings.debug:
app.add_middleware(LoggerMiddleware, headers=True, querystrings=True)
app.add_middleware(TotalTimeMiddleware)

# if api_settings.lower_case_query_parameters:
# app.add_middleware(LowerCaseQueryStringMiddleware)
if api_settings.lower_case_query_parameters:
app.add_middleware(LowerCaseQueryStringMiddleware)


@app.get("/healthz", description="Health Check", tags=["Health Check"])
Expand All @@ -99,9 +96,9 @@ def landing(request: Request):
)


def main(
async def main(
req: func.HttpRequest,
context: func.Context,
) -> func.HttpResponse:
"""Run App in AsgiMiddleware."""
return func.AsgiMiddleware(app).handle(req, context)
return await func.AsgiMiddleware(app).handle_async(req, context)
2 changes: 1 addition & 1 deletion deployment/azure/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
"version": "[3.*, 4.0.0)"
},
"extensions": {
"http": {
Expand Down
2 changes: 1 addition & 1 deletion deployment/k8s/charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
appVersion: 0.15.6
appVersion: 0.17.0
description: A dynamic Web Map tile server
name: titiler
version: 1.1.2
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3'
services:
titiler:
# See https://github.com/developmentseed/titiler/discussions/387
platform: linux/amd64
# platform: linux/amd64
build:
context: .
dockerfile: dockerfiles/Dockerfile.gunicorn
Expand Down Expand Up @@ -48,7 +48,7 @@ services:

titiler-uvicorn:
# See https://github.com/developmentseed/titiler/discussions/387
platform: linux/amd64
# platform: linux/amd64
build:
context: .
dockerfile: dockerfiles/Dockerfile.uvicorn
Expand Down
Loading

0 comments on commit cc782df

Please sign in to comment.