Skip to content

Commit ac19973

Browse files
feat: add backend
Update start_celery.sh
1 parent d1a9346 commit ac19973

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ services:
121121
container_name: frontend
122122
restart: unless-stopped
123123
environment:
124-
PUBLIC_BACKEND_API: http://localhost/api
124+
PUBLIC_BACKEND_API: https://backend.localhost
125125
ports:
126126
- "3000:3000"
127127
depends_on:

src/backend/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ dev = [
4343
"poethepoet>=0.39.0",
4444
]
4545
[tool.poe.tasks]
46-
celery = "celery -A app.celery worker --loglevel=info"
4746
dev = "fastapi dev ./app/main.py"
4847

4948
[tool.setuptools]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/bash
2+
set -e
3+
4+
cd "$(dirname "$0")/.." || exit 1
25

36
alembic upgrade head
47
uvicorn app.main:app --host 0.0.0.0 --port 8000
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
#!/bin/bash
22

3-
celery -A app.celery worker --loglevel=info
3+
# Run celery worker using (nproc - 1) concurrency, fallback to 1
4+
CORES=$(nproc)
5+
if [ "$CORES" -gt 1 ]; then
6+
CONCURRENCY=$((CORES - 1))
7+
else
8+
CONCURRENCY=1
9+
fi
10+
11+
exec celery -A app.celery worker --concurrency "$CONCURRENCY" --loglevel=info --max-memory-per-child=131072

src/caddy/Caddyfile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
{
22
# email your-email@example.com
33
}
4-
5-
localhost {
6-
# Reverse proxy for the Backend API
7-
handle_path /api* {
4+
backend.localhost {
5+
handle {
86
reverse_proxy backend:8000
97
}
8+
}
109

10+
localhost {
1111
# Reverse proxy for the Frontend
1212
handle {
1313
reverse_proxy frontend:3000
1414
}
1515

16-
log {
17-
output file /var/log/caddy/access.log
18-
}
1916
}

0 commit comments

Comments
 (0)