Docker Compose orchestration for the complete Memora application stack - a streamlined setup for running the application with all its components.
π Live at: memora.tiberiusgh.com
The Memora application consists of three main components:
- Frontend: Web Components-based user interface
- Backend: Node.js API server with Firebase authentication
- Database: MongoDB for data persistence
- Nginx (Production): Reverse proxy and load balancer
- Docker and Docker Compose installed
- The following repositories cloned in the same parent directory:
parent-directory/ βββ orchestrator/ # This repository βββ memora_back_end/ # Backend repository βββ memora_front_end/ # Frontend repository
# Clone the orchestrator (this repository)
git clone https://github.com/Memora-Tiberiusgh/orchestrator
# Clone backend and frontend repositories in the same directory
git clone https://github.com/Memora-Tiberiusgh/memora_back_end
git clone https://github.com/Memora-Tiberiusgh/memora_front_end
cd orchestratorConfigure the backend environment variables:
# Edit the backend .env file with your Firebase and other configuration
# Follow the setup instructions in the backend README# Start the development stack
docker-compose -f docker-compose.dev.yml up --build
# Or run in detached mode
docker-compose -f docker-compose.dev.yml up -d --buildThe development environment provides:
- Hot reload for both frontend and backend
- Volume mounting for live code changes
- Development-optimized containers
- Direct port access for debugging
- MongoDB:
localhost:27017 - Backend API:
localhost:8186 - Frontend:
localhost:5173
- Automatic restart on code changes
- Development environment variables
- Node modules optimization with anonymous volumes
- Real-time synchronization with local file changes
# Development containers with volume mounting for hot reload
volumes:
- ../memora_back_end:/backend
- ../memora_front_end:/frontend
- /backend/node_modules # Anonymous volume for node_modules
- /frontend/node_modulesThe production environment provides:
- Optimized containers built for production
- Environment variable configuration via .env file
- Proper restart policies
- Network isolation
BACKEND_IMAGE=your-registry/memora-backend:latest
FRONTEND_IMAGE=your-registry/memora-frontend:latestBefore running the production compose, build and push your images:
# Build and tag backend image
cd ../memora_back_end
docker build -f Dockerfile -t your-registry/memora-backend:latest .
docker push your-registry/memora-backend:latest
# Build and tag frontend image
cd ../memora_front_end
docker build -f Dockerfile.prod -t your-registry/memora-frontend:latest .
docker push your-registry/memora-frontend:latestFor production deployments, nginx acts as a traffic director that routes requests appropriately:
- API requests (
/api/*) β Backend server (port 8186) - Static assets and app routes β Frontend server (port 5173)
Add this configuration to your nginx server:
server {
listen 80;
server_name your-domain.com; # Replace with your actual domain
# Route API requests to backend container
location /api/ {
proxy_pass http://localhost:8186;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Route all other requests to frontend container
location / {
proxy_pass http://localhost:5173;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Support for WebSocket connections (if needed for hot reload)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}Note: For production environments, you should configure SSL/HTTPS certificates. This involves setting up SSL certificates, configuring HTTPS listeners (port 443), and redirecting HTTP traffic to HTTPS. The specific SSL configuration will depend on your certificate provider and security requirements.
| Service | Development Port | Production Port | Purpose |
|---|---|---|---|
| MongoDB | 27017 | 27017 | Database storage |
| Backend | 8186 | 8186 | API server |
| Frontend | 5173 | 3000 | Web application |
# Start development environment
docker-compose -f docker-compose.dev.yml up
# Rebuild and start (after code changes to Dockerfiles)
docker-compose -f docker-compose.dev.yml up --build
# View logs
docker-compose -f docker-compose.dev.yml logs -f [service-name]
# Stop all services
docker-compose -f docker-compose.dev.yml down
# Stop and remove volumes (clean slate)
docker-compose -f docker-compose.dev.yml down -v# Start production environment
docker-compose -f docker-compose.prod.yml up -d
# Update production deployment
docker-compose -f docker-compose.prod.yml pull
docker-compose -f docker-compose.prod.yml up -d
# View production logs
docker-compose -f docker-compose.prod.yml logs -f
# Scale services (if needed)
docker-compose -f docker-compose.prod.yml up -d --scale backend=2# Execute commands in running containers
docker-compose exec backend npm run lint
docker-compose exec mongodb mongosh
# Access container shell
docker-compose exec backend sh
docker-compose exec frontend sh
# Monitor resource usage
docker statsUse the provided docker-compose files with nginx reverse proxy.
- Build images locally or in CI/CD
- Push to container registry
- Update .env with image references
- Deploy using docker-compose.prod.yml
- Fork the repository
- Create a feature branch
- Test with both development and production compose files
- Submit a pull request
This project is licensed under the MIT License.
For issues and feature requests, please visit our GitHub Discussions or contribute to the project at GitHub organization.
Tiberius Gherac - tiberius.gherac@gmail.com
First-year Web Development Student @ Linnaeus University
GitHub: @TiberiusGh
