Skip to content

Commit 689a31f

Browse files
authored
Merge pull request #6 from Healy-Hyperspatial/add-mongodb
Add mongodb
2 parents 26fd4ab + 7f1c6f8 commit 689a31f

9 files changed

+96
-22
lines changed

.github/workflows/cicd.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: stac-fastapi-mongo
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
- features/**
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 10
16+
17+
strategy:
18+
matrix:
19+
python-version: [ "3.8", "3.9", "3.10", "3.11"]
20+
21+
name: Python ${{ matrix.python-version }} testing
22+
23+
steps:
24+
- name: Check out repository code
25+
uses: actions/checkout@v4
26+
27+
# Setup Python (faster than using Python container)
28+
- name: Setup Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
- name: Lint code
33+
uses: pre-commit/[email protected]

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010

1111
### Added
1212

13+
- Added mongodb docker files for local testing [#6](https://github.com/Healy-Hyperspatial/stac-api-load-balancing/pull/6)
14+
1315
### Changed
1416

1517
### Fixed

Makefile

-16
This file was deleted.

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Taurus and Locust load balancing tools for testing stac-api backends.
44
![Alt text](readme_files/taurus-pgstac.png?raw=true "stac-fastapi-pgstac")
55

66

7-
## Run stac-fastapi backends locally (elasticsearch|opensearch|pgstac)
8-
```$ docker-compose up pgstac```
9-
```$ docker-compose up app-pgstac```
7+
## Run stac-fastapi backends locally (elasticsearch|opensearch|pgstac|mongo)
8+
```$ docker-compose up elasticsearch```
9+
```$ docker-compose up app-elasticsearch```
1010

1111
## Install locally for development
1212
```$ pip install -e .```
File renamed without changes.

backends/Dockerfile.mongo

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM python:3.10-slim
2+
3+
4+
# update apt pkgs, and install build-essential for ciso8601
5+
RUN apt-get update && \
6+
apt-get -y upgrade && \
7+
apt-get install -y build-essential && \
8+
apt-get clean && \
9+
rm -rf /var/lib/apt/lists/*
10+
11+
# update certs used by Requests
12+
ENV CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
13+
14+
WORKDIR /app
15+
16+
COPY . /app
17+
18+
RUN pip install stac-fastapi.mongo==3.0.0
File renamed without changes.
File renamed without changes.

docker-compose.yml

+40-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ services:
1717
restart: always
1818
build:
1919
context: .
20-
dockerfile: backends/Dockerfile-pgstac
20+
dockerfile: backends/Dockerfile.pgstac
2121
environment:
2222
- APP_HOST=0.0.0.0
2323
- APP_PORT=8082
@@ -65,7 +65,7 @@ services:
6565
restart: always
6666
build:
6767
context: .
68-
dockerfile: backends/Dockerfile-elasticsearch
68+
dockerfile: backends/Dockerfile.elasticsearch
6969
platform: linux/amd64
7070
environment:
7171
- APP_HOST=0.0.0.0
@@ -105,7 +105,7 @@ services:
105105
restart: always
106106
build:
107107
context: .
108-
dockerfile: backends/Dockerfile-opensearch
108+
dockerfile: backends/Dockerfile.opensearch
109109
environment:
110110
- APP_HOST=0.0.0.0
111111
- APP_PORT=8082
@@ -139,3 +139,40 @@ services:
139139
- ./opensearch/snapshots:/usr/share/opensearch/snapshots
140140
ports:
141141
- "9202:9202"
142+
143+
app-mongo:
144+
container_name: stac-fastapi-mongo
145+
image: stac-utils/stac-fastapi-mongo
146+
restart: always
147+
build:
148+
context: .
149+
dockerfile: dockerfiles/Dockerfile.dev.mongo
150+
environment:
151+
- APP_HOST=0.0.0.0
152+
- APP_PORT=8084
153+
- RELOAD=true
154+
- ENVIRONMENT=local
155+
- BACKEND=mongo
156+
- MONGO_DB=stac
157+
- MONGO_HOST=mongo
158+
- MONGO_USER=root
159+
- MONGO_PASS=example
160+
- MONGO_PORT=27017
161+
ports:
162+
- "8086:8084"
163+
volumes:
164+
- ./scripts:/app/scripts
165+
depends_on:
166+
- mongo
167+
command:
168+
bash -c "./scripts/wait-for-it-es.sh mongo-container:27017 && python -m stac_fastapi.mongo.app"
169+
170+
mongo:
171+
container_name: mongo-container
172+
image: mongo:7.0.5
173+
hostname: mongo
174+
environment:
175+
- MONGO_INITDB_ROOT_USERNAME=root
176+
- MONGO_INITDB_ROOT_PASSWORD=example
177+
ports:
178+
- "27017:27017"

0 commit comments

Comments
 (0)