atlas-academy/docs/DEPLOYMENT.md
Atlas Developer 03829a38b2 feat: Atlas Academy — Odoo eLearning platform, full fusion
9-course Dutch e-learning platform fused onto atlasacademy.nl via Caddy
reverse proxy. Odoo 19 Community as course engine (website_slides), static
HTML for marketing front. Single Odoo account system.

- static/: 8 marketing pages (index, pricing, coaching, leerpad, over, shop, bisl, esf)
- backend/odoo_relay.py: lead relay Flask service (POST /academy-lead → Odoo CRM)
- caddy/academy.caddyfile: full Caddy config with Odoo proxy + auth rewrites
- docs/: ARCHITECTURE, USERFLOW, COURSES, DEPLOYMENT, SECURITY, ODOO

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-23 00:48:45 +02:00

181 lines
4.6 KiB
Markdown

# Deployment Runbook — Atlas Academy
## Infrastructuur
| Service | Host | Pad |
|---------|------|-----|
| Caddy (TLS + proxy) | atlas-01 (`178.105.85.200`) | `/etc/caddy/Caddyfile` |
| Static marketing | atlas-01 | `/var/www/atlasacademy.nl/` |
| Odoo eLearning | atlas-01 Docker | container `atlas-odoo`, DB `atlas` |
| Lead relay | atlas-01 systemd | `atlas-academy-relay`, port `7793` |
| Tailnet IP | atlas-01 tailscale | `100.93.16.81` |
---
## 1. Statische pagina deployen
```bash
# Één pagina pushen
scp pricing.html atlas-01:/var/www/atlasacademy.nl/pricing.html
curl -so /dev/null -w '%{http_code}' https://atlasacademy.nl/pricing.html
# verwacht: 200
# Meerdere pagina's tegelijk
scp *.html atlas-01:/var/www/atlasacademy.nl/
```
Geen Caddy reload nodig — Caddy serveert files direct.
---
## 2. Cursus toevoegen aan Odoo
```bash
# 1. Script schrijven op lokale machine (zie docs/COURSES.md voor formaat)
# 2. Uploaden naar atlas-01
scp build_cursus.py atlas-01:/tmp/
# 3. Uitvoeren in Odoo ORM shell
ssh atlas-01 "docker exec -i atlas-odoo odoo shell -d atlas --no-http < /tmp/build_cursus.py"
# Verwachte output:
# Cursus aangemaakt: /slides/mijn-cursus-10
```
**Let op:** altijd `env.cr.commit()` aan het einde van het script, anders worden geen wijzigingen opgeslagen.
---
## 3. Caddy configuratie wijzigen
```bash
# 1. Huidige config backuppen
ssh atlas-01 "cp /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak.$(date +%s)"
# 2. Bewerken
ssh atlas-01 "nano /etc/caddy/Caddyfile"
# 3. Valideren vóór reload
ssh atlas-01 "caddy validate --config /etc/caddy/Caddyfile"
# 4. Herladen (zero-downtime)
ssh atlas-01 "caddy reload --config /etc/caddy/Caddyfile"
```
---
## 4. Lead relay
```bash
# Status
ssh atlas-01 "systemctl status atlas-academy-relay"
# Logs
ssh atlas-01 "journalctl -u atlas-academy-relay -n 50 --no-pager"
# Herstarten (na config-wijziging)
ssh atlas-01 "systemctl restart atlas-academy-relay"
# Secrets bijwerken
ssh atlas-01 "nano /etc/atlas/academy-relay.env"
ssh atlas-01 "systemctl restart atlas-academy-relay"
```
---
## 5. Odoo herstarten
Na wijzigingen die ORM-cache moeten legen (website aanmaken, config params):
```bash
ssh atlas-01 "docker restart atlas-odoo"
# wacht ~30s
curl -so /dev/null -w '%{http_code}' https://atlasacademy.nl/slides
# verwacht: 200
```
---
## 6. Odoo ORM shell — veelgebruikte één-regels
```bash
# Lijst alle cursussen
ssh atlas-01 "docker exec -i atlas-odoo odoo shell -d atlas --no-http" <<'EOF'
for c in env['slide.channel'].sudo().search([]): print(c.id, c.name, c.website_id.id)
EOF
# Controleer website 3
ssh atlas-01 "docker exec -i atlas-odoo odoo shell -d atlas --no-http" <<'EOF'
w = env['website'].sudo().browse(3)
print(w.name, w.domain, w.auth_signup_uninvited)
EOF
# Signup status per website
ssh atlas-01 "docker exec -i atlas-odoo odoo shell -d atlas --no-http" <<'EOF'
for w in env['website'].sudo().search([]): print(w.id, w.name, w.auth_signup_uninvited)
EOF
```
---
## 7. Assets / cache legen
```bash
# Browser-cache bypass: open in incognito
# Odoo assets regenereren (na theme-wijziging)
ssh atlas-01 "docker exec -i atlas-odoo odoo shell -d atlas --no-http" <<'EOF'
env['ir.attachment'].sudo().search([
('url', 'like', '/web/assets/'),
('store_fname', '!=', False)
]).unlink()
env.cr.commit()
print('Assets cleared')
EOF
ssh atlas-01 "docker restart atlas-odoo"
```
---
## 8. IndexNow pingen na content-wijziging
```bash
KEY="atlascorporation-indexnow-2025"
curl -X POST "https://api.indexnow.org/indexnow" \
-H "Content-Type: application/json" \
-d "{\"host\":\"atlasacademy.nl\",\"key\":\"$KEY\",\"urlList\":[\"https://atlasacademy.nl/\",\"https://atlasacademy.nl/slides\"]}"
```
---
## 9. Rollback procedure
```bash
# Static pagina rollback (bak-bestanden aanwezig)
ssh atlas-01 "ls /var/www/atlasacademy.nl/*.bak* | tail -5"
ssh atlas-01 "cp /var/www/atlasacademy.nl/pricing.html.bak.nav /var/www/atlasacademy.nl/pricing.html"
# Caddy rollback
ssh atlas-01 "cp /etc/caddy/Caddyfile.bak.<timestamp> /etc/caddy/Caddyfile && caddy reload --config /etc/caddy/Caddyfile"
# Odoo cursus verwijderen
# Verwijder via Odoo backend UI (tailnet: http://100.93.16.81:8069/web)
```
---
## 10. Monitoring
```bash
# HTTPS check
curl -so /dev/null -w '%{http_code}' https://atlasacademy.nl/
curl -so /dev/null -w '%{http_code}' https://atlasacademy.nl/slides
# Relay check
curl -s -X POST https://atlasacademy.nl/academy-lead \
-H "Content-Type: application/json" \
-d '{"name":"Test","email":"test@test.nl","interest":"test","source":"deploy-check"}'
# verwacht: {"ok": true, ...}
# Odoo health
curl -so /dev/null -w '%{http_code}' http://100.93.16.81:8069/web/health
```