Skip to content

Commit af20c89

Browse files
Merge pull request #2 from developmentseed/AtomicMaps/main
Slight rework of PR
2 parents 987e9ee + 6c27175 commit af20c89

File tree

3 files changed

+35
-24
lines changed

3 files changed

+35
-24
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,4 @@ cython_debug/
160160
# and can be added to the global gitignore or merged into this file. For a more nuclear
161161
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162162
#.idea/
163-
.pgdata
163+
.pgdata

README.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
STAC Auth Proxy is a proxy API that mediates between the client and your internally accessible STAC API to provide flexible authentication, authorization, and content-filtering mechanisms.
99

1010
> [!IMPORTANT]
11+
>
1112
> **We would :heart: to hear from you!**
1213
> Please [join the discussion](https://github.com/developmentseed/eoAPI/discussions/209) and let us know how you're using eoAPI! This helps us improve the project for you and others.
1314
> If you prefer to remain anonymous, you can email us at [email protected], and we'll be happy to post a summary on your behalf.
@@ -25,7 +26,9 @@ STAC Auth Proxy is a proxy API that mediates between the client and your interna
2526

2627
### Running
2728

28-
The simplest way to run the project is by invoking the application via Docker:
29+
#### Docker
30+
31+
The simplest way to run the project is via Docker:
2932

3033
```sh
3134
docker run \
@@ -36,31 +39,42 @@ docker run \
3639
ghcr.io/developmentseed/stac-auth-proxy:latest
3740
```
3841

39-
Alternatively, the module can be invoked directly or the application's factory can be passed to Uvicorn:
42+
#### Python
43+
44+
The installed Python module can be invoked directly:
4045

4146
```sh
4247
python -m stac_auth_proxy
4348
```
4449

50+
#### Uvicorn
51+
52+
The application's factory can be passed to Uvicorn:
53+
4554
```sh
4655
uvicorn --factory stac_auth_proxy:create_app
4756
```
4857

49-
### Docker compose
58+
#### Docker Compose
59+
60+
The codebase ships with a `docker-compose.yaml` file, allowing the proxy to be run locally alongside various supporting services: the database, the STAC API, and a Mock OIDC provider.
61+
62+
##### pgSTAC Backend
5063

51-
Run all of the services required to run the application locally including the the database, STAC API, and Mock OICD provider using Docker compose.
64+
Run the application stack with a pgSTAC backend using [stac-fastapi-pgstac](https://github.com/stac-utils/stac-fastapi-pgstac):
5265

53-
Spin up the application stack with the pgSTAC backend using [stac-fastapi-pgstac](https://github.com/stac-utils/stac-fastapi-pgstac):
5466
```sh
55-
UPSTREAM_URL=http://stac-pg:8001 docker compose --profile pg up
67+
docker compose up
5668
```
5769

58-
and with the OpenSearch backend using [stac-fastapi-elasticsearch-opensearch](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch):
70+
##### OpenSearch Backend
71+
72+
Run the application stack with an OpenSearch backend using [stac-fastapi-elasticsearch-opensearch](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch):
73+
5974
```sh
60-
UPSTREAM_URL=http://stac-os:8001 docker compose --profile os up
75+
docker compose --profile os up
6176
```
6277

63-
6478
### Installation
6579

6680
For local development, we use [`uv`](https://docs.astral.sh/uv/) to manage project dependencies and environment.
@@ -83,6 +97,7 @@ pip install -e .
8397
The application is configurable via environment variables.
8498

8599
#### Core
100+
86101
- **`UPSTREAM_URL`**, STAC API URL
87102
- **Type:** HTTP(S) URL
88103
- **Required:** Yes
@@ -114,6 +129,7 @@ The application is configurable via environment variables.
114129
- **Note:** This is independent of the upstream API's path. The proxy will handle removing this prefix from incoming requests and adding it to outgoing links.
115130

116131
#### Authentication
132+
117133
- **`OIDC_DISCOVERY_URL`**, OpenID Connect discovery document URL
118134
- **Type:** HTTP(S) URL
119135
- **Required:** Yes
@@ -155,6 +171,7 @@ The application is configurable via environment variables.
155171
- **Example:** `false`, `1`, `True`
156172

157173
#### OpenAPI / Swagger UI
174+
158175
- **`OPENAPI_SPEC_ENDPOINT`**, path of OpenAPI specification, used for augmenting spec response with auth configuration
159176
- **Type:** string or null
160177
- **Required:** No, defaults to `null` (disabled)
@@ -177,6 +194,7 @@ The application is configurable via environment variables.
177194
- **Example:** `{"clientId": "stac-auth-proxy", "usePkceWithAuthorizationCodeGrant": true}`
178195

179196
#### Filtering
197+
180198
- **`ITEMS_FILTER_CLS`**, CQL2 expression generator for item-level filtering
181199
- **Type:** JSON object with class configuration
182200
- **Required:** No, defaults to `null` (disabled)

docker-compose.yaml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
services:
22
stac-pg:
3-
profiles: ["pg"]
3+
profiles: [""] # default profile
44
image: ghcr.io/stac-utils/stac-fastapi-pgstac:5.0.2
55
environment:
66
APP_HOST: 0.0.0.0
77
APP_PORT: 8001
88
RELOAD: true
9-
ENVIRONMENT: local
109
POSTGRES_USER: username
1110
POSTGRES_PASS: password
1211
POSTGRES_DBNAME: postgis
1312
POSTGRES_HOST_READER: database-pg
1413
POSTGRES_HOST_WRITER: database-pg
1514
POSTGRES_PORT: 5432
16-
WEB_CONCURRENCY: 10
17-
VSI_CACHE: TRUE
18-
GDAL_HTTP_MERGE_CONSECUTIVE_RANGES: YES
19-
GDAL_DISABLE_READDIR_ON_OPEN: EMPTY_DIR
2015
DB_MIN_CONN_SIZE: 1
2116
DB_MAX_CONN_SIZE: 1
2217
USE_API_HYDRATE: ${USE_API_HYDRATE:-false}
18+
hostname: stac
2319
ports:
2420
- "8001:8001"
2521
depends_on:
@@ -30,32 +26,31 @@ services:
3026
profiles: ["os"]
3127
container_name: stac-fastapi-os
3228
image: ghcr.io/stac-utils/stac-fastapi-os:v6.1.0
33-
hostname: stac-os
3429
environment:
35-
STAC_FASTAPI_TITLEL: stac-fastapi-opensearch
30+
STAC_FASTAPI_TITLE: stac-fastapi-opensearch
3631
STAC_FASTAPI_DESCRIPTION: A STAC FastAPI with an Opensearch backend
3732
STAC_FASTAPI_VERSION: 6.0.0
3833
STAC_FASTAPI_LANDING_PAGE_ID: stac-fastapi-opensearch
3934
APP_HOST: 0.0.0.0
4035
APP_PORT: 8001
4136
RELOAD: true
4237
ENVIRONMENT: local
43-
WEB_CONCURRENCY: 10
4438
ES_HOST: database-os
4539
ES_PORT: 9200
4640
ES_USE_SSL: false
4741
ES_VERIFY_CERTS: false
4842
BACKEND: opensearch
4943
STAC_FASTAPI_RATE_LIMIT: 200/minute
44+
hostname: stac
5045
ports:
5146
- "8001:8001"
5247
depends_on:
5348
- database-os
54-
command:
49+
command: |
5550
bash -c "./scripts/wait-for-it-es.sh database-os:9200 && python -m stac_fastapi.opensearch.app"
5651
5752
database-pg:
58-
profiles: ["pg"]
53+
profiles: [""] # default profile
5954
container_name: database-pg
6055
image: ghcr.io/stac-utils/pgstac:v0.9.5
6156
environment:
@@ -88,13 +83,12 @@ services:
8883
- "9200:9200"
8984

9085
proxy:
91-
profiles: ["pg", "os"]
9286
depends_on:
9387
- oidc
9488
build:
9589
context: .
9690
environment:
97-
UPSTREAM_URL: ${UPSTREAM_URL:-http://stac-pg:8001}
91+
UPSTREAM_URL: ${UPSTREAM_URL:-http://stac:8001}
9892
OIDC_DISCOVERY_URL: ${OIDC_DISCOVERY_URL:-http://localhost:8888/.well-known/openid-configuration}
9993
OIDC_DISCOVERY_INTERNAL_URL: ${OIDC_DISCOVERY_INTERNAL_URL:-http://oidc:8888/.well-known/openid-configuration}
10094
env_file:
@@ -106,7 +100,6 @@ services:
106100
- ./src:/app/src
107101

108102
oidc:
109-
profiles: ["pg", "os"]
110103
image: ghcr.io/alukach/mock-oidc-server:latest
111104
environment:
112105
ISSUER: http://localhost:8888

0 commit comments

Comments
 (0)