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}"
|
index => "django-logs-%{+YYYY.MM.dd}"
|
||||||
}
|
}
|
||||||
stdout { codec => rubydebug }
|
stdout { codec => rubydebug }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name localhost;
|
server_name localhost ft-transcendence.com www.ft-transcendence.com;
|
||||||
|
|
||||||
# Redirect HTTP to HTTPS
|
# Redirect HTTP to HTTPS
|
||||||
location / {
|
location / {
|
||||||
return 301 https://localhost:1443$request_uri;
|
return 301 https://www.ft-transcendence.com:1443$request_uri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
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 /etc/nginx/ssl/certificate.crt;
|
||||||
ssl_certificate_key /etc/nginx/ssl/private.key;
|
ssl_certificate_key /etc/nginx/ssl/private.key;
|
||||||
|
|||||||
@ -19,6 +19,6 @@ extendedKeyUsage = serverAuth
|
|||||||
|
|
||||||
[alt_names]
|
[alt_names]
|
||||||
DNS.1 = localhost
|
DNS.1 = localhost
|
||||||
DNS.2 = www.ft_transcendence.com
|
DNS.2 = www.ft-transcendence.com
|
||||||
DNS.3 = ft_transcendence.com
|
DNS.3 = ft-transcendence.com
|
||||||
IP.1 = 127.0.0.1
|
IP.1 = 127.0.0.1
|
||||||
|
|||||||
@ -167,14 +167,12 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
pong_django_logs:
|
pong_django_logs:
|
||||||
|
external: true
|
||||||
|
name: shared_pong_django_logs
|
||||||
pong_es_data_01:
|
pong_es_data_01:
|
||||||
driver: local
|
|
||||||
pong_kibana:
|
pong_kibana:
|
||||||
driver: local
|
|
||||||
pong_logstash_data01:
|
pong_logstash_data01:
|
||||||
driver: local
|
|
||||||
certs:
|
certs:
|
||||||
driver: local
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
app-network:
|
app-network:
|
||||||
|
|||||||
@ -79,9 +79,8 @@ volumes:
|
|||||||
device: ${PROJECT_PATH}
|
device: ${PROJECT_PATH}
|
||||||
o: bind
|
o: bind
|
||||||
pong_django_logs:
|
pong_django_logs:
|
||||||
driver: local
|
name: shared_pong_django_logs
|
||||||
pong_pg_data:
|
pong_pg_data:
|
||||||
driver: local
|
|
||||||
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
19
makefile
19
makefile
@ -9,9 +9,7 @@ ELK_COMPOSE=docker compose -f $(ELK_COMPOSE_FILE) -p $(ELK_PROJECT_NAME)
|
|||||||
|
|
||||||
CONTAINER=$(c)
|
CONTAINER=$(c)
|
||||||
|
|
||||||
|
|
||||||
# Define a red color variable using ANSI escape code
|
# Define a red color variable using ANSI escape code
|
||||||
RED=\033[31m
|
|
||||||
GREEN=\033[32m
|
GREEN=\033[32m
|
||||||
NC=\033[0m # No Color (reset)
|
NC=\033[0m # No Color (reset)
|
||||||
|
|
||||||
@ -27,6 +25,7 @@ down:
|
|||||||
|
|
||||||
destroy:
|
destroy:
|
||||||
$(COMPOSE) down -v --rmi all
|
$(COMPOSE) down -v --rmi all
|
||||||
|
docker image prune -f
|
||||||
|
|
||||||
ssl-certs:
|
ssl-certs:
|
||||||
@if [ ! -f certs/ssl/private.key ] && [ ! -f certs/ssl/certificate.crt ]; then \
|
@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)"; \
|
echo "$(GREEN)SSL certificates already exist.$(NC)"; \
|
||||||
fi
|
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-up:
|
||||||
$(ELK_COMPOSE) up -d --remove-orphans || true
|
$(ELK_COMPOSE) up -d || true
|
||||||
|
|
||||||
elk-down:
|
elk-down:
|
||||||
$(ELK_COMPOSE) down --remove-orphans
|
$(ELK_COMPOSE) down
|
||||||
|
|
||||||
elk-destroy:
|
elk-destroy:
|
||||||
$(ELK_COMPOSE) down --remove-orphans -v --rmi all
|
$(ELK_COMPOSE) down -v --rmi all
|
||||||
|
docker image prune -f
|
||||||
|
|
||||||
kill-pid:
|
kill-pid:
|
||||||
sudo lsof -i :5432 | awk 'NR>1 {print $$2}' | xargs sudo kill -9 || true
|
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 stop [c=service] # Stop containers"
|
||||||
@echo " make logs [c=service] # Tail logs of containers"
|
@echo " make logs [c=service] # Tail logs of containers"
|
||||||
@echo " make ssl-certs # create ssl certificate"
|
@echo " make ssl-certs # create ssl certificate"
|
||||||
|
@echo " make edit-hosts # add host to /etc/hosts"
|
||||||
|
|
||||||
@echo " make help # Show this help"
|
@echo " make help # Show this help"
|
||||||
|
|
||||||
.PHONY: up build start stop down destroy logs ps db-shell 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('web3/', views.read_data, name='read_data'),
|
||||||
path('api/match_list/', match_list_json, name='match_list_json'),
|
path('api/match_list/', match_list_json, name='match_list_json'),
|
||||||
path('api/player_list/', player_list_json, name='player_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.contrib.auth import authenticate
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from rest_framework import viewsets
|
from rest_framework import viewsets
|
||||||
|
from django.http import HttpResponse
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
def trigger_error(request):
|
||||||
|
raise ValueError("This is a test error to generate a 500 response.")
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
return render(request, 'index.html')
|
return render(request, 'index.html')
|
||||||
|
|
||||||
@ -172,4 +176,4 @@ def write_data(request):
|
|||||||
# # Attente de la confirmation de la transaction
|
# # Attente de la confirmation de la transaction
|
||||||
# tx_receipt = web3.eth.wait_for_transaction_receipt(tx_hash)
|
# tx_receipt = web3.eth.wait_for_transaction_receipt(tx_hash)
|
||||||
# print("Transaction receipt:", tx_receipt)
|
# print("Transaction receipt:", tx_receipt)
|
||||||
print("-----------------------------")
|
print("-----------------------------")
|
||||||
|
|||||||
@ -22,8 +22,13 @@ SECRET_KEY = '12345678'
|
|||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
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
|
# 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 = {
|
LOGGING = {
|
||||||
'version': 1, # The version of the logging configuration schema
|
'version': 1, # The version of the logging configuration schema
|
||||||
'disable_existing_loggers': False, # Allows existing loggers to keep logging
|
'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
|
'django': { # The Django logger catches all messages sent by the Django framework
|
||||||
'handlers': ['file', 'console'], # Sends logs to both the file and the console
|
'handlers': ['file', 'console'], # Sends logs to both the file and the console
|
||||||
'level': 'DEBUG', # Minimum log level to be logged
|
'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