smartbotic-database.service 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. [Unit]
  2. Description=Smartbotic Database Service
  3. After=network.target
  4. [Service]
  5. # v1.7.5: Type=notify so dependents block at startup until the service is
  6. # *actually* ready (recovery complete + migrations applied + gRPC listening),
  7. # not just "process spawned." Pre-1.7.5 this was Type=simple, which made
  8. # `After=smartbotic-database.service` on consumers ineffective: tools,
  9. # gateway, server etc. would launch immediately and silently fall back to
  10. # defaults when their startup DB reads timed out against an in-recovery
  11. # database. The service code already calls `sd_notify(READY=1)` at the
  12. # correct point in `service/src/main.cpp` after `service.start()`; with
  13. # Type=notify systemd actually waits for that signal before considering
  14. # the unit active and unblocking dependents.
  15. Type=notify
  16. NotifyAccess=main
  17. # Recovery on a large dataset (700k+ docs, multi-MB WAL) routinely takes
  18. # 60–90s. Default systemd start timeout (90s) is too tight; bump to 5 min.
  19. # The service emits `EXTEND_TIMEOUT_USEC=` during long recovery anyway, but
  20. # the static cap is the safety net.
  21. TimeoutStartSec=300
  22. User=smartbotic-db
  23. Group=smartbotic-db
  24. ExecStart=/usr/bin/smartbotic-database --config /etc/smartbotic-database/config.json
  25. WorkingDirectory=/var/lib/smartbotic-database
  26. Restart=on-failure
  27. RestartSec=3
  28. TimeoutStopSec=30
  29. LimitNOFILE=65536
  30. [Install]
  31. WantedBy=multi-user.target