domain migration

This commit is contained in:
debu-2 2026-10-04 14:40:06 +05:30
parent 192b810eb4
commit c04a6ce6fe
26 changed files with 777 additions and 125 deletions

View file

@ -3,25 +3,25 @@
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 `getall.help` can stay on another host (e.g. GCP).
The **main website** at `gentic.email` can stay on another host (e.g. GCP).
Only the email stack lives on the mail VPS:
| Hostname | Points to | Purpose |
|----------|-----------|---------|
| `getall.help` | GCP / main site IP | Marketing / main app (unchanged) |
| `email.getall.help` | **Mail VPS public IP** | Agmail web UI (Caddy → frontend) |
| `mail.getall.help` | **Mail VPS public IP** | Postfix :25 (inbound + outbound) |
| `@getall.help` MX | `mail.getall.help` | Delivers mail to the VPS |
| `gentic.email` | GCP / main site IP | Marketing / main app (unchanged) |
| `email.gentic.email` | **Mail VPS public IP** | Agmail web UI (Caddy → frontend) |
| `mail.gentic.email` | **Mail VPS public IP** | Postfix :25 (inbound + outbound) |
| `@gentic.email` MX | `mail.gentic.email` | Delivers mail to the VPS |
User addresses remain **`user@getall.help`**.
User addresses remain **`user@gentic.email`**.
## Architecture
```text
Browser ──HTTPS──► email.getall.help (Caddy :443)
Browser ──HTTPS──► email.gentic.email (Caddy :443)
└──► frontend ──► backend ──SMTP──► smtp:25 (Postfix outbound)
Internet ──SMTP:25──► mail.getall.help (Postfix)
Internet ──SMTP:25──► mail.gentic.email (Postfix)
├── inbound → backend:2525 → GCS + MongoDB
└── outbound ← backend (Docker mynetworks)
```
@ -34,7 +34,7 @@ cp .env.example .env
docker compose up -d --build
```
Open **https://email.getall.help** after DNS and TLS are ready.
Open **https://email.gentic.email** after DNS and TLS are ready.
| Service | Host port | Purpose |
|----------|-----------|---------|
@ -60,8 +60,8 @@ MONGO_ROOT_PASSWORD="<strong password>"
GCS_RAW_MIME_BUCKET=<private bucket>
GCS_PROJECT=<gcp project id>
GCP_CREDENTIALS_FILE=./midyear-karma-470610-i1-da5334d20acc.json
CADDY_ACME_EMAIL=admin@getall.help
CORS_ORIGINS=["https://email.getall.help"]
CADDY_ACME_EMAIL=admin@gentic.email
CORS_ORIGINS=["https://email.gentic.email"]
```
Quote values that contain `#`.
@ -74,18 +74,18 @@ Outbound uses the Docker Postfix service by default (`SMTP_HOST=smtp`,
### Split-domain settings (mail VPS)
```env
# User mailboxes are still @getall.help
PLATFORM_DOMAIN=getall.help
# User mailboxes are still @gentic.email
PLATFORM_DOMAIN=gentic.email
# Web UI on this host (Caddy terminates TLS here)
APP_PUBLIC_HOST=email.getall.help
CADDY_ACME_EMAIL=admin@getall.help
APP_PUBLIC_HOST=email.gentic.email
CADDY_ACME_EMAIL=admin@gentic.email
# Postfix hostname (inbound + outbound)
MAIL_HOSTNAME=mail.getall.help
MAIL_DOMAIN=getall.help
INBOUND_DOMAINS=getall.help
SMTP_PUBLIC_HOST=mail.getall.help
MAIL_HOSTNAME=mail.gentic.email
MAIL_DOMAIN=gentic.email
INBOUND_DOMAINS=gentic.email
SMTP_PUBLIC_HOST=mail.gentic.email
SMTP_HOST=smtp
SMTP_PORT=25
SMTP_USE_TLS=false
@ -100,7 +100,7 @@ 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.getall.help/smtp-credentials**:
exact rows at **https://email.gentic.email/smtp-credentials**:
### Inbound
@ -109,16 +109,16 @@ exact rows at **https://email.getall.help/smtp-credentials**:
| **A** | `@` | main site IP | **Keep** — marketing site |
| **A** | `email` | `<VPS_IP>` | Web UI |
| **A** | `mail` | `<VPS_IP>` | Postfix |
| **MX** | `@` | `10 mail.getall.help` | Priority 10 |
| **MX** | `@` | `10 mail.gentic.email` | Priority 10 |
### Outbound authentication
| Type | Host | Value | Notes |
|------|------|-------|-------|
| **TXT** | `@` | `v=spf1 mx a ip4:<VPS_IP> ~all` | SPF for `@getall.help` mail |
| **TXT** | `@` | `v=spf1 mx a ip4:<VPS_IP> ~all` | SPF for `@gentic.email` mail |
| **TXT** | `_spf` | `v=spf1 ip4:<VPS_IP> ~all` | **Required** — company domains SPF-include this |
| **TXT** | `agmail._domainkey` | app DKIM public key | From `/smtp-credentials` |
| **TXT** | `_dmarc` | `v=DMARC1; p=quarantine; rua=mailto:dmarc@getall.help` | One record only |
| **TXT** | `_dmarc` | `v=DMARC1; p=quarantine; rua=mailto:dmarc@gentic.email` | One record only |
Remove any old Amazon SES Easy DKIM CNAMEs and `include:amazonses.com` from SPF.
@ -140,22 +140,22 @@ nc -vz -w 5 gmail-smtp-in.l.google.com 25
### Reverse DNS (PTR) — required for Gmail/Outlook
Major receivers expect your VPS IP reverse DNS to match `mail.getall.help`.
Major receivers expect your VPS IP reverse DNS to match `mail.gentic.email`.
```bash
dig +short -x YOUR_VPS_IP
# Good: mail.getall.help.
# Good: mail.gentic.email.
```
Set PTR in your VPS provider panel (is\*hosting: client area → network /
rDNS, or open a support ticket) to `mail.getall.help`.
rDNS, or open a support ticket) to `mail.gentic.email`.
### STARTTLS on Postfix (port 25)
Gmail/Zoho use STARTTLS. Postfix generates a cert on first boot. After rebuild:
```bash
printf 'EHLO test\r\nSTARTTLS\r\n' | nc mail.getall.help 25
printf 'EHLO test\r\nSTARTTLS\r\n' | nc mail.gentic.email 25
# expect: 220 Ready to start TLS (not 454 TLS not available)
```
@ -163,7 +163,7 @@ printf 'EHLO test\r\nSTARTTLS\r\n' | nc mail.getall.help 25
Caddy obtains Let's Encrypt certificates automatically when:
1. `APP_PUBLIC_HOST=email.getall.help` resolves to this server's public IP
1. `APP_PUBLIC_HOST=email.gentic.email` resolves to this server's public IP
2. Ports 80 and 443 are open
3. `CADDY_ACME_EMAIL` is set in `.env`
@ -173,13 +173,13 @@ Config: `deploy/caddy/Caddyfile` → reverse-proxies to `frontend:80`.
```bash
# HTTPS UI
curl -fsSI https://email.getall.help/health
curl -fsSI https://email.gentic.email/health
# Inbound mail (account must exist)
swaks \
--server mail.getall.help:25 \
--server mail.gentic.email:25 \
--from sender@example.com \
--to existing-user@getall.help \
--to existing-user@gentic.email \
--header "Subject: inbound smoke test" \
--body "Verify delivery"
@ -211,7 +211,7 @@ 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.getall.help
# APP_PUBLIC_HOST=email.gentic.email
# CADDY_ACME_EMAIL=you@gmail.com
# 2. Check Caddy logs for ACME errors
@ -227,12 +227,12 @@ docker compose logs -f caddy
Wait 30–60 seconds, then test:
```bash
curl -fsSI https://email.getall.help/
curl -fsSI https://email.gentic.email/
```
Requirements for Let's Encrypt:
- `email.getall.help` A record → this server's public IP
- `email.gentic.email` A record → this server's public IP
- Firewall allows **inbound TCP 80 and 443** from `0.0.0.0/0`
- `CADDY_ACME_EMAIL` set in `.env`