Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(compose): add mongodb-express, rename mongodb service #27

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
networks:
- tradewise-net

database:
mongodb:
image: mongo
environment:
- MONGO_INITDB_ROOT_USERNAME=tradewise_user
Expand All @@ -20,15 +20,15 @@ services:
- db-test:/data/db

database-api:
build: ./services/database-api
build: ./services/mongodb-api
environment:
- MONGO_INITDB_ROOT_USERNAME=tradewise_user
- MONGO_INITDB_ROOT_PASSWORD=xxxxxxxxxxxxxxxx
- MONGO_DATABASE=tradewise
networks:
- tradewise-net
depends_on:
- database
- mongodb

networks:
tradewise-net:
Expand Down
25 changes: 22 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ services:
interval: 10s
timeout: 6s
retries: 3
volumes:
- ./services/mops-crawler/src:/app # Bind mount for live development. Remove this for production.

report-harvester:
build: ./services/report-harvester
Expand All @@ -30,6 +32,8 @@ services:
condition: service_healthy
mops-crawler:
condition: service_healthy
volumes:
- ./services/report-harvester/src:/app # Bind mount for live development. Remove this for production.

fugle-market-data:
build: ./services/fugle-market-data
Expand Down Expand Up @@ -69,7 +73,7 @@ services:
networks:
- tradewise-net

database:
mongodb:
image: mongo
restart: always
env_file:
Expand All @@ -79,20 +83,35 @@ services:
volumes:
- db-data:/data/db

# mongo-express service is used for debugging purposes only.
# Please comment out or remove this service in production environments.
mongodb-express:
image: mongo-express:latest
env_file:
- ./config/.env
depends_on:
- mongodb
ports:
- "8081:8081"
networks:
- tradewise-net

database-api:
build: ./services/database-api
build: ./services/mongodb-api
restart: always
env_file:
- ./config/.env
networks:
- tradewise-net
depends_on:
- database
- mongodb
healthcheck:
test: ["CMD-SHELL", "python -c \"import http.client; conn = http.client.HTTPConnection('localhost', 80); conn.request('GET', '/health'); response = conn.getresponse(); assert response.status == 200\""]
interval: 10s
timeout: 6s
retries: 3
volumes:
- ./services/mongodb-api/src:/app # Bind mount for live development. Remove this for production.

networks:
tradewise-net:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ReportRequest(BaseModel):
MONGO_DB = os.getenv("MONGO_DATABASE")

# MongoDB connection
client = MongoClient(f"mongodb://{MONGO_USER}:{MONGO_PASSWORD}@database:27017/")
client = MongoClient(f"mongodb://{MONGO_USER}:{MONGO_PASSWORD}@mongodb:27017/")
db = client[MONGO_DB]

def get_version_table(ticker_symbol: str, report_type: str) -> Dict:
Expand Down
Loading