mirror of
https://github.com/aykhans/portfolio-blog.git
synced 2025-04-16 19:03:11 +00:00
Added dev and prod docker compose files
This commit is contained in:
parent
e5f5624635
commit
f782c782bd
@ -1,4 +1,5 @@
|
|||||||
MONGO_INITDB_ROOT_USERNAME="USERNAME"
|
MONGO_INITDB_ROOT_USERNAME="USERNAME"
|
||||||
MONGO_INITDB_ROOT_PASSWORD="PASSWORD"
|
MONGO_INITDB_ROOT_PASSWORD="PASSWORD"
|
||||||
|
MONGO_DB_PORT=27017
|
||||||
|
|
||||||
MONGO_DB_LOGS_NAME="LOGS"
|
MONGO_DB_LOGS_NAME="LOGS"
|
||||||
|
23
config/nginx/nginx.prod.conf
Normal file
23
config/nginx/nginx.prod.conf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
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/;
|
||||||
|
}
|
||||||
|
}
|
@ -43,7 +43,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 80:80
|
- 80:80
|
||||||
volumes:
|
volumes:
|
||||||
- ./config/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
|
- ./config/nginx/nginx.dev.conf:/etc/nginx/conf.d/default.conf
|
||||||
- static:/static
|
- static:/static
|
||||||
- media:/media
|
- media:/media
|
||||||
depends_on:
|
depends_on:
|
56
docker-compose-prod.yml
Normal file
56
docker-compose-prod.yml
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
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:
|
@ -50,7 +50,7 @@ async def home(request: Request):
|
|||||||
|
|
||||||
|
|
||||||
@router.post('/send-email')
|
@router.post('/send-email')
|
||||||
@limiter.limit('222/day')
|
@limiter.limit('2/day')
|
||||||
async def send_email(
|
async def send_email(
|
||||||
request: Request,
|
request: Request,
|
||||||
background_tasks: BackgroundTasks,
|
background_tasks: BackgroundTasks,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user