feat(deploy): add qlockify.ir domain and ssl config
This commit is contained in:
51
README.md
51
README.md
@@ -2,7 +2,10 @@
|
||||
|
||||
This repository is the deployment layer only.
|
||||
|
||||
Docker builds read from the local `./backend` and `./frontend` directories inside this repository.
|
||||
Docker builds now read from nested application source directories inside this repository:
|
||||
- `./backend/qlockify-backend-deployment`
|
||||
- `./frontend/qlockify-frontend-deployment`
|
||||
|
||||
Those directories are expected to contain the backend and frontend application source before you build for deployment.
|
||||
|
||||
## Local structure
|
||||
@@ -12,7 +15,9 @@ The expected deployment layout is:
|
||||
```text
|
||||
qlockify-deployment/
|
||||
backend/
|
||||
qlockify-backend-deployment/
|
||||
frontend/
|
||||
qlockify-frontend-deployment/
|
||||
nginx/
|
||||
postgres/
|
||||
docker-compose.yml
|
||||
@@ -21,12 +26,12 @@ qlockify-deployment/
|
||||
## Deployment flow
|
||||
|
||||
1. Put your application source into:
|
||||
- `./backend`
|
||||
- `./frontend`
|
||||
- `./backend/qlockify-backend-deployment`
|
||||
- `./frontend/qlockify-frontend-deployment`
|
||||
2. Configure deployment env files:
|
||||
- `./.env`
|
||||
- `./backend/.env`
|
||||
- `./frontend/.env`
|
||||
- `./backend/qlockify-backend-deployment/.env`
|
||||
- `./frontend/qlockify-frontend-deployment/.env`
|
||||
3. From `qlockify-deployment`, build and start the stack:
|
||||
|
||||
```powershell
|
||||
@@ -35,6 +40,42 @@ docker compose up --build
|
||||
|
||||
The backend container runs database migrations and `collectstatic` on startup, then serves Django with Gunicorn using `config.wsgi:application`.
|
||||
|
||||
## Domain setup
|
||||
|
||||
The Nginx config is prepared for:
|
||||
- `qlockify.ir`
|
||||
- `www.qlockify.ir`
|
||||
|
||||
Requests to `www.qlockify.ir` are redirected to `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.
|
||||
2. Set the backend env values in `./backend/qlockify-backend-deployment/.env`:
|
||||
- `DJANGO_ALLOWED_HOSTS=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`
|
||||
3. Set the frontend env value in `./frontend/qlockify-frontend-deployment/.env`:
|
||||
- `VITE_API_BASE_URL=https://qlockify.ir/api`
|
||||
|
||||
## SSL certificates
|
||||
|
||||
HTTPS is configured through Nginx if you place these files in:
|
||||
|
||||
```text
|
||||
./nginx/certs/fullchain.pem
|
||||
./nginx/certs/privkey.pem
|
||||
```
|
||||
|
||||
The repo keeps `./nginx/certs/.gitkeep` only. Actual certificate files are ignored by git.
|
||||
|
||||
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`
|
||||
|
||||
Make sure port `443` is open on the server firewall before starting the stack.
|
||||
|
||||
## SSE Notifications
|
||||
|
||||
Notifications now use Server-Sent Events at `/api/notifications/stream/`.
|
||||
|
||||
Reference in New Issue
Block a user