Deployment URL: https://cs3219-ay2526s1-g13.com/
This section provides instructions for running the application locally on your machine.
Before starting, ensure you have the following installed:
Start all required infrastructure services (MongoDB, Redis, RabbitMQ, Kafka, Piston API) using Docker Compose:
# Start all infrastructure services
docker-compose up -d mongodb redis rabbitmq zookeeper kafka piston-api
# Verify services are running
docker-compose psNote: The Piston API container needs language packages installed. After the services start, run the initialization script (see Step 2).
After starting the Docker services, install language packages for the Piston API:
Linux/Mac (Bash):
chmod +x init-piston-languages.sh
./init-piston-languages.shWindows (PowerShell):
powershell -ExecutionPolicy Bypass -File .\init-piston-languages.ps1Alternatively, if your PowerShell execution policy allows it:
.\init-piston-languages.ps1Note: Language installation happens asynchronously in the background. Some languages may take 10-30 minutes to install. The API will be functional even while languages are installing.
Each backend service should be started individually. Navigate to each service directory and start them:
# User Service (Port 8001)
cd backend/user-service
pnpm install
pnpm start
# Matching Service (Port 8002)
cd backend/matching-service
pnpm install
pnpm start
# Question Service (Port 8003)
cd backend/question-service
pnpm install
pnpm start
# Collaboration Service (Port 8004)
cd backend/collaboration-service
pnpm install
pnpm start
# Execution Service
cd backend/execution-service
pnpm install
pnpm start
# Video Call Service (Port 8011)
cd backend/video-call-service
pnpm install
pnpm startAlternative: You can also start all backend services using Docker Compose:
# Start all services including backend
docker-compose up -d# Install dependencies
pnpm install
# Start development server
pnpm dev
# Open http://localhost:3000 in your browserpnpm dev- Start frontend development serverpnpm build- Build frontend for productionpnpm lint- Run lintingpnpm format- Format code
When running locally, services are available at:
- Frontend: http://localhost:3000
- User Service: http://localhost:8001
- Matching Service: http://localhost:8002
- Question Service: http://localhost:8003
- Collaboration Service: http://localhost:8004
- Video Call Service: http://localhost:8011
- Piston API: http://localhost:2000
- RabbitMQ Management: http://localhost:15672 (user:
user, password:password)
This project uses MongoDB as the database, configured with Docker Compose for easy development setup.
# Start MongoDB container
docker-compose up -d mongodb
# View logs
docker-compose logs mongodb
# Stop MongoDB container
docker-compose down- Host:
localhost - Port:
27017 - Username:
admin - Password:
password - Database: You can create your own databases as needed
- Download and install MongoDB Compass
- Use connection string:
mongodb://admin:password@localhost:27017 - Click "Connect" to access your MongoDB instance
# Connect to MongoDB shell
docker exec -it mongodb mongosh -u admin -p password
# Or connect from host machine (if mongosh is installed locally)
mongosh mongodb://admin:password@localhost:27017const { MongoClient } = require('mongodb');
const uri = 'mongodb://admin:password@localhost:27017';
const client = new MongoClient(uri);
async function connect() {
try {
await client.connect();
console.log('Connected to MongoDB');
// Your database operations here
} finally {
await client.close();
}
}The mongo-init directory is mounted to /docker-entrypoint-initdb.d in the container. Any .js or .sh files placed in this directory will be executed when the MongoDB container starts for the first time.
To add initialization scripts:
- Create
.jsfiles in themongo-initdirectory - Restart the container:
docker-compose restart mongodb
# View container status
docker-compose ps
# Access MongoDB shell directly
docker exec -it mongodb mongosh -u admin -p password
# Backup database
docker exec mongodb mongodump --username admin --password password --out /data/backup
# Restore database
docker exec mongodb mongorestore --username admin --password password /data/backup- Frontend: Next.js application in
frontend/directory - Backend Services: Individual microservices in
backend/directory:user-service/- User authentication and managementmatching-service/- User matching for practice sessionsquestion-service/- Question managementcollaboration-service/- Real-time collaboration featuresexecution-service/- Code execution servicevideo-call-service/- Video call functionality
- Infrastructure: Docker Compose configuration and Terraform deployment scripts
- Terraform: Infrastructure as code for GCP deployment in
terraform/directory
- You are required to develop individual microservices within separate folders within this repository.
- The teaching team should be given access to the repositories as we may require viewing the history of the repository in case of any disputes or disagreements.
The execution service provides the following endpoints:
POST /v1/execution/submit # submit language, code -> submit_id
GET /v1/execution/submit/{submit_id} # get result -> submit_status = {pending | processing | done}, resultFor deployment instructions, please refer to the documentation in the terraform/ folder:
- General Deployment: See the README and configuration files in the
terraform/directory - Piston API Setup: See
terraform/PISTON_API_INSTALLATION_GUIDE.mdfor detailed instructions on setting up Piston API on Google Cloud Platform
The deployment uses Google Cloud Platform (GCP) with Terraform for infrastructure as code.