Граф коммитов

32 Коммитов

Автор SHA1 Сообщение Дата
elayrocks a08f05e5d1
Azure Function App which runs periodically to aggregate the bytes read per IP address over a window of time (#215)
* init

* update

* update flake8 config

* code format changes

* fix long lines

* fix imports

* function app changes

* code format changes

* test

* remove readme

* remove redundant packages and revert python version

* revert python version

* remove redundant type hints

* use settings class inherited from baseSettings

* change kql

* use placeholder for timer schedule

* change test parameter

* update assertions and logger

* remove import

* remove dash in table name

* update test id

* format

* add no-integration flag

* add dependencies

* test

* change trigger to run every hour

* use azure clients as context manager

* add  context managers in test

* role assignment for function app

* change LAW name

* change role

* change provider's name

* change name of LAW

* better readability

* better readability

* format

* add logging

* UPDATE function settings

* suppress mypy warning

* update env variables for function app

* typo

---------

Co-authored-by: elay <yileihu@microsoft.com>
2024-06-26 08:16:00 -07:00
Matt McFarland 3b1e9f7258
Set root-path from uvicorn (#221)
* Set root-path from uvicorn

Sets the root path in uvicorn to match that set via FastAPI. This is
required with updates to starlette, which were included previously.

Fixes https://github.com/microsoft/PlanetaryComputer/issues/360

* New black formatting
2024-06-14 13:58:12 -04:00
Matt McFarland dc022d44b8
Auth against pccomponents for tagged image publish (#217)
* Auth against pccomponents for tagged image publish

* Reconcile node count with deployment
2024-06-11 16:06:04 -04:00
Matt McFarland 5628de76c2
Security upgrades for pcstac and pctiler (#214)
* Upgrade STAC libraries

* Updates for tiler
2024-06-11 13:52:48 -04:00
elayrocks 08ff800f1e remove redundant statement 2024-04-30 16:38:36 -07:00
elayrocks f4d50f624d remove client secret 2024-04-30 15:42:24 -07:00
Gustavo Hidalgo 69fb80c31c
Bump idna to 3.7 (#203) 2024-04-19 11:30:43 -04:00
Gustavo Hidalgo d68ec50e0c
Security patching (#191)
* Generate requirments.txt

* remove hashes

* Delete non-extra requirements file

* Now all projects have requirements.txt

* Remove BaseHTTPMiddlewares ,  Ensure origin host is used in STAC links

* Successfully build containers

* lint

* Docker images build

* Delete unused requirements file

* save

* Now requirements do get generated

* Update Azurite

* format setup.py

* add type annotation

* Read lerc_zstd

* speed up image rebuilds and better UT for lerc

* Update more packages

* upgrade stac-api-validation

* Remove files from older commits

---------

Co-authored-by: maitjoshi <maitjoshi@microsoft.com>
2024-04-16 10:22:07 -04:00
Gustavo Hidalgo 3bd6c08dab
Publish tagged builds to pccomponents (#202) 2024-04-15 14:17:08 -04:00
Maitreyee Joshi 877ca1b6c5
use pccomponentstest in cipublish (#200) 2024-04-12 09:55:24 -04:00
Gustavo Hidalgo e15caebee9 Try using the github AzCLI action 2024-04-01 18:55:06 -04:00
Gustavo Hidalgo 4acb8673f9 fix CLI args for authentication 2024-04-01 18:47:30 -04:00
Gustavo Hidalgo 2633026c9a log in with SP credentials 2024-04-01 18:43:55 -04:00
Gustavo Hidalgo ac394eefea sudo the whole authenticate script 2024-04-01 18:31:36 -04:00
Gustavo Hidalgo ca835c6b15 CI: put authentication in a script 2024-04-01 17:02:20 -04:00
Gustavo Hidalgo 9874f04203
Set docker image lineage and lifecycle annotations (#192)
There are metadata annotations we must set to inform downstream image consumers of image deprecation dates and lineage.
2024-03-29 17:08:30 -04:00
Matt McFarland 1282fbb893
Add config/map/token endpoint to support Data Catalog (#187)
* Add map token endpoint to tiler service

The tiler service will generate a token for use against an azure maps
instance, using the identity of the tiler (when deployed) or the local
developer credentials (in local development).

A test has been added that requires a local identity, and this has been
skipped in CI, which does not have access to those kind of credentials.

This endpoint will be used by the Data Catalog app to avoid distributing
an azure maps key within that application.

* Remove unneeded role assignment

* Remove unused variables
2024-03-18 09:44:34 -04:00
Matt McFarland 1b7ec57a3a
Upgrade pgstac and use queryables (#131)
* Upgrade pgstac to use db-based queryables

Upgrades to stac-fastapi and pgstac to make use of the pgstac.queryables
table being the source of API queryable endpoints.

* Changelog
2023-04-07 14:03:52 -04:00
Pete Gadomski 95190c56b7
ci: add stac-api-validator (#148)
Doesn't include features and item-search validation, but includes comments in
the validation script saying why.

Co-authored-by: Matt McFarland <mmcfarland@microsoft.com>
2023-01-31 16:02:00 -05:00
Rob Emanuele 338e19b89e
Add logo to image export endpoint in pcfuncs (#122)
* Add with_backoff to funclib tile fetching

This adds an aync version of with_backoff and
uses it in tile fetching to retry on errors,
which can prevent gray blotches in images and animations

* Refactor stamps to apply ot Images

This change generalizes the stamps framework
to allow for stamps that don't require an
AnimationFrame in anticipation of using the
stamp logic with the image endpoint.

* Add optional geometry param to image request

* Enable pytest console testing for pcfuncs

* Fixes to RenderOptions

* Enable logo stamp on image exports

* Improvements to with_backoff_async

* Refactor to consolidate exporters

This commit further abstracts common logic
between image and animation, and refactors
the codebase to use the generalized
functionality.

* Bound type for class to avoid mypy error

Co-authored-by: Matt McFarland <mmcfarland@microsoft.com>
2022-09-30 15:17:13 -04:00
Matt McFarland 6b8aaf0e8d
Timelapse animation enhancements (#119)
* Setup local and deployed funcs to use CORS

* nginx proxy facilitates CORS headers locally
* azurite container set to public access to local frontend can access
animation urls
* configure func apps deployed with CORS enabled

* Progress bar and branding options for animations

* Add animation hints for collection config

Optional better-than-default settings for animation frames, per
collection.

* Changelog

* Add logo stamp for animation endpoint

* Move stamps from animation to funclib

Stamps will get consumed by image endpoint in the future.
2022-09-21 20:53:49 -04:00
Matt McFarland f89e7a7eaf
Publish pcfuncs package (#117)
* Publish pcfuncs package

* Update changelog
2022-09-13 20:34:29 -04:00
Rob Emanuele 534b4d6418
Fix directory names in cideploy (#116) 2022-08-16 13:28:47 -04:00
Rob Emanuele bb4ac9de96
Add Azure Functions for creating images and animations (#115)
* Consolidate dev dependencies into requirements-dev.txt

* Add simple azure storage support to pccommon

* Set up azurite container for dev output

* Add pcfuncs codebase

This includes the "animation" and "image" functions,
as well as the "funclib" library that contains
reusable code for fetching rasters from the
PC data API.

* Add pcfuncs to dev servers and processes

* Add Azure Functions to deployment

* Move funcs information to main README

* Fix titiler link

* Avoid flake8 on setup.py

* Delete unused reprojection utility method/type

* Remove debug log information

* Don't restrict concurrency setting
2022-08-16 12:02:09 -04:00
Nathan Zimmerman 3e1c1fc3b3
Add script for building queryable schemas (#58)
* Add script for building queryable schemas
* Use stac-dev container to build queryables
* Add readme entry and update format script
* Add default title and improved queryable property keys

Co-authored-by: Matt McFarland <mmcfarland@microsoft.com>
2022-04-12 19:15:10 -04:00
Rob Emanuele 3684024c9c
Add redis for caching and rate limiting (#52)
* Add redis to docker-compose services

* Refactor get_request_ip into utils

* Rename TABLE_TTL -> TTL, will use it with caching

* Add redis caching and rate limiting to pccommon

* Add rate limit configuration

* Caching and rate limiting on STAC API

* Add redis to terraform

* Add redis config to helm charts

* Connect to redis for tests

* Add test for rate limit, but skip as it is nondeterministic

* Update CHANGELOG

* Implement backpressure

* Add backpressure to Helm chart

* Use decorators for rate_limit and back_pressure

* Add IP exception table that avoids rate limiting

* Get the IP from the last in the list, not first

If using an X-Forwarded-For to get the IP,
get the last one as that will be the IP coming from
the last proxy. The first IP can be anything set on
the header of the request. Since we take the
X-Azure-ClientIP header value first, this would
have not been used, but changing for best practice.

* And IP exception table to Helm chart

* Allow traffic from planetarycomputer-test

* Add ip-exception config to tiler docker-compose

Co-authored-by: Matt McFarland <mmcfarland@microsoft.com>
2022-03-04 15:23:45 -05:00
Rob Emanuele 33f5487247
Use Azure Storage Tables for collection and container configuration (#48)
* Add additional dependencies to pccommon

* Fix mypy error in pctiler

Brining in the type stubs for cachetools caused
mypy to complain about unknown types for the key
function

* Refactor scripts to test pccommon

Also run flake8 on pccommon,
which wasn't happening

* Linting fixups

* Add tables classes

* Refactor collection config in pccommon

Also refactor CommonConfig to use pydantic settings.
Create a table setup for collection configuration
and container configuration.
Use cachetools to cache the configuration.

* Add Azurite setup

Encode collection configuration and container
configuration (which was hardcoded) as JSON.
This can be used to populate the initial
table structure in deployment as well, after
which this test data will diverge from production
settings.

* Update codebase to use refactored configuration

* Set azurite settings in docker-compose

Also account for environment prefix for DEBUG
that change with refactor to use BaseSettings in
CommonConfig

* Move to using only pytest for consistency

* Test get render config for naip

* Refactor config code layout

Enable configuration of TTL

* Run azurite setup in scripts/setup

Also fix setup_azurite

* Add mosaicInfo and queriables to collection config

* Remove usage of requirements.txt

This was being used inconsistently.

* Add script for local package install

* Fetch queryables from storage tables

* Use orjson in pccommon

* Use ORJSONResponse

* Remove unused endpoint prefixes

* Add mosiac/info endpoint

* Add method to fetch all rows

* Add CLI for loading and dumping config data

* Variable for k8s version; update dev

* Allow AKS to pull from ACR

* Storage Tables in terraform

* Add config table env vars to helm charts

* Update ingress apiVersion

* Make note in deploy README about updating tables

* Update CHANGELOG

* Linting/formatting

* Remove unused __init__ override

This was left over from a previous
implementation, should have been cleaned up.

* Remove unused vars in dev terraform

* Allow cli to dump configs by id

Co-authored-by: Matt McFarland <mmcfarland@microsoft.com>
2022-02-17 16:06:08 -05:00
Matthew McFarland 48c44b41fa
Restore default limit and gnatsgo render config (#36)
* gnatsgo render config

* Override response limit for GET requests

Restores PC default limit of 250 items in response of GET searches and
collection item path queries.

* Update changelog

* Keep /items endpoint at default limit of 10

* Change gnatsgo collection ID to gnatsgo-rasters

* Add ability to scope test run

* Add test for search and /items page limit

* Update gnatsgo asset name

Co-authored-by: Rob Emanuele <rdemanuele@gmail.com>
2022-01-20 12:21:16 -05:00
Matthew McFarland 3f767d6c00
Logging improvements (#23)
* Add dedicated health check endpoint for pctiler

Also sets the liveness probe to use this new endpoint. Uses the same URL
path as pcstac, this will help isolate requests in the logs.

* Use constants for logging service name

* Fix local volume mount

The directory is copied in the Dockerfile, so it was loading on the
container, however this typo prevented reloading of pccommon when
changes were made without rebuilding the image.

* Consolidate tracing functionality

Rather than maintaining parity between two request tracing
implementations, create a common trace that can be used by both
projects.

* Prevent request tracing on health check endpoints

* Parse collection/item ids from search for logging

* Allow ACR overrides in dev deployments

Defaults to publish images for staging deploys

* Rename for Python convention

* Include request ip in trace

* Remove unused config

* Use request sensitive middleware for trace logs

Traditional middleware will corrupt usage of starlette request objects
by downstream route functions. Use a middleware class crafted for
accessing the request body without interfering with further processing.

* Lint: formatting

Auto-formatter
2022-01-10 15:46:25 -05:00
Rob Emanuele 81a666e843
Project renames; publish and deploy (#12)
* Add helm chart publication

* Remove old cipublish path

* switch from "1" to "true"

GitHub sets CI to "true" rather than 1:
https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables

* wip -- attempt the run

* don't condition deploy step for now

* switch branch back to main

youc an use $default-branch in templates, but not
actual workflows:
https://github.blog/changelog/2020-07-22-github-actions-better-support-for-alternative-default-branch-names/

* switch branch back to main

youc an use $default-branch in templates, but not
actual workflows:
https://github.blog/changelog/2020-07-22-github-actions-better-support-for-alternative-default-branch-names/

* set azure env variables

* parse and echo from json

* don't set tenant id?

https://github.com/hashicorp/terraform-provider-azuread/issues/343#issuecomment-721455149

??

* oops i don't think these are getting passed through

* add override compose

this compose file un-sets the env variables that we don't have because
we don't have a .env file in ci, so I _think_ it should inherit them
from the environment

* add back mqe resource group

why was this deleted

am i being trolled

* Add path debugging

* check what tf keys we got

* remove api management from ingress 🤞🏻

* all container registries through github

* remove debug prints from jinja

* re-remove the mqe resource group

because it was deliberately missing, not accidentally

* skip tests for a sec

* debug echo cluster name and rg

* require az account env variables

* reuse tf env variable names

* don't point to `latest` tag

* Add workflow for publishing helm charts to GH Pages.

* Rename charts, separate published, reset versions

* Use -dev suffix for development release

* Publish dev charts only on main

* Rename mqe -> stac, dqe -> tiler in codebase

* Update README

Rename MQE to STAC API and DQE to Tiler; also editorally make things more terse

* Remove testdata, move loadtestdata to tests

* Remove out of date and generic docs for tiler

* Use cipublish to publish images

* Rename python packages to be prefixed with 'pc'

* Remove stac-vrt

* Remove unused model and method.

Also formatting

* Remove scripts/env

* Upgrade to stac-fastapi 2.2.0

* Delete unusued doc images

* Update deployment code with renames.

* Update cert-manager, other deployment fixes

* Test on cibuild, remove GA test branch trigger

* Fixup PR template

Co-authored-by: Nathan Zimmerman <npzimmerman@gmail.com>
Co-authored-by: James Santucci <james.santucci@gmail.com>
2021-11-01 11:27:39 -04:00
Nathan Zimmerman 57b22b89d0
Add helm chart publication (#9)
* Add helm chart publication

* Remove old cipublish path
2021-10-25 12:47:41 -04:00
Rob Emanuele e1ec9529c6 Initial commit. 2021-10-18 12:13:28 -04:00