company flows

This commit is contained in:
debu-2 2026-10-04 15:35:17 +05:30
parent c04a6ce6fe
commit a3a6464a99
15 changed files with 963 additions and 60 deletions

View file

@ -3,13 +3,12 @@
Agmail runs as one Docker Compose stack on a **mail VPS** (port 25 open): Caddy
(HTTPS), frontend, backend, PostgreSQL, MongoDB, and Postfix (inbound + outbound).
The **main website** at `gentic.email` can stay on another host (e.g. GCP).
Only the email stack lives on the mail VPS:
The Agmail stack lives on the **mail VPS**:
| Hostname | Points to | Purpose |
|----------|-----------|---------|
| `gentic.email` | GCP / main site IP | Marketing / main app (unchanged) |
| `email.gentic.email` | **Mail VPS public IP** | Agmail web UI (Caddy → frontend) |
| `gentic.email` | **Mail VPS public IP** | Agmail web UI (Caddy → frontend, primary) |
| `email.getall.help` | **Mail VPS public IP** | Legacy alternate URL to the same web UI |
| `mail.gentic.email` | **Mail VPS public IP** | Postfix :25 (inbound + outbound) |
| `@gentic.email` MX | `mail.gentic.email` | Delivers mail to the VPS |
@ -18,7 +17,7 @@ User addresses remain **`user@gentic.email`**.
## Architecture
```text
Browser ──HTTPS──► email.gentic.email (Caddy :443)
Browser ──HTTPS──► gentic.email / email.getall.help (Caddy :443)
└──► frontend ──► backend ──SMTP──► smtp:25 (Postfix outbound)
Internet ──SMTP:25──► mail.gentic.email (Postfix)
@ -34,7 +33,7 @@ cp .env.example .env
docker compose up -d --build
```
Open **https://email.gentic.email** after DNS and TLS are ready.
Open **https://gentic.email** (or **https://email.getall.help**) after DNS and TLS are ready.
| Service | Host port | Purpose |
|----------|-----------|---------|
@ -61,7 +60,7 @@ GCS_RAW_MIME_BUCKET=<private bucket>
GCS_PROJECT=<gcp project id>
GCP_CREDENTIALS_FILE=./midyear-karma-470610-i1-da5334d20acc.json
CADDY_ACME_EMAIL=admin@gentic.email
CORS_ORIGINS=["https://email.gentic.email"]
CORS_ORIGINS=["https://gentic.email","https://email.getall.help"]
```
Quote values that contain `#`.
@ -78,13 +77,14 @@ Outbound uses the Docker Postfix service by default (`SMTP_HOST=smtp`,
PLATFORM_DOMAIN=gentic.email
# Web UI on this host (Caddy terminates TLS here)
APP_PUBLIC_HOST=email.gentic.email
APP_PUBLIC_HOST=gentic.email
CADDY_ALT_HOST=email.getall.help
CADDY_ACME_EMAIL=admin@gentic.email
# Postfix hostname (inbound + outbound)
MAIL_HOSTNAME=mail.gentic.email
MAIL_DOMAIN=gentic.email
INBOUND_DOMAINS=gentic.email
INBOUND_DOMAINS=gentic.email,getall.help
SMTP_PUBLIC_HOST=mail.gentic.email
SMTP_HOST=smtp
SMTP_PORT=25
@ -100,14 +100,13 @@ INBOUND_SMTP_BIND_IP=127.0.0.1
## Namecheap DNS changes
Update DNS as follows (`<VPS_IP>` = public IP of the mail server). Generate the
exact rows at **https://email.gentic.email/smtp-credentials**:
exact rows at **https://gentic.email/smtp-credentials**:
### Inbound
| Type | Host | Value | Notes |
|------|------|-------|-------|
| **A** | `@` | main site IP | **Keep** — marketing site |
| **A** | `email` | `<VPS_IP>` | Web UI |
| **A** | `@` | `<VPS_IP>` | Agmail web UI |
| **A** | `mail` | `<VPS_IP>` | Postfix |
| **MX** | `@` | `10 mail.gentic.email` | Priority 10 |
@ -163,7 +162,7 @@ printf 'EHLO test\r\nSTARTTLS\r\n' | nc mail.gentic.email 25
Caddy obtains Let's Encrypt certificates automatically when:
1. `APP_PUBLIC_HOST=email.gentic.email` resolves to this server's public IP
1. `APP_PUBLIC_HOST` and `CADDY_ALT_HOST` resolve to this server's public IP
2. Ports 80 and 443 are open
3. `CADDY_ACME_EMAIL` is set in `.env`
@ -173,7 +172,8 @@ Config: `deploy/caddy/Caddyfile` → reverse-proxies to `frontend:80`.
```bash
# HTTPS UI
curl -fsSI https://email.gentic.email/health
curl -fsSI https://gentic.email/health
curl -fsSI https://email.getall.help/health
# Inbound mail (account must exist)
swaks \
@ -211,7 +211,8 @@ cd /opt/apps/agentic_email
# 1. Confirm .env has a real contact email (use your Gmail if unsure)
grep CADDY_ACME_EMAIL .env
grep APP_PUBLIC_HOST .env
# APP_PUBLIC_HOST=email.gentic.email
# APP_PUBLIC_HOST=gentic.email
# CADDY_ALT_HOST=email.getall.help
# CADDY_ACME_EMAIL=you@gmail.com
# 2. Check Caddy logs for ACME errors
@ -227,12 +228,12 @@ docker compose logs -f caddy
Wait 30–60 seconds, then test:
```bash
curl -fsSI https://email.gentic.email/
curl -fsSI https://gentic.email/
```
Requirements for Let's Encrypt:
- `email.gentic.email` A record → this server's public IP
- `gentic.email` and `email.getall.help` A records → this server's public IP
- Firewall allows **inbound TCP 80 and 443** from `0.0.0.0/0`
- `CADDY_ACME_EMAIL` set in `.env`