[Unit]
Description=Lemonade Server
Documentation=https://lemonade-server.ai/docs/
After=network-online.target

[Service]
Type=simple
User=lemonade
Group=lemonade
StateDirectory=lemonade
StateDirectoryMode=0750
RuntimeDirectory=lemonade
RuntimeDirectoryMode=0700
WorkingDirectory=%S/lemonade
# Server settings (port, host, models_dir, …) live in config.json, not env vars.
# The env-file drop-in is kept for the few env vars lemond still reads:
#   HF_TOKEN                 — HuggingFace authentication token
#   LEMONADE_API_KEY         — require API-key auth on all routes
#   LEMONADE_ADMIN_API_KEY   — API-key specific to internal routes
EnvironmentFile=-/etc/lemonade/conf.d/*.conf
ExecStart=/usr/bin/lemond
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=5s
KillSignal=SIGINT
AmbientCapabilities=CAP_SYS_RESOURCE

# Security hardening
PrivateTmp=yes
NoNewPrivileges=yes
ProtectSystem=full
ProtectHome=yes
RestrictRealtime=yes
RestrictNamespaces=yes
LockPersonality=yes

[Install]
WantedBy=multi-user.target
