Merge pull request #8 from Aykhan-s/dev

fix: get_remote_address & merged docker compose files
This commit is contained in:
Aykhan Shahsuvarov 2023-09-20 21:48:43 +04:00 committed by GitHub
commit 3450869d74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2 additions and 81 deletions

View File

@ -1,23 +0,0 @@
upstream app_server{
server app:8000;
}
server{
listen 80;
server_name ui.aykhans.me;
location / {
proxy_pass http://app_server;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_CF_Connecting_IP;
proxy_redirect off;
}
location /static/ {
alias /static/;
}
location /media/ {
alias /media/;
}
}

View File

@ -1,56 +0,0 @@
version: "3.9"
services:
db:
image: postgres
ports:
- 5432:5432
volumes:
- dbdata:/var/lib/postgresql/data
env_file:
- ./config/postgres/postgres.env
mongodb:
image: mongo:latest
env_file:
- ./config/mongodb/mongodb.env
ports:
- 27017:27017
volumes:
- mongodb_data:/data/db
app:
build: ./src/
env_file:
- ./config/postgres/postgres.env
- ./config/mongodb/mongodb.env
- ./config/app/app.env
ports:
- 8000:8000
depends_on:
- db
- mongodb
volumes:
- ./src/app:/src/app
- static:/src/static
- media:/src/media
command: >
bash -c "poetry run alembic upgrade head
&& poetry run uvicorn --reload --host=0.0.0.0 --port=8000 app.main:app"
nginx:
image: nginx
ports:
- 80:80
volumes:
- ./config/nginx/nginx.prod.conf:/etc/nginx/conf.d/default.conf
- static:/static
- media:/media
depends_on:
- app
volumes:
dbdata:
static:
media:
mongodb_data:

View File

@ -43,7 +43,7 @@ services:
ports:
- 80:80
volumes:
- ./config/nginx/nginx.dev.conf:/etc/nginx/conf.d/default.conf
- ./config/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
- static:/static
- media:/media
depends_on:

View File

@ -8,4 +8,4 @@ def html2text(html: str) -> str:
def get_remote_address(request: Request) -> str:
return request.headers.get('host')
return request.headers.get('x-forwarded-for').split(',')[0]