Step 3: MongoDB and Redis integration complete
- Added MongoDB and Redis containers to docker-compose - Integrated Users service with MongoDB using Beanie ODM - Replaced in-memory storage with persistent MongoDB - Added proper data models with email validation - Verified data persistence with MongoDB ObjectIDs Services running: - MongoDB: Port 27017 (with health checks) - Redis: Port 6379 (with health checks) - Users service: Connected to MongoDB - Console: API Gateway routing working Test: Users now stored in MongoDB with persistence 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -28,13 +28,57 @@ services:
|
||||
environment:
|
||||
- ENV=development
|
||||
- PORT=8000
|
||||
- MONGODB_URL=mongodb://mongodb:27017
|
||||
- DB_NAME=users_db
|
||||
volumes:
|
||||
- ./services/users/backend:/app
|
||||
networks:
|
||||
- site11_network
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- mongodb
|
||||
|
||||
mongodb:
|
||||
image: mongo:7.0
|
||||
container_name: site11_mongodb
|
||||
environment:
|
||||
- MONGO_INITDB_DATABASE=site11_db
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- mongodb_data:/data/db
|
||||
- mongodb_config:/data/configdb
|
||||
networks:
|
||||
- site11_network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: site11_redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- site11_network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
networks:
|
||||
site11_network:
|
||||
driver: bridge
|
||||
name: site11_network
|
||||
name: site11_network
|
||||
|
||||
volumes:
|
||||
mongodb_data:
|
||||
mongodb_config:
|
||||
redis_data:
|
||||
Reference in New Issue
Block a user