feat(deploy): serve backend from api subdomain

This commit is contained in:
2026-04-29 20:16:18 +03:30
parent 64be80da12
commit a91606cc32
4 changed files with 73 additions and 19 deletions

View File

@@ -45,18 +45,20 @@ The backend container runs database migrations and `collectstatic` on startup, t
The Nginx config is prepared for:
- `qlockify.ir`
- `www.qlockify.ir`
- `api.qlockify.ir`
Requests to `www.qlockify.ir` are redirected to `qlockify.ir`.
Backend traffic is served from `api.qlockify.ir`.
Before bringing the stack up in production:
1. Point the DNS `A` or `AAAA` records for `qlockify.ir` and `www.qlockify.ir` to your server.
1. Point the DNS `A` or `AAAA` records for `qlockify.ir`, `www.qlockify.ir`, and `api.qlockify.ir` to your server.
2. Set the backend env values in `./backend/qlockify-backend-deployment/.env`:
- `DJANGO_ALLOWED_HOSTS=qlockify.ir,www.qlockify.ir`
- `DJANGO_ALLOWED_HOSTS=api.qlockify.ir,qlockify.ir,www.qlockify.ir`
- `CORS_ALLOWED_ORIGINS=https://qlockify.ir,https://www.qlockify.ir`
- `CSRF_TRUSTED_ORIGINS=https://qlockify.ir,https://www.qlockify.ir`
- `BASE_URL=https://qlockify.ir`
- `CSRF_TRUSTED_ORIGINS=https://api.qlockify.ir,https://qlockify.ir,https://www.qlockify.ir`
- `BASE_URL=https://api.qlockify.ir`
3. Set the frontend env value in `./frontend/qlockify-frontend-deployment/.env`:
- `VITE_API_BASE_URL=https://qlockify.ir/api`
- `VITE_API_BASE_URL=https://api.qlockify.ir/api`
## SSL certificates
@@ -73,6 +75,9 @@ With the current Nginx config:
- `http://qlockify.ir` redirects to `https://qlockify.ir`
- `http://www.qlockify.ir` redirects to `https://qlockify.ir`
- `https://www.qlockify.ir` redirects to `https://qlockify.ir`
- `http://api.qlockify.ir` redirects to `https://api.qlockify.ir`
- the main site is served from `https://qlockify.ir`
- the backend API, admin, docs, media, and static files are served from `https://api.qlockify.ir`
Make sure port `443` is open on the server firewall before starting the stack.