[Unit]
Description=Mac Sync Server
After=network.target redis-server.service
Wants=redis-server.service

[Service]
Type=simple
# Runs as root on the backend droplet using the root-owned bun install — matches
# the other services on that host (no dedicated service user is provisioned).
User=root
WorkingDirectory=/opt/mac-sync-server
ExecStart=/root/.bun/bin/bun run src/main.ts
Restart=on-failure
RestartSec=5
Environment=NODE_ENV=production
EnvironmentFile=/etc/mac-sync-server/env
# journald on this droplet is volatile and captures nothing, so log to a file.
StandardOutput=append:/var/log/mac-sync-server.log
StandardError=append:/var/log/mac-sync-server.log

[Install]
WantedBy=multi-user.target
