Skip to content

Commit

Permalink
Merge pull request #21 from Element84/merge-from-upstream-0.14.0
Browse files Browse the repository at this point in the history
Merge from upstream 0.14.0
  • Loading branch information
MattBialas authored Sep 8, 2023
2 parents 31d0034 + 3e8c47d commit cb1e37c
Show file tree
Hide file tree
Showing 67 changed files with 1,643 additions and 702 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.12.0
current_version = 0.14.0
commit = True
tag = True
tag_name = {new_version}
Expand Down
35 changes: 32 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ jobs:
- name: install siege
run: |
sudo apt update
sudo apt install --yes siege
sudo apt install --yes siege jq
siege -C
- name: Start containers
run: docker-compose -f "docker-compose.yml" up -d --build benchmark

Expand All @@ -30,12 +32,39 @@ jobs:

- name: Run siege (WebMercator TMS)
run: |
siege --file .github/data/urls.txt -b -c 1 -r 100 > /dev/null
siege --file .github/data/urls.txt -b -c 1 -r 100 --json-output 2>&1 | jq -c > results.json
echo "Benchmark Results"
cat results.json | jq
echo "Parse Results"
cat results.json | jq '{"name": "WebMercator elapsed_time", "unit": "s", "value": .elapsed_time}, {"name": "WebMercator data_transferred", "unit": "Megabytes", "value": .data_transferred}, {"name": "WebMercator response_time", "unit": "s", "value": .response_time}, {"name": "WebMercator longest_transaction", "unit": "s", "value": .longest_transaction}' > output.json
- name: Run siege (WGS1984Quad TMS)
run: |
siege --file .github/data/urls_wgs84.txt -b -c 1 -r 100 > /dev/null
siege --file .github/data/urls_wgs84.txt -b -c 1 -r 100 --json-output 2>&1 | jq -c > results.json
echo "Benchmark Results"
cat results.json | jq
echo "Parse Results"
cat results.json | jq '{"name": "WGS1984Quad elapsed_time", "unit": "s", "value": .elapsed_time}, {"name": "WGS1984Quad data_transferred", "unit": "Megabytes", "value": .data_transferred}, {"name": "WGS1984Quad response_time", "unit": "s", "value": .response_time}, {"name": "WGS1984Quad longest_transaction", "unit": "s", "value": .longest_transaction}' >> output.json
- name: Stop containers
if: always()
run: docker-compose -f "docker-compose.yml" down

- name: Merge Outputs
run: |
cat output.json | jq '[inputs]' > benchmark.json
- name: Check and Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: TiTiler performance Benchmarks
tool: 'customSmallerIsBetter'
output-file-path: benchmark.json
alert-threshold: '130%'
comment-on-alert: true
fail-on-alert: false
# GitHub API token to make a commit comment
github-token: ${{ secrets.GITHUB_TOKEN }}
gh-pages-branch: 'gh-benchmarks'
# Make a commit only if main
auto-push: ${{ github.ref == 'refs/heads/main' }}
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ repos:
additional_dependencies:
- types-simplejson
- types-attrs
- pydantic~=2.0
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 0.14.0-1.0.2 (2023-08-16)

* updated from upstream v0.14.0

## 0.12.0-1.0.1 (2023-08-16)

* add boto3 package to lambda zip to satisfy use of dynamodb for mosaic
Expand Down
97 changes: 96 additions & 1 deletion CHANGES_upstream.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,100 @@
# Release Notes

## 0.14.0 (2023-08-30)

### titiler.core

* replace `-` by `_` in query parameters **breaking change**
- `coord-crs` -> `coord_crs`
- `dst-crs` -> `dst_crs`

* replace `buffer` and `color_formula` endpoint parameters by external dependencies (`BufferParams` and `ColorFormulaParams`)

* add `titiler.core.utils.render_image` which allow non-binary alpha band created with custom colormap. `render_image` replace `ImageData.render` method.

