This folder contains the Docker Compose configuration for the EduNex platform's backend services.
The infrastructure includes:
- PostgreSQL Databases - For subscription and course service data
- Subscription Service - Handles billing and subscription management
- Course Service - Manages course content and AWS S3 integration
- API Gateway - Routes requests and handles authentication
- Docker and Docker Compose installed
- Stripe API keys (for payment processing)
- AWS credentials (for S3 and CloudFront)
- Access to deployed Auth Service and Keycloak IAM
The services connect to already deployed external services:
- Auth Service:
https://auth-api.edunex.app - Keycloak IAM:
https://keycloak-auth.edunex.app
This setup uses environment variables to keep secrets secure and out of version control.
Copy the example environment file and configure it with your actual values:
cp .env.example .envEdit the .env file and replace placeholder values with your actual credentials:
- Get your Stripe credentials from Stripe Dashboard
- Navigate to Developers → API keys for
STRIPE_API_KEY - Navigate to Developers → Webhooks for
STRIPE_WEBHOOK_SECRET
- Get your AWS credentials from AWS Console
- Ensure your credentials have access to your S3 bucket
- Configure your CloudFront distribution domain
- Set secure passwords for your PostgreSQL databases
- These will be used for local development only
- ✅
.env.example- Template file (SAFE to commit) - ❌
.env- Actual secrets (NEVER commit this file)
The .env file is automatically ignored by git to prevent accidental commits of sensitive data.
After configuring your .env file (see Environment Configuration above), verify your setup:
# Check that your .env file exists and has the required variables
cat .envRun the following command from the infrastructure directory:
docker-compose up -dThis will:
- Start PostgreSQL databases with initialization scripts
- Build and start the subscription service
- Build and start the course service
- Build and start the API gateway
Check if all services are running:
docker-compose psCheck service health:
# Subscription Service
curl http://localhost:8083/actuator/health
# API Gateway
curl http://localhost:8090/actuator/health- API Gateway:
http://localhost:8090 - Subscription Service:
http://localhost:8083 - Course Service:
http://localhost:8082 - Subscription Database:
localhost:5435 - Course Database:
localhost:5433
- Host: localhost
- Port: 5435 (configurable via
SUBSCRIPTION_DB_PORT) - Database: subscription_db (configurable via
POSTGRES_DB_SUBSCRIPTION) - Username: subscription_user (configurable via
POSTGRES_USER_SUBSCRIPTION) - Password: Set in your
.envfile
- Host: localhost
- Port: 5433 (configurable via
COURSE_DB_PORT) - Database: course_db (configurable via
POSTGRES_DB_COURSE) - Username: postgress (configurable via
POSTGRES_USER_COURSE) - Password: Set in your
.envfile
-
Service fails to start: Check Docker logs
docker-compose logs [service-name]
-
Database connection issues: Ensure PostgreSQL is healthy
docker-compose logs subscription-db
-
Stripe configuration errors: Verify your API keys are correct and have proper permissions
# View logs for all services
docker-compose logs -f
# View logs for specific service
docker-compose logs -f subscription-service
# Restart a specific service
docker-compose restart subscription-service
# Stop all services
docker-compose down
# Stop and remove volumes (caution: this will delete database data)
docker-compose down -vAll services run on the edunex-platform-network bridge network, allowing internal communication between containers.
- subscription_db_data: Persists PostgreSQL data
- Database initialization: Uses
./db/subscriptions_init.sqlfor initial schema setup
- Never commit actual Stripe API keys to version control
- Use environment variables or secure secrets management in production
- The current configuration is suitable for development/testing environments
For production deployment:
- Use production Stripe keys instead of test keys
- Configure proper SSL/TLS certificates
- Set up proper logging and monitoring
- Use secrets management for sensitive credentials
- Configure proper backup strategies for the database