Merge branch 'main' into theouche

This commit is contained in:
Theouche 2024-09-11 15:09:04 +02:00
commit 07b05299c7
7 changed files with 9 additions and 125 deletions

32
.env
View File

@ -1,32 +0,0 @@
# Django settings
SECRET_KEY="FollowTheWhiteRabbit"
DEBUG=True
DJANGO_ALLOWED_HOSTS=['*']
# PostgreSQL settings
POSTGRES_DB=players_db
POSTGRES_USER=42student
POSTGRES_PASSWORD=qwerty
# Django settings
DB_HOST=db
DB_PORT=5432
PWD_PATH=${PWD}
PROJECT_PATH=${PWD_PATH}/pong
DJANGO_LOGS=${PWD_PATH}/logs
# ElasticSearch settings
STACK_VERSION=8.14.3
CLUSTER_NAME=docker-cluster
LICENSE=basic
ELASTIC_USERNAME=elastic
ELASTIC_PASSWORD=elastic_pass
# Kibana settings
KIBANA_PORT=5601
KIBANA_USERNAME=kibana_system
KIBANA_PASSWORD=kibana_pass
ENCRYPTION_KEY=c34d38b3a14956121ff2170e5030b471551370178f43e5626eec58b04a30fae2

View File

@ -219,10 +219,6 @@ volumes:
o: bind
pong_django_logs:
driver: local
driver_opts:
type: none
device: ${DJANGO_LOGS}
o: bind
pong_pg_data:
driver: local
pong_es_data_01:

View File

@ -1,75 +0,0 @@
services:
backend:
build:
context: .
dockerfile: Dockerfile
image: backend
container_name: backend
restart: always
command: /bin/sh -c "sleep 5 &&
venv/bin/python manage.py makemigrations --noinput &&
venv/bin/python manage.py migrate --noinput &&
venv/bin/python manage.py collectstatic --noinput &&
venv/bin/daphne -b 0.0.0.0 -p 8080 pong.asgi:application"
volumes:
- pong:/transcendence/pong
- pong_django_logs:/transcendence/logs
ports:
- 8080:8080
networks:
- app-network
environment:
DB_HOST: db
DB_PORT: 5432
DB_NAME: ${POSTGRES_DB}
DB_USER: ${POSTGRES_USER}
DB_PASSWORD: ${POSTGRES_PASSWORD}
depends_on:
- db
healthcheck:
test: ["CMD-SHELL", "curl", "http://localhost:8080"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
db:
image: postgres:latest
container_name: postgres
restart: always
volumes:
- pong_pg_data:/var/lib/postgresql/data
ports:
- "5432:5432"
networks:
- app-network
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
volumes:
pong:
driver: local
driver_opts:
type: none
device: ${PROJECT_PATH}
o: bind
pong_django_logs:
driver: local
driver_opts:
type: none
device: ${DJANGO_LOGS}
o: bind
pong_pg_data:
driver: local
networks:
app-network:
name: app-network
driver: bridge

View File

@ -24,7 +24,7 @@ ELASTIC_PASSWORD=
# Kibana settings
KIBANA_PORT=5601
KIBANA_USERNAME=
KIBANA_USERNAME=kibana_system
KIBANA_PASSWORD=
ENCRYPTION_KEY=c34d38b3a14956121ff2170e5030b471551370178f43e5626eec58b04a30fae2

View File

@ -1,10 +0,0 @@
{"message": "Not Found: /favicon.ico", "taskName": null, "status_code": 404, "request": "<ASGIRequest: GET '/favicon.ico'>"}
{"message": "Not Found: /favicon.ico", "taskName": null, "status_code": 404, "request": "<ASGIRequest: GET '/favicon.ico'>"}
{"message": "Not Found: /favicon.ico", "taskName": null, "status_code": 404, "request": "<ASGIRequest: GET '/favicon.ico'>"}
{"message": "Not Found: /favicon.ico", "taskName": null, "status_code": 404, "request": "<ASGIRequest: GET '/favicon.ico'>"}
{"message": "Not Found: /favicon.ico", "taskName": null, "status_code": 404, "request": "<ASGIRequest: GET '/favicon.ico'>"}
{"message": "Not Found: /favicon.ico", "taskName": null, "status_code": 404, "request": "<ASGIRequest: GET '/favicon.ico'>"}
{"message": "Not Found: /favicon.ico", "taskName": null, "status_code": 404, "request": "<ASGIRequest: GET '/favicon.ico'>"}
{"message": "Not Found: /favicon.ico", "taskName": null, "status_code": 404, "request": "<ASGIRequest: GET '/favicon.ico'>"}
{"message": "Not Found: /favicon.ico", "taskName": null, "status_code": 404, "request": "<ASGIRequest: GET '/favicon.ico'>"}
{"message": "Not Found: /favicon.ico", "taskName": null, "status_code": 404, "request": "<ASGIRequest: GET '/favicon.ico'>"}

View File

@ -4,7 +4,7 @@ CONTAINER=$(c)
up: down
$(COMPOSE) build
$(COMPOSE) up --remove-orphans $(CONTAINER)
$(COMPOSE) up -d $(CONTAINER) || true
build:
$(COMPOSE) build $(CONTAINER)
@ -20,8 +20,13 @@ down:
destroy:
$(COMPOSE) down -v --rmi all
kill-pid:
sudo lsof -i :5432 | awk 'NR>1 {print $$2}' | xargs sudo kill -9 || true
sudo lsof -i :80 | awk 'NR>1 {print $$2}' | xargs sudo kill -9 || true
sudo lsof -i :5601 | awk 'NR>1 {print $$2}' | xargs sudo kill -9 || true
sudo lsof -i :9200 | awk 'NR>1 {print $$2}' | xargs sudo kill -9 || true
sudo lsof -i :8080 | awk 'NR>1 {print $$2}' | xargs sudo kill -9 || true
sudo lsof -i :5044 | awk 'NR>1 {print $$2}' | xargs sudo kill -9 || true
logs:
$(COMPOSE) logs -f $(CONTAINER)