[Unit]
Description=SaltyFace Web App Server (Node.js)
Documentation=https://github.com/saltytech/saltylab-firmware/issues/370
After=network.target
Before=chromium-kiosk.service
Requires=chromium-kiosk.service

[Service]
Type=simple
User=orin
Group=nogroup
WorkingDirectory=/opt/saltybot/app

# Node.js server
ExecStart=/usr/bin/node server.js --port 3000 --host 0.0.0.0

# Environment
Environment="NODE_ENV=production"
Environment="NODE_OPTIONS=--max-old-space-size=256"

# Restart policy
Restart=on-failure
RestartSec=3s

# Resource limits
MemoryMax=256M
CPUQuota=50%

# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=salty-face-server

# Security
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=yes
ReadWritePaths=/opt/saltybot/logs

[Install]
WantedBy=multi-user.target
