Files
internet-engineering-project/DEPLOYMENT.md

86 lines
1.7 KiB
Markdown

# Demo Deployment
This project can run behind the existing Caddy edge service with this temporary route:
```text
Caddy -> chatroom-nginx -> chatroom-app
```
The chatroom compose stack joins the existing external Docker network named `caddy_proxy`. No app ports are published to the host.
## Start the Chatroom Stack
From this project directory:
```powershell
docker compose up -d --build
docker compose ps
```
Test the FastAPI health endpoint through the Nginx container:
```powershell
docker compose exec chatroom-nginx wget -qO- http://chatroom-app:8000/health
```
## Temporary Caddy Change
Do this manually in:
```text
D:\Programing\Scripts\Home Lab\Interanet\caddy-deployment\config\caddy\Caddyfile
```
Add this temporary block:
```caddy
chat.amiirkhl.ir {
import {$CADDY_TLS_MODE:custom_tls}
reverse_proxy chatroom-nginx:80
}
```
If the current custom certificate does not include `chat.amiirkhl.ir`, use this instead:
```caddy
chat.amiirkhl.ir {
import letsencrypt_tls
reverse_proxy chatroom-nginx:80
}
```
Reload Caddy from the Caddy deployment directory:
```powershell
docker compose exec caddy caddy reload --config /etc/caddy/Caddyfile
```
## Browser Test
Open:
```text
https://chat.amiirkhl.ir
```
Use two browser tabs, join the same room, and send messages both ways. The frontend builds its WebSocket URL from the current page, so HTTPS should connect with:
```text
wss://chat.amiirkhl.ir/ws/{room}/{user}
```
## Undo After the Demo
1. Remove the `chat.amiirkhl.ir` block from the Caddyfile.
2. Reload Caddy:
```powershell
docker compose exec caddy caddy reload --config /etc/caddy/Caddyfile
```
3. Stop and remove the chatroom stack from this project directory:
```powershell
docker compose down
```