update : 27.12.2023 19:22:19,64
This commit is contained in:
parent
44ac98b934
commit
90f540ffce
@ -1,38 +1,48 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
yt_postgres:
|
||||
postgres:
|
||||
restart: always
|
||||
image: postgres:15
|
||||
container_name: yt_postgres
|
||||
container_name: postgres
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
|
||||
interval: 10s
|
||||
timeout: 60s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
volumes:
|
||||
- ~/.pg/pg_data/yt:/var/lib/postgresql/data
|
||||
- ../postgres:/var/lib/postgresql/data
|
||||
env_file:
|
||||
- .env
|
||||
youtube_project:
|
||||
image: yt_django:latest
|
||||
container_name: yt_django
|
||||
- ../env
|
||||
project:
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
image: repcofkk:latest
|
||||
container_name: repcofkk
|
||||
depends_on:
|
||||
- yt_postgres
|
||||
- postgres
|
||||
volumes:
|
||||
- static_volume:/yt/static
|
||||
- media_volume:/yt/media
|
||||
- static_volume:/cybercode/static
|
||||
- media_volume:/cybercode/media
|
||||
env_file:
|
||||
- .env
|
||||
- ../env
|
||||
command: >
|
||||
bash -c "./manage.py collectstatic --noinput && ./manage.py migrate && gunicorn -b 0.0.0.0:8000 soaqaz.wsgi:application"
|
||||
bash -c "./manage.py collectstatic --noinput && ./manage.py migrate && gunicorn -b 0.0.0.0:8000 repcofkk.wsgi:application"
|
||||
nginx:
|
||||
build:
|
||||
dockerfile: ./Dockerfile
|
||||
context: ./docker/nginx/
|
||||
container_name: yt_nginx
|
||||
image: yt_nginx
|
||||
container_name: nginx
|
||||
image: nginx
|
||||
volumes:
|
||||
- static_volume:/yt/static
|
||||
- media_volume:/yt/media
|
||||
- static_volume:/cybercode/static
|
||||
- media_volume:/cybercode/media
|
||||
depends_on:
|
||||
- youtube_project
|
||||
- project
|
||||
ports:
|
||||
- "${NGINX_EXTERNAL_PORT}:80"
|
||||
- 80:80
|
||||
|
||||
volumes:
|
||||
static_volume:
|
||||
|
||||
5
docker/nginx/Dockerfile
Normal file
5
docker/nginx/Dockerfile
Normal file
@ -0,0 +1,5 @@
|
||||
FROM nginx:latest
|
||||
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
COPY nginx.conf /etc/nginx/conf.d
|
||||
COPY proxy_params /etc/nginx
|
||||
21
docker/nginx/nginx.conf
Normal file
21
docker/nginx/nginx.conf
Normal file
@ -0,0 +1,21 @@
|
||||
upstream youtube_project {
|
||||
server youtube_project:8000;
|
||||
}
|
||||
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
include proxy_params;
|
||||
proxy_pass http://youtube_project;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
alias /yt/static/;
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
alias /yt/media/;
|
||||
}
|
||||
}
|
||||
7
docker/nginx/proxy_params
Normal file
7
docker/nginx/proxy_params
Normal file
@ -0,0 +1,7 @@
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_pass_header Set-Cookie;
|
||||
@ -15,17 +15,14 @@ ATT_ROOT = ''
|
||||
ADR_LOCAL =''
|
||||
DOWNLOAD_ROOT = ''
|
||||
|
||||
DATABASES_NAME='repcofkk_db'
|
||||
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'HOST': '127.0.0.1',
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': DATABASES_NAME,
|
||||
'USER': 'repcofkk_user',
|
||||
'PASSWORD': 'Angstrem*45',
|
||||
'HOST': os.environ.get('POSTGRES_HOST', '127.0.0.1'),
|
||||
'PORT': int(os.environ.get('POSTGRES_PORT', '5432')),
|
||||
'NAME': os.environ.get('POSTGRES_DB', 'repcofkk_db'),
|
||||
'USER': os.environ.get('POSTGRES_USER', 'repcofkk_user'),
|
||||
'PASSWORD': os.environ.get('POSTGRES_PASSWORD', 'Angstrem*45'),
|
||||
'CONN_MAX_AGE':None,
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user