init
Some checks failed
CI/CD / Backend & Frontend Checks (push) Has been cancelled
CI/CD / Deploy to Production (push) Has been cancelled

This commit is contained in:
2026-05-18 11:34:07 +03:30
commit 7a8ddeabed
279 changed files with 37390 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail
: "${DJANGO_WSGI_MODULE:=config.wsgi:application}"
: "${DATABASE_URL:=postgres://${DB_USER:-postgres}:${DB_PASSWORD:-postgres}@db:5432/${DB_NAME:-app}}"
# wait for db
host="db"
port="5432"
for i in {1..60}; do
if nc -z "$host" "$port"; then
echo "DB ready"
break
fi
echo "Waiting for DB... ($i)"
sleep 2
done
python manage.py migrate --noinput || true
python manage.py collectstatic --noinput || true
# Start gunicorn (API)
( exec gunicorn "$DJANGO_WSGI_MODULE" --bind 0.0.0.0:8000 --workers ${GUNICORN_WORKERS:-3} --threads ${GUNICORN_THREADS:-2} --timeout 60 ) &
# Start nginx (Frontend)
exec nginx -g "daemon off;"

23
backend/docker/nginx.conf Normal file
View File

@@ -0,0 +1,23 @@
server {
listen 8080;
server_name _;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /static/ {
alias /app/staticfiles/;
access_log off;
expires 30d;
}
location /media/ {
alias /app/media/;
access_log off;
expires 30d;
}
}