Adapt docker-compose and nginx.conf for deployment on infra
This commit is contained in:
1
.env
1
.env
@@ -1,6 +1,7 @@
|
|||||||
SECRET_KEY=tYmcw4icw9qlVU2wToq3Szpli6TLhKqsHFCh616oY3ZnbmUbKh1ehjZzcZZwtHKqcgE
|
SECRET_KEY=tYmcw4icw9qlVU2wToq3Szpli6TLhKqsHFCh616oY3ZnbmUbKh1ehjZzcZZwtHKqcgE
|
||||||
DEBUG=True
|
DEBUG=True
|
||||||
ALLOWED_HOSTS=localhost,127.0.0.1,web
|
ALLOWED_HOSTS=localhost,127.0.0.1,web
|
||||||
|
NETWORK=shooter-hub_default
|
||||||
|
|
||||||
DATABASE_URL=postgresql://shooter:shooter_secret@db:5432/shooter_hub
|
DATABASE_URL=postgresql://shooter:shooter_secret@db:5432/shooter_hub
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,12 @@ services:
|
|||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
networks:
|
||||||
|
local_net:
|
||||||
|
aliases:
|
||||||
|
- ${COMPOSE_PROJECT_NAME}-db
|
||||||
|
|
||||||
web:
|
app:
|
||||||
build: .
|
build: .
|
||||||
command: >
|
command: >
|
||||||
sh -c "python manage.py migrate --noinput &&
|
sh -c "python manage.py migrate --noinput &&
|
||||||
@@ -23,23 +27,36 @@ services:
|
|||||||
python manage.py runserver 0.0.0.0:8000"
|
python manage.py runserver 0.0.0.0:8000"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
ports:
|
#ports:
|
||||||
- "8000:8000"
|
#- "8000:8000"
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
networks:
|
||||||
|
local_net:
|
||||||
|
aliases:
|
||||||
|
- ${COMPOSE_PROJECT_NAME}-app
|
||||||
|
|
||||||
frontend:
|
web:
|
||||||
image: nginx:alpine
|
image: nginx:alpine
|
||||||
volumes:
|
volumes:
|
||||||
- ./frontend:/usr/share/nginx/html:ro
|
- ./frontend:/usr/share/nginx/html:ro
|
||||||
- ./frontend/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
- ./frontend/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
ports:
|
# ports:
|
||||||
- "5173:80"
|
#- "5173:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
- web
|
- app
|
||||||
|
networks:
|
||||||
|
local_net:
|
||||||
|
aliases:
|
||||||
|
- ${COMPOSE_PROJECT_NAME}-web
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
local_net:
|
||||||
|
name: ${NETWORK}
|
||||||
|
external: true
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ server {
|
|||||||
|
|
||||||
# Proxy API calls to Django
|
# Proxy API calls to Django
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://web:8000;
|
proxy_pass http://app:8000;
|
||||||
proxy_set_header Host web;
|
proxy_set_header Host web;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
@@ -14,7 +14,7 @@ server {
|
|||||||
|
|
||||||
# Proxy media files to Django
|
# Proxy media files to Django
|
||||||
location /media/ {
|
location /media/ {
|
||||||
proxy_pass http://web:8000;
|
proxy_pass http://app:8000;
|
||||||
proxy_set_header Host web;
|
proxy_set_header Host web;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user