A comprehensive web application featuring a Pong game with tournaments, user profiles, chat, and more. Built with Django, PostgreSQL, Redis, and Docker.
- Overview
- Implemented Modules
- Features
- Prerequisites
- Installation
- Usage
- Project Structure
- Monitoring
- Development
- Troubleshooting
Transcendence is a full-featured web application centered around the classic Pong game. It provides user authentication, profiles, real-time chat, matchmaking, tournaments, and more. The application is containerized using Docker for easy deployment and includes a comprehensive monitoring stack.
This project implements the following modules as part of the 42 curriculum requirements:
- Framework back (Major): Django framework for backend development
- Bootstrap (Minor): Frontend toolkit for responsive design
- DB (Minor): PostgreSQL database for data storage
- Standard User management (Major): Complete user registration, authentication, and profile management
- Remote auth 42 (Major): OAuth2 authentication with 42 intranet
- Remote Players (Major): Real-time multiplayer functionality
- Live chat (Major): Real-time chat system between users
- 2FA (Major): Two-Factor Authentication and JWT (JSON Web Tokens) for secure authentication
- Monitoring system (Minor): Prometheus and Grafana for system monitoring and visualization
- Browser compatibility (Minor): Support for multiple browsers including Firefox and Chrome
- Server-side (Major): Server-side Pong implementation with API
- User Authentication: OAuth integration with 42 API and Two-Factor Authentication
- User Profiles: Customizable user profiles with statistics
- Pong Game: Real-time multiplayer Pong game
- Matchmaking: Find opponents to play against
- Tournaments: Create and participate in Pong tournaments
- Real-time Chat: Chat with other users
- Notifications: Real-time notifications for game invites, tournament updates, etc.
- Admin Interface: Manage users, games, tournaments, etc.
- Monitoring: Comprehensive monitoring with Prometheus and Grafana
- Docker and Docker Compose
- Make
- Python 3.x (for local development)
- Clone the repository:
git clone <repository-url> cd Transcendence
- Start the application:
This will build and start all containers. The application will be available at http://localhost:8000. Notes: We will install Django as part of the build process, but its just to generate the env.
make up
-
Create the necessary secret files:
make secrets
You will be prompted to enter your 42 API client ID and secret, if you arent a 42 student, feel free to skip this.
-
Generate the environment file:
make env
This will create a
.envfile with all necessary configuration. -
(Optional) Update passwords:
make passwords
This allows you to set custom passwords for the admin user, database, and Grafana.
-
Start the application:
make up
-
Start in detached mode (no logs):
make detach
-
Stop the application:
make down
-
Restart the application:
make restart
- Web Application: http://localhost:8000
- Grafana: http://localhost:3000
- Username: admin
- Password: (set during installation, default: admin)
- Prometheus: http://localhost:9090
- MailHog (for email testing): http://localhost:8025
-
View logs:
make logs
-
Check status:
make status
- apps/: Django applications
- admin/: Admin interface customizations
- auth/: Authentication system
- chat/: Chat functionality
- client/: Client-side functionality
- core/: Core application functionality
- error/: Error handling
- game/: Game functionality
- index/: Main index/homepage
- notifications/: User notifications system
- player/: Player management
- profile/: User profiles
- tournaments/: Tournament system
- config/: Django project configuration
- docker/: Docker-related files
- media/: User-uploaded files
- static/: Static files (CSS, JS, images)
- templates/: HTML templates
- utils/: Utility functions
The application includes a comprehensive monitoring stack:
- Prometheus: Metrics collection and storage
- Grafana: Visualization and dashboards
- Node Exporter: System metrics
- PostgreSQL Exporter: Database metrics
- Alertmanager: Alerts based on metrics
Access Grafana at http://localhost:3000 to view dashboards and metrics.
make testmake test-coveragemake reloadIf you encounter database issues, you can clean the database volumes:
make dbcleanTo remove all containers, images, and volumes:
make cleanIf your environment file is missing or corrupted:
make envSSL certificates are automatically generated during the environment setup. If you need to regenerate them, delete the files in the secrets directory and run:
make env