Developing a web game Pong from scratch including the following features:
- Had basic user management systems for users to register, 2FA validate id, customize user settings.
- Utilised Websocket to allow users to do live chat with other users and play games remotely.
- Supported different game modes like remote PVP, local PVP, single player vs computer(AI).
- Adopted Single page Access (SPA) for better UX in the frontend.
- Implemented WAF firewall ahead of Nginx to prevent malicious requests. Used Vault to store sensitive credentials like admin user keys.
- Pre-scripted ELK stack deployment in a isolated docker environment, including necessary TLS, SSL settings and logs lifetime management policies.
- Added automated unit tests at launch time to check key feature healthiness.
- Clone the repo to your local machine
git clone <repository-url>
cd ft_Transcendence
- Setup necessary credentials and launch
-
- generate CA and certificates for ELK stack
make certs
# It will generate CA and SSL signed by CA in pong-game/monitoring/elk/certs
-
- generate .env credentials
make env
# It will create .env file based on .env.example file, or you can manually create yourself
-
- docker command to launch all services
docker compose up --build # Added -d flag if you want to have all logs in the background
You can also simply use makefile cmd to build run and check automatically
make # It will do step 1 to 3 and then do unit tests in the end
- Other usefull make commands
- To build and run the program without checking
make go
- To stop and remvoe services and credentials
make clean # It will delete the .env
- To rebuild and check
make re
- To go inside a specific container using bash
make in ${service_name} # equals to do "docker exec -it ${service_name} bash"
- To simply run checks again
make check # In case you only change files that is run by cgi, you don't need to rebuild
- To deeply clean all the cached images in local host
make kill # It will kill every cached images even in ~/.docker/buildx
- Frontend (Nginx + WFA + SPA): https://localhost:8443
- Security (Vault UI): https://localhost:8200
- ELK Stack (Kibana UI): https://localhost:5601
- Prometheus: https://localhost:9090
- Grafana: https://localhost:3000
- Backend (django and its services): 8004 (api), 8001 (ws)
- Postgres DB: 5434
- redis: 6379
- Elasticsearch: 9200
- Logstash: 5044
- Prometheus: 9090
- Grafana: 3001
- node-exporter: 9100
- Work in
backend/
directory - Access service at http://localhost:8004 for API request and 8001 for WS
- Work in
frontend/
directory - Access development server at https://localhost:8443
- Work in
monitoring/
directory - Configure Prometheus in
monitoring/prometheus/
- Set up Grafana dashboards in
monitoring/grafana/
- Configure ELK stack in
monitoring/elk/
- Work in
security/
directory
- Put all the unit test scripts in
tests/
directory
-
To clear everything in docker
docker stop $(docker ps -qa); docker rm $(docker ps -qa); docker rmi -f $(docker images -qa); docker volume rm $(docker volume ls -q); docker network rm $(docker network ls -q) 2>/dev/null
-
To test XXS and see WAF audit log, do
curl -k "https://localhost:8443/test-waf?input=<script>alert(1)</script>"