**Cache-Busting Improvements:** - Switched from timestamp-based to semantic versioning (v1.0.2) - Updated all HTML files: index.html, docs.html, leader.html - CSS: tailwind.css?v=1.0.2 - JS: navbar.js, document-cards.js, docs-app.js v1.0.2 - Professional versioning approach for production stability **systemd Service Implementation:** - Created tractatus-dev.service for development environment - Created tractatus-prod.service for production environment - Added install-systemd.sh script for easy deployment - Security hardening: NoNewPrivileges, PrivateTmp, ProtectSystem - Resource limits: 1GB dev, 2GB prod memory limits - Proper logging integration with journalctl - Automatic restart on failure (RestartSec=10) **Why systemd over pm2:** 1. Native Linux integration, no additional dependencies 2. Better OS-level security controls (ProtectSystem, ProtectHome) 3. Superior logging with journalctl integration 4. Standard across Linux distributions 5. More robust process management for production **Usage:** # Development: sudo ./scripts/install-systemd.sh dev # Production: sudo ./scripts/install-systemd.sh prod # View logs: sudo journalctl -u tractatus -f 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
41 lines
791 B
Desktop File
41 lines
791 B
Desktop File
[Unit]
|
|
Description=Tractatus AI Safety Framework (Production)
|
|
Documentation=https://tractatus.sydigital.co.nz
|
|
After=network.target mongod.service
|
|
Wants=mongod.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=ubuntu
|
|
Group=ubuntu
|
|
WorkingDirectory=/var/www/tractatus
|
|
|
|
# Environment
|
|
Environment=NODE_ENV=production
|
|
Environment=PORT=9000
|
|
EnvironmentFile=/var/www/tractatus/.env
|
|
|
|
# Execution
|
|
ExecStart=/usr/bin/node src/server.js
|
|
Restart=always
|
|
RestartSec=10
|
|
|
|
# Security hardening
|
|
NoNewPrivileges=true
|
|
PrivateTmp=true
|
|
ProtectSystem=strict
|
|
ProtectHome=true
|
|
ReadWritePaths=/var/www/tractatus/logs
|
|
ReadWritePaths=/var/www/tractatus/uploads
|
|
|
|
# Logging
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
SyslogIdentifier=tractatus
|
|
|
|
# Resource limits
|
|
LimitNOFILE=65536
|
|
MemoryLimit=2G
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|