mirror of
https://github.com/AudebertAdrien/ft_transcendence.git
synced 2025-12-15 21:56:50 +01:00
update de fou
This commit is contained in:
parent
9fe444c65d
commit
c9ca99605d
@ -25,4 +25,4 @@ output {
|
||||
index => "django-logs-%{+YYYY.MM.dd}"
|
||||
}
|
||||
stdout { codec => rubydebug }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
server_name localhost ft-transcendence.com www.ft-transcendence.com;
|
||||
|
||||
# Redirect HTTP to HTTPS
|
||||
location / {
|
||||
return 301 https://localhost:1443$request_uri;
|
||||
return 301 https://www.ft-transcendence.com:1443$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name localhost;
|
||||
server_name localhost ft-transcendence.com www.ft-transcendence.com;
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/certificate.crt;
|
||||
ssl_certificate_key /etc/nginx/ssl/private.key;
|
||||
|
||||
@ -19,6 +19,6 @@ extendedKeyUsage = serverAuth
|
||||
|
||||
[alt_names]
|
||||
DNS.1 = localhost
|
||||
DNS.2 = www.ft_transcendence.com
|
||||
DNS.3 = ft_transcendence.com
|
||||
DNS.2 = www.ft-transcendence.com
|
||||
DNS.3 = ft-transcendence.com
|
||||
IP.1 = 127.0.0.1
|
||||
|
||||
@ -167,14 +167,12 @@ services:
|
||||
|
||||
volumes:
|
||||
pong_django_logs:
|
||||
external: true
|
||||
name: shared_pong_django_logs
|
||||
pong_es_data_01:
|
||||
driver: local
|
||||
pong_kibana:
|
||||
driver: local
|
||||
pong_logstash_data01:
|
||||
driver: local
|
||||
certs:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
|
||||
@ -79,9 +79,8 @@ volumes:
|
||||
device: ${PROJECT_PATH}
|
||||
o: bind
|
||||
pong_django_logs:
|
||||
driver: local
|
||||
name: shared_pong_django_logs
|
||||
pong_pg_data:
|
||||
driver: local
|
||||
|
||||
|
||||
networks:
|
||||
|
||||
19
makefile
19
makefile
@ -9,9 +9,7 @@ ELK_COMPOSE=docker compose -f $(ELK_COMPOSE_FILE) -p $(ELK_PROJECT_NAME)
|
||||
|
||||
CONTAINER=$(c)
|
||||
|
||||
|
||||
# Define a red color variable using ANSI escape code
|
||||
RED=\033[31m
|
||||
GREEN=\033[32m
|
||||
NC=\033[0m # No Color (reset)
|
||||
|
||||
@ -27,6 +25,7 @@ down:
|
||||
|
||||
destroy:
|
||||
$(COMPOSE) down -v --rmi all
|
||||
docker image prune -f
|
||||
|
||||
ssl-certs:
|
||||
@if [ ! -f certs/ssl/private.key ] && [ ! -f certs/ssl/certificate.crt ]; then \
|
||||
@ -39,16 +38,22 @@ ssl-certs:
|
||||
echo "$(GREEN)SSL certificates already exist.$(NC)"; \
|
||||
fi
|
||||
|
||||
# Manage ELK stack
|
||||
edit-hosts:
|
||||
@echo "Checking and adding domains to /etc/hosts if they don't exist..."
|
||||
@sudo sh -c 'echo "" >> /etc/hosts'
|
||||
@sudo sh -c 'grep -q "127.0.0.1 www.ft-transcendence.com" /etc/hosts || echo "127.0.0.1 www.ft-transcendence.com" >> /etc/hosts'
|
||||
@sudo sh -c 'grep -q "127.0.0.1 ft-transcendence.com" /etc/hosts || echo "127.0.0.1 ft-transcendence.com" >> /etc/hosts'
|
||||
|
||||
# Manage ELK stack
|
||||
elk-up:
|
||||
$(ELK_COMPOSE) up -d --remove-orphans || true
|
||||
$(ELK_COMPOSE) up -d || true
|
||||
|
||||
elk-down:
|
||||
$(ELK_COMPOSE) down --remove-orphans
|
||||
$(ELK_COMPOSE) down
|
||||
|
||||
elk-destroy:
|
||||
$(ELK_COMPOSE) down --remove-orphans -v --rmi all
|
||||
$(ELK_COMPOSE) down -v --rmi all
|
||||
docker image prune -f
|
||||
|
||||
kill-pid:
|
||||
sudo lsof -i :5432 | awk 'NR>1 {print $$2}' | xargs sudo kill -9 || true
|
||||
@ -70,6 +75,8 @@ help:
|
||||
@echo " make stop [c=service] # Stop containers"
|
||||
@echo " make logs [c=service] # Tail logs of containers"
|
||||
@echo " make ssl-certs # create ssl certificate"
|
||||
@echo " make edit-hosts # add host to /etc/hosts"
|
||||
|
||||
@echo " make help # Show this help"
|
||||
|
||||
.PHONY: up build start stop down destroy logs ps db-shell help
|
||||
|
||||
@ -14,5 +14,6 @@ urlpatterns = [
|
||||
path('web3/', views.read_data, name='read_data'),
|
||||
path('api/match_list/', match_list_json, name='match_list_json'),
|
||||
path('api/player_list/', player_list_json, name='player_list_json'),
|
||||
path('api/tournoi_list/', tournoi_list_json, name='tournoi_list_json')
|
||||
path('api/tournoi_list/', tournoi_list_json, name='tournoi_list_json'),
|
||||
path('trigger-error/', views.trigger_error)
|
||||
]
|
||||
|
||||
@ -9,10 +9,14 @@ from django.contrib.auth.models import User
|
||||
from django.contrib.auth import authenticate
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from rest_framework import viewsets
|
||||
from django.http import HttpResponse
|
||||
|
||||
import json
|
||||
import uuid
|
||||
|
||||
def trigger_error(request):
|
||||
raise ValueError("This is a test error to generate a 500 response.")
|
||||
|
||||
def index(request):
|
||||
return render(request, 'index.html')
|
||||
|
||||
|
||||
@ -22,8 +22,13 @@ SECRET_KEY = '12345678'
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
ALLOWED_HOSTS = [
|
||||
'www.ft-transcendence.com',
|
||||
'ft-transcendence.com',
|
||||
'localhost',
|
||||
'127.0.0.1']
|
||||
|
||||
USE_X_FORWARDED_HOST = True
|
||||
|
||||
# Application definition
|
||||
|
||||
@ -137,32 +142,6 @@ CHANNEL_LAYERS = {
|
||||
},
|
||||
}
|
||||
|
||||
LOGGING = {
|
||||
'version': 1, # Django requires this key
|
||||
'disable_existing_loggers': False, # Keep Django's default loggers
|
||||
'formatters': {
|
||||
'simple': {
|
||||
'format': '{levelname} {message}',
|
||||
'style': '{', # Allows to use Python's new style string formatting
|
||||
},
|
||||
},
|
||||
'handlers': {
|
||||
'console': { # Log to the console
|
||||
'level': 'DEBUG', # Minimum level of messages that should be handled
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'simple', # Use the simple formatter defined above
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'django': { # The main logger for Django itself
|
||||
'handlers': ['console'],
|
||||
'level': 'DEBUG', # Minimum log level to be logged
|
||||
'propagate': False, # Prevents log propagation to other loggers
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
"""
|
||||
LOGGING = {
|
||||
'version': 1, # The version of the logging configuration schema
|
||||
'disable_existing_loggers': False, # Allows existing loggers to keep logging
|
||||
@ -193,8 +172,7 @@ LOGGING = {
|
||||
'django': { # The Django logger catches all messages sent by the Django framework
|
||||
'handlers': ['file', 'console'], # Sends logs to both the file and the console
|
||||
'level': 'DEBUG', # Minimum log level to be logged
|
||||
'propagate': True, # If True, messages will be passed to the parent loggers as well
|
||||
'propagate': False, # If True, messages will be passed to the parent loggers as well
|
||||
},
|
||||
},
|
||||
}
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user