tractatus/scripts/protonmail-bridge.service
TheFlow 8b9f946a4a feat: Migrate from SendGrid to ProtonBridge for email sending
Complete migration to ProtonBridge following proven family-history architecture:

Backend Changes:
- Replace @sendgrid/mail with nodemailer
- Refactor EmailService for ProtonBridge/SMTP
- Add smart port detection (1026 prod, 1025 dev)
- Implement connection pooling and rate limiting
- Add EMAIL_ENABLED flag for dev/prod separation
- Add checkConnection() method for health checks

Email Service Features:
- Localhost-only SMTP (127.0.0.1)
- Automatic production/development port detection
- Connection verification on initialization
- Connection pooling (max 5 connections)
- Rate limiting (10 messages/second)
- Graceful fallback when email disabled

Documentation:
- Complete ProtonBridge setup guide (VPS installation)
- Quick start guide (30-minute setup)
- Systemd service file template
- Environment variable configuration
- Troubleshooting guide
- Migration notes from SendGrid

Architecture Benefits:
- Privacy-focused (end-to-end encrypted via Proton)
- Self-hosted bridge on VPS (no third-party API)
- Validated in production (family-history: 3+ months, 315+ restarts)
- Cost-effective (Proton paid account ~$4/month)
- No external dependencies (localhost SMTP)

Next Steps:
1. Install ProtonBridge on production VPS
2. Update production .env with Bridge credentials
3. Deploy email service changes
4. Test newsletter sending

See docs/PROTONBRIDGE_QUICKSTART.md for deployment guide

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 12:02:17 +13:00

22 lines
660 B
Desktop File

[Unit]
Description=ProtonMail Bridge
After=network.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Environment="HOME=/home/ubuntu"
Environment="DISPLAY=:99"
Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus"
Environment="XDG_RUNTIME_DIR=/run/user/1000"
ExecStartPre=/bin/bash -c 'if ! pgrep -x "Xvfb" > /dev/null; then Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & fi'
ExecStart=/usr/bin/protonmail-bridge --noninteractive
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target