```python
# before
if cmap := colormap or dst_colormap:
image = image.apply_colormap(cmap)

if not format:
format = ImageType.jpeg if image.mask.all() else ImageType.png

content = image.render(
img_format=format.driver,
**format.profile,
**render_params,
)

# now
# render_image will:
# - apply the colormap
# - choose the right output format if `None`
# - create the binary data
content, media_type = render_image(
image,
output_format=format,
colormap=colormap or dst_colormap,
**render_params,
)
```

### titiler.extension

* rename `geom-densify-pts` to `geometry_densify` **breaking change**
* rename `geom-precision` to `geometry_precision` **breaking change**

## 0.13.3 (2023-08-27)

* fix Factories `url_for` method and avoid changing `Request.path_params` object

## 0.13.2 (2023-08-24)

### titiler.extensions

* replace mapbox-gl by maplibre
* replace Stamen by OpenStreetMap tiles
* simplify band selection handling (author @tayden, https://github.com/developmentseed/titiler/pull/688)

## 0.13.1 (2023-08-21)

### titiler.core

* fix `LowerCaseQueryStringMiddleware` unexpectedly truncating query parameters (authors @jthetzel and @jackharrhy, @https://github.com/developmentseed/titiler/pull/677)

## titiler.application

* add `cors_allow_methods` in `ApiSettings` to control the CORS allowed methods (author @ubi15, https://github.com/developmentseed/titiler/pull/684)

## 0.13.0 (2023-07-27)

* update core requirements to libraries using pydantic **~=2.0**

### titiler.core

* update requirements:
* fastapi `>=0.95.1` --> `>=0.100.0`
* pydantic `~=1.0` --> `~=2.0`
* rio-tiler `>=5.0,<6.0` --> `>=6.0,<7.0`
* morecantile`>=4.3,<5.0` --> `>=5.0,<6.0`
* geojson-pydantic `>=0.4,<0.7` --> `>=1.0,<2.0`
* typing_extensions `>=4.6.1`

### titiler.extension

* update requirements:
* rio-cogeo `>=4.0,<5.0"` --> `>=5.0,<6.0"`

### titiler.mosaic

* update requirements:
* cogeo-mosaic `>=6.0,<7.0` --> `>=7.0,<8.0`

### titiler.application

* use `/api` and `/api.html` for documentation (instead of `/openapi.json` and `/docs`)
* update landing page

## 0.12.0 (2023-07-17)

* use `Annotated` Type for Query/Path parameters
Expand Down Expand Up @@ -1062,4 +1157,4 @@ link: https://github.com/developmentseed/titiler/commit/fa2cb78906b0fd88506b89ba

Initial release

link: https://github.com/developmentseed/titiler/commit/f4fdc02ea0235470589eeb34a4da8e5aae74e696
link: https://github.com/developmentseed/titiler/commit/f4fdc02ea0235470589eeb34a4da8e5aae74e696
8 changes: 4 additions & 4 deletions build-lambda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ python -m pip install \
./src/titiler/mosaic \
./src/titiler/application \
mangum==0.17.0 \
rasterio==1.3.6 \
morecantile==4.3.0 \
rio-tiler==5.0.3 \
cogeo-mosaic==6.2.0 \
rasterio \
"morecantile>=5.0,<6.0" \
"rio-tiler>=6.0,<7.0" \
"cogeo-mosaic>=7.0,<8.0" \
markupsafe==2.0.1 \
boto3==1.28.27

Expand Down
32 changes: 9 additions & 23 deletions deployment/aws/cdk/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,31 @@

from typing import Dict, List, Optional

import pydantic
from pydantic_settings import BaseSettings, SettingsConfigDict


class StackSettings(pydantic.BaseSettings):
class StackSettings(BaseSettings):
"""Application settings"""

name: str = "titiler"
stage: str = "production"

owner: Optional[str]
client: Optional[str]
owner: Optional[str] = None
client: Optional[str] = None

# Default options are optimized for CloudOptimized GeoTIFF
# For more information on GDAL env see: https://gdal.org/user/configoptions.html
# or https://developmentseed.org/titiler/advanced/performance_tuning/
env: Dict = {
"CPL_VSIL_CURL_ALLOWED_EXTENSIONS": ".tif,.TIF,.tiff",
"CPL_VSIL_CURL_CACHE_SIZE": "200000000",
"GDAL_CACHEMAX": "200", # 200 mb
"GDAL_DISABLE_READDIR_ON_OPEN": "EMPTY_DIR",
"GDAL_INGESTED_BYTES_AT_OPEN": "32770", # size of Landsat 8 header
"GDAL_INGESTED_BYTES_AT_OPEN": "32768", # get more bytes when opening the files.
"GDAL_HTTP_MERGE_CONSECUTIVE_RANGES": "YES",
"GDAL_HTTP_MULTIPLEX": "YES",
"GDAL_HTTP_VERSION": "2",
"GDAL_BAND_BLOCK_CACHE": "HASHSET",
"PYTHONWARNINGS": "ignore",
"VSI_CACHE": "TRUE",
"VSI_CACHE_SIZE": "5000000", # 5 MB (per file-handle)
"AWS_REQUEST_PAYER": "requester",
}

# S3 bucket names where TiTiler could do HEAD and GET Requests
Expand Down Expand Up @@ -74,29 +70,19 @@ class StackSettings(pydantic.BaseSettings):
# Override the automatic definition of number of workers.
# Set to the number of CPU cores in the current server multiplied by the environment variable WORKERS_PER_CORE.
# So, in a server with 2 cores, by default it will be set to 2.
web_concurrency: Optional[int]
web_concurrency: Optional[int] = None

image_version: str = "latest"

###########################################################################
# AWS LAMBDA
# The following settings only apply to AWS Lambda deployment
# more about lambda config: https://www.sentiatechblog.com/aws-re-invent-2020-day-3-optimizing-lambda-cost-with-multi-threading
timeout: int = 60 # MosaicJSON creation takes much more time than tile creation
timeout: int = 10
memory: int = 1536

# The maximum of concurrent executions you want to reserve for the function.
# Default: - No specific limit - account limit.
max_concurrent: Optional[int]
max_concurrent: Optional[int] = None

mosaic_backend: str
mosaic_host: str
mosaic_format: str = ".json.gz" # format will be ignored for dynamodb backend

permissions_boundary_name: Optional[str]

class Config:
"""model config"""

env_file = ".env"
env_prefix = "TITILER_STACK_"
model_config = SettingsConfigDict(env_prefix="TITILER_STACK_", env_file=".env")
6 changes: 3 additions & 3 deletions deployment/aws/lambda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ RUN pip install \
# pin markupsafe so jinja will have access to soft_unicode
# https://github.com/aws/aws-sam-cli/issues/3661#issuecomment-1044340547
markupsafe==2.0.1 \
titiler.application==0.12.0 \
titiler.mosaic==0.12.0 \
titiler.core==0.12.0 \
titiler.application==0.14.0 \
titiler.mosaic==0.14.0 \
titiler.core==0.14.0 \
-t /var/task --no-binary pydantic
# original code also had --no-binary numpy, which takes 20-30 minutes to build

Expand Down
4 changes: 2 additions & 2 deletions deployment/aws/requirements-cdk.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ aws_cdk-aws_apigatewayv2_integrations_alpha==2.76.0a0
constructs>=10.0.0

# pydantic settings
pydantic==1.10.11
python-dotenv
pydantic~=2.0
pydantic-settings~=2.0
4 changes: 2 additions & 2 deletions deployment/k8s/charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
appVersion: 0.12.0
appVersion: 0.14.0
description: A dynamic Web Map tile server
name: titiler
version: 1.1.2
version: 1.1.3
icon: https://raw.githubusercontent.com/developmentseed/titiler/main/docs/logos/TiTiler_logo_small.png
maintainers:
- name: emmanuelmathot # Emmanuel Mathot
Expand Down
1 change: 1 addition & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ nav:
- External links: "external_links.md"
- Development - Contributing: "contributing.md"
- Release Notes: "release-notes.md"
- Performance Benchmarks: benchmark.html

plugins:
- search
Expand Down
Loading

0 comments on commit cb1e37c

Please sign in to comment.