smartbotic-db.service 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. [Unit]
  2. Description=SmartBotic Database Service
  3. Documentation=https://github.com/smartbotic/smartbotic-crm
  4. After=network.target
  5. Wants=network-online.target
  6. [Service]
  7. Type=simple
  8. User=smartbotic
  9. Group=smartbotic
  10. WorkingDirectory=/opt/smartbotic
  11. # Main executable
  12. ExecStart=/opt/smartbotic/bin/smartbotic-db --config /etc/smartbotic/smartbotic-db.yaml
  13. # Graceful shutdown handling
  14. ExecStop=/bin/kill -SIGTERM $MAINPID
  15. TimeoutStopSec=30
  16. KillMode=mixed
  17. KillSignal=SIGTERM
  18. # Restart policy
  19. Restart=on-failure
  20. RestartSec=5
  21. StartLimitIntervalSec=60
  22. StartLimitBurst=3
  23. # Security hardening
  24. NoNewPrivileges=yes
  25. ProtectSystem=strict
  26. ProtectHome=yes
  27. PrivateTmp=yes
  28. PrivateDevices=yes
  29. ProtectKernelTunables=yes
  30. ProtectKernelModules=yes
  31. ProtectControlGroups=yes
  32. RestrictRealtime=yes
  33. RestrictSUIDSGID=yes
  34. LockPersonality=yes
  35. # Allow write access to data directory
  36. ReadWritePaths=/var/lib/smartbotic
  37. # Environment variables for secrets (can be overridden in drop-in files)
  38. # Create /etc/systemd/system/smartbotic-db.service.d/encryption.conf with:
  39. # [Service]
  40. # Environment="SMARTBOTIC_DB_ENCRYPTION_KEY=your-base64-key"
  41. Environment="SMARTBOTIC_DB_DATA_DIR=/var/lib/smartbotic"
  42. Environment="SMARTBOTIC_DB_LOG_LEVEL=info"
  43. # Logging
  44. StandardOutput=journal
  45. StandardError=journal
  46. SyslogIdentifier=smartbotic-db
  47. [Install]
  48. WantedBy=multi-user.target