Orchestrates the Library Booking System backend locally: infrastructure, microservices, API gateway, and realtime gateway.
This docker-compose file sets up the entire library booking system with all microservices.
- Docker
- Docker Compose
- postgres: PostgreSQL database (port 5433)
- redis: Redis cache (port 6379)
- rabbitmq: RabbitMQ message broker (ports 5672, 15672 for management UI)
- user-service: User management (port 3001, gRPC 50051)
- auth-service: Authentication service (port 3002)
- catalog-service: Resource catalog service (port 3003)
- booking-service: Booking management (port 3004)
- policy-service: Policy enforcement (port 3005)
- notification-service: Notifications (port 3006)
- analytics-service: Analytics and reporting (port 3007)
- api-gateway: Nginx reverse proxy (port 8080)
- Routes all API requests to appropriate services
- Handles CORS
- Provides WebSocket support for realtime gateway
- Authorization header validation
From the docker-compose directory:
powershell -ExecutionPolicy Bypass -File setup-complete.ps1This script will:
- ✅ Check if Docker is running
- ✅ Rebuild all services (clean build with
--no-cache) - ✅ Start all services
- ✅ Wait for services to be ready
- ✅ Verify API Gateway is accessible
- ✅ Initialize dummy data automatically
Note: This takes several minutes but ensures a clean, complete setup.
From the docker-compose directory:
PowerShell (Recommended):
powershell -ExecutionPolicy Bypass -File build-and-start.ps1Or manually with BuildKit enabled:
$env:DOCKER_BUILDKIT = 1
docker compose up -d --buildNote: The Dockerfiles use BuildKit features (cache mounts), so BuildKit must be enabled. If you encounter "frontend grpc server closed unexpectedly" errors, ensure BuildKit is enabled by setting DOCKER_BUILDKIT=1.
This will:
- Start all infrastructure services (postgres, redis, rabbitmq)
- Build and start all microservices
- Start the nginx API gateway
Then initialize dummy data (see "Initializing Dummy Data" section below).
After services are running, initialize dummy data:
Recommended (automated):
powershell -ExecutionPolicy Bypass -File init-dummy-data-all.ps1Manual (per database):
# Resources (catalog_db)
docker cp init-dummy-data-catalog.sql library-postgres:/tmp/init-dummy-data-catalog.sql
docker exec -i library-postgres psql -U postgres -d catalog_db -f /tmp/init-dummy-data-catalog.sql
# Policies (policy_db)
docker cp init-dummy-data-policy.sql library-postgres:/tmp/init-dummy-data-policy.sql
docker exec -i library-postgres psql -U postgres -d policy_db -f /tmp/init-dummy-data-policy.sql
# Admin User (user_db - via API)
powershell -ExecutionPolicy Bypass -File setup-admin-user.ps1Files:
init-dummy-data.sql- Merged file containing all dummy data sections (catalog, policy, user)init-dummy-data-catalog.sql- Section 1 extract for catalog_db (convenience file)init-dummy-data-policy.sql- Section 2 extract for policy_db (convenience file)setup-admin-user.ps1- Unified admin user script (replaces multiple admin scripts)init-dummy-data-all.ps1- Automated script to run all initialization steps
Admin User Script Usage:
# Full setup (create new or recreate existing)
powershell -ExecutionPolicy Bypass -File setup-admin-user.ps1
# Only approve existing user
powershell -ExecutionPolicy Bypass -File setup-admin-user.ps1 -ApproveOnly
# Force recreate (delete and create new)
powershell -ExecutionPolicy Bypass -File setup-admin-user.ps1 -Recreate- API Gateway: http://localhost:8080
- RabbitMQ Management: http://localhost:15672 (admin/admin)
- PostgreSQL: localhost:5433 (postgres/postgres)
All API calls should go through the gateway at http://localhost:8080:
POST /api/auth/register- Register new userPOST /api/auth/login- LoginGET /api/resources- List resources (requires auth)POST /api/bookings- Create booking (requires auth)GET /api/bookings- List bookings (requires auth)WS /ws/availability- WebSocket for realtime updates (when realtime-gateway is available)
docker compose downTo also remove volumes (clears all data):
docker compose down -vView logs for all services:
docker compose logs -fView logs for a specific service:
docker compose logs -f api-gateway
docker compose logs -f booking-serviceAfter code changes, rebuild and restart:
PowerShell:
$env:DOCKER_BUILDKIT = 1
docker compose up -d --buildOr use the helper script:
powershell -ExecutionPolicy Bypass -File build-and-start.ps1Check if services are running:
curl http://localhost:8080/health
curl http://localhost:8080/api/auth/health
curl http://localhost:8080/api/resources/health- The realtime-gateway service is commented out as it needs to be created separately
- All services use Docker service names for internal communication
- The API gateway (nginx) routes requests to services using service names
- Database connections use internal Docker network (port 5432, not 5433)