Skip to content

sora-grayscale/42_ft_transcendence

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ft_transcendence

日本語版はこちら

Overview

ft_transcendence is a web application project developed as the final assignment for 42. This project uses Django as the backend, with HTML, CSS, JavaScript, and Bootstrap for the frontend. It implements real-time Ping Pong game matches and real-time chat functionality using socket communication.

Additionally, Grafana and Prometheus are integrated using Docker, allowing for server state monitoring.

Key Features

  1. Ping Pong Game:

    • A game where players compete for points using two paddles and one ball
    • Remote play functionality
    • Tournament mode
  2. Real-time Chat:

    • Private chat between individuals
    • Real-time message sending and receiving
    • Ability to invite chat partners to a game using the :invite command
  3. Server Monitoring:

    • Server state visualization using Grafana and Prometheus

Setup Instructions

Prerequisites

  • An environment capable of running Docker

Installation

  1. Clone the repository:

    git clone https://github.com/yuki-shimoda-crypto/42_ft_transcendence.git
    cd ft_transcendence
  2. Copy the environment variable file:

    cp .env.example .env
  3. Start the Docker containers:

    sudo make up-d

This will start the following services in the background:

  • web-prod (for product deployment)
  • web-dev (development environment)
  • web-db (database)
  • grafana
  • prometheus

How to Access

  • Web application: https://localhost:8000
  • Grafana: http://localhost:3000
  • Prometheus: http://localhost:9090

Note: For detailed configuration and usage of Grafana and Prometheus, please refer to MONITOR_README.md.

Development Environment

To run the project in a development environment:

  1. Enter the development container:

    sudo make exec web-dev
  2. Generate an SSL certificate:

    CERT_PATH="./cert.pem"
    KEY_PATH="./key.pem"
    openssl req -x509 -newkey rsa:4096 -keyout "$KEY_PATH" -out "$CERT_PATH" -days 365 -nodes -subj "/CN=localhost"
  3. Start the development server:

    daphne --settings=PongChat.settings PongChat.asgi:application
  4. Access https://localhost:8001 to start development.

Note: If you make changes to files, please restart the server to reflect the changes.

Directory Structure

.
├── PongChat
│   ├── PongChat
│   ├── accounts
│   ├── chat
│   ├── locale
│   ├── media
│   ├── pingpong
│   ├── static
│   └── templates
├── data
├── docs
├── node_modules
├── sample_code
├── tests
└── tools
    └── docker
        ├── web_dev
        └── web_prod

Technologies Used

  • Backend: Django 5.0.4
  • Frontend: HTML, CSS, JavaScript, Bootstrap
  • Database: PostgreSQL
  • Real-time Communication: Django Channels
  • Containerization: Docker
  • Monitoring: Grafana, Prometheus

For other dependencies, please refer to requirements.txt.

Contributing

If you have any issues or suggestions, please create an Issue.

Contributers

License

This project is released under the MIT License.

Contact

Currently, there is no specific contact information. If you have any questions or concerns, please reach out through GitHub Issues.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 52.0%
  • JavaScript 27.2%
  • HTML 17.1%
  • Makefile 1.9%
  • CSS 1.2%
  • Dockerfile 0.4%
  • Shell 0.2%