Skip to content

Commit ac96921

Browse files
Merge pull request #1 from AtomicMaps/opensearch
Add opensearch backend
2 parents d3d3769 + 88c16a6 commit ac96921

File tree

3 files changed

+73
-13
lines changed

3 files changed

+73
-13
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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ python -m stac_auth_proxy
4646
uvicorn --factory stac_auth_proxy:create_app
4747
```
4848

49+
### Docker compose
50+
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.
52+
53+
Spin up the application stack with the pgSTAC backend using [stac-fastapi-pgstac](https://github.com/stac-utils/stac-fastapi-pgstac):
54+
```sh
55+
UPSTREAM_URL=http://stac-pg:8001 docker compose --profile pg up
56+
```
57+
58+
and with the OpenSearch backend using [stac-fastapi-elasticsearch-opensearch](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch):
59+
```sh
60+
UPSTREAM_URL=http://stac-os:8001 docker compose --profile os up
61+
```
62+
63+
4964
### Installation
5065

5166
For local development, we use [`uv`](https://docs.astral.sh/uv/) to manage project dependencies and environment.

docker-compose.yaml

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
services:
2-
stac:
2+
stac-pg:
3+
profiles: ["pg"]
34
image: ghcr.io/stac-utils/stac-fastapi-pgstac:5.0.2
45
environment:
56
APP_HOST: 0.0.0.0
@@ -9,8 +10,8 @@ services:
910
POSTGRES_USER: username
1011
POSTGRES_PASS: password
1112
POSTGRES_DBNAME: postgis
12-
POSTGRES_HOST_READER: database
13-
POSTGRES_HOST_WRITER: database
13+
POSTGRES_HOST_READER: database-pg
14+
POSTGRES_HOST_WRITER: database-pg
1415
POSTGRES_PORT: 5432
1516
WEB_CONCURRENCY: 10
1617
VSI_CACHE: TRUE
@@ -22,10 +23,40 @@ services:
2223
ports:
2324
- "8001:8001"
2425
depends_on:
25-
- database
26-
command: bash -c "./scripts/wait-for-it.sh database:5432 && python -m stac_fastapi.pgstac.app"
26+
- database-pg
27+
command: bash -c "./scripts/wait-for-it.sh database-pg:5432 && python -m stac_fastapi.pgstac.app"
2728

28-
database:
29+
stac-os:
30+
profiles: ["os"]
31+
container_name: stac-fastapi-os
32+
image: ghcr.io/stac-utils/stac-fastapi-os:v6.1.0
33+
hostname: stac-os
34+
environment:
35+
STAC_FASTAPI_TITLEL: stac-fastapi-opensearch
36+
STAC_FASTAPI_DESCRIPTION: A STAC FastAPI with an Opensearch backend
37+
STAC_FASTAPI_VERSION: 6.0.0
38+
STAC_FASTAPI_LANDING_PAGE_ID: stac-fastapi-opensearch
39+
APP_HOST: 0.0.0.0
40+
APP_PORT: 8001
41+
RELOAD: true
42+
ENVIRONMENT: local
43+
WEB_CONCURRENCY: 10
44+
ES_HOST: database-os
45+
ES_PORT: 9200
46+
ES_USE_SSL: false
47+
ES_VERIFY_CERTS: false
48+
BACKEND: opensearch
49+
STAC_FASTAPI_RATE_LIMIT: 200/minute
50+
ports:
51+
- "8001:8001"
52+
depends_on:
53+
- database-os
54+
command:
55+
bash -c "./scripts/wait-for-it-es.sh database-os:9200 && python -m stac_fastapi.opensearch.app"
56+
57+
database-pg:
58+
profiles: ["pg"]
59+
container_name: database-pg
2960
image: ghcr.io/stac-utils/pgstac:v0.9.5
3061
environment:
3162
POSTGRES_USER: username
@@ -40,13 +71,30 @@ services:
4071
volumes:
4172
- ./.pgdata:/var/lib/postgresql/data
4273

74+
database-os:
75+
profiles: ["os"]
76+
container_name: database-os
77+
image: opensearchproject/opensearch:${OPENSEARCH_VERSION:-2.11.1}
78+
hostname: database-os
79+
environment:
80+
cluster.name: stac-cluster
81+
node.name: os01
82+
http.port: 9200
83+
http.cors.allow-headers: X-Requested-With,Content-Type,Content-Length,Accept,Authorization
84+
discovery.type: single-node
85+
plugins.security.disabled: true
86+
OPENSEARCH_JAVA_OPTS: -Xms512m -Xmx512m
87+
ports:
88+
- "9200:9200"
89+
4390
proxy:
91+
profiles: ["pg", "os"]
4492
depends_on:
45-
- stac
93+
- oidc
4694
build:
4795
context: .
4896
environment:
49-
UPSTREAM_URL: ${UPSTREAM_URL:-http://stac:8001}
97+
UPSTREAM_URL: ${UPSTREAM_URL:-http://stac-pg:8001}
5098
OIDC_DISCOVERY_URL: ${OIDC_DISCOVERY_URL:-http://localhost:8888/.well-known/openid-configuration}
5199
OIDC_DISCOVERY_INTERNAL_URL: ${OIDC_DISCOVERY_INTERNAL_URL:-http://oidc:8888/.well-known/openid-configuration}
52100
env_file:
@@ -58,14 +106,11 @@ services:
58106
- ./src:/app/src
59107

60108
oidc:
109+
profiles: ["pg", "os"]
61110
image: ghcr.io/alukach/mock-oidc-server:latest
62111
environment:
63112
ISSUER: http://localhost:8888
64113
SCOPES: item:create,item:update,item:delete,collection:create,collection:update,collection:delete
65114
PORT: 8888
66115
ports:
67116
- "8888:8888"
68-
69-
networks:
70-
default:
71-
name: eoapi-network

0 commit comments

Comments
 (0)