diff --git a/.gitignore b/.gitignore index 6a2bce2..07c8e00 100644 --- a/.gitignore +++ b/.gitignore @@ -160,4 +160,4 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ -.pgdata +.pgdata \ No newline at end of file diff --git a/README.md b/README.md index 0137743..f6c6dc5 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,21 @@ python -m stac_auth_proxy uvicorn --factory stac_auth_proxy:create_app ``` +### Docker compose + +Run all of the services required to run the application locally including the the database, STAC API, and Mock OICD provider using Docker compose. + +Spin up the application stack with the pgSTAC backend using [stac-fastapi-pgstac](https://github.com/stac-utils/stac-fastapi-pgstac): +```sh +UPSTREAM_URL=http://stac-pg:8001 docker compose --profile pg up +``` + +and with the OpenSearch backend using [stac-fastapi-elasticsearch-opensearch](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch): +```sh +UPSTREAM_URL=http://stac-os:8001 docker compose --profile os up +``` + + ### Installation For local development, we use [`uv`](https://docs.astral.sh/uv/) to manage project dependencies and environment. diff --git a/docker-compose.yaml b/docker-compose.yaml index 78c9d5e..98b169c 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,5 +1,6 @@ services: - stac: + stac-pg: + profiles: ["pg"] image: ghcr.io/stac-utils/stac-fastapi-pgstac:5.0.2 environment: APP_HOST: 0.0.0.0 @@ -9,8 +10,8 @@ services: POSTGRES_USER: username POSTGRES_PASS: password POSTGRES_DBNAME: postgis - POSTGRES_HOST_READER: database - POSTGRES_HOST_WRITER: database + POSTGRES_HOST_READER: database-pg + POSTGRES_HOST_WRITER: database-pg POSTGRES_PORT: 5432 WEB_CONCURRENCY: 10 VSI_CACHE: TRUE @@ -22,10 +23,40 @@ services: ports: - "8001:8001" depends_on: - - database - command: bash -c "./scripts/wait-for-it.sh database:5432 && python -m stac_fastapi.pgstac.app" + - database-pg + command: bash -c "./scripts/wait-for-it.sh database-pg:5432 && python -m stac_fastapi.pgstac.app" - database: + stac-os: + profiles: ["os"] + container_name: stac-fastapi-os + image: ghcr.io/stac-utils/stac-fastapi-os:v6.1.0 + hostname: stac-os + environment: + STAC_FASTAPI_TITLEL: stac-fastapi-opensearch + STAC_FASTAPI_DESCRIPTION: A STAC FastAPI with an Opensearch backend + STAC_FASTAPI_VERSION: 6.0.0 + STAC_FASTAPI_LANDING_PAGE_ID: stac-fastapi-opensearch + APP_HOST: 0.0.0.0 + APP_PORT: 8001 + RELOAD: true + ENVIRONMENT: local + WEB_CONCURRENCY: 10 + ES_HOST: database-os + ES_PORT: 9200 + ES_USE_SSL: false + ES_VERIFY_CERTS: false + BACKEND: opensearch + STAC_FASTAPI_RATE_LIMIT: 200/minute + ports: + - "8001:8001" + depends_on: + - database-os + command: + bash -c "./scripts/wait-for-it-es.sh database-os:9200 && python -m stac_fastapi.opensearch.app" + + database-pg: + profiles: ["pg"] + container_name: database-pg image: ghcr.io/stac-utils/pgstac:v0.9.5 environment: POSTGRES_USER: username @@ -40,13 +71,30 @@ services: volumes: - ./.pgdata:/var/lib/postgresql/data + database-os: + profiles: ["os"] + container_name: database-os + image: opensearchproject/opensearch:${OPENSEARCH_VERSION:-2.11.1} + hostname: database-os + environment: + cluster.name: stac-cluster + node.name: os01 + http.port: 9200 + http.cors.allow-headers: X-Requested-With,Content-Type,Content-Length,Accept,Authorization + discovery.type: single-node + plugins.security.disabled: true + OPENSEARCH_JAVA_OPTS: -Xms512m -Xmx512m + ports: + - "9200:9200" + proxy: + profiles: ["pg", "os"] depends_on: - - stac + - oidc build: context: . environment: - UPSTREAM_URL: ${UPSTREAM_URL:-http://stac:8001} + UPSTREAM_URL: ${UPSTREAM_URL:-http://stac-pg:8001} OIDC_DISCOVERY_URL: ${OIDC_DISCOVERY_URL:-http://localhost:8888/.well-known/openid-configuration} OIDC_DISCOVERY_INTERNAL_URL: ${OIDC_DISCOVERY_INTERNAL_URL:-http://oidc:8888/.well-known/openid-configuration} env_file: @@ -58,6 +106,7 @@ services: - ./src:/app/src oidc: + profiles: ["pg", "os"] image: ghcr.io/alukach/mock-oidc-server:latest environment: ISSUER: http://localhost:8888 @@ -65,7 +114,3 @@ services: PORT: 8888 ports: - "8888:8888" - -networks: - default: - name: eoapi-network