macsync/deploy/systemd/mac-sync-server.service
Natalie f9cf50e695
Some checks failed
Swift Build & Test / swift build + test (push) Waiting to run
Server Typecheck & Test / bun typecheck + test (push) Failing after 5m9s
fix(server): unbuffered logging + reject operator token on contact sync
- logger: emit straight to fd 1/2 (unbuffered). The buffered process.std*
  streams block-buffer to a pipe under systemd, so low-volume logs never
  flushed and were invisible.
- /client/imessage/contacts: return 401 (like /sync/batch) when the caller
  presents the operator/service token instead of a device token, instead of
  500ing on a null deviceId downstream.
- systemd unit: reflect the working deploy (root + /root/.bun, Redis
  dependency, file logging since the droplet journald is volatile).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 19:47:18 -04:00

22 lines
704 B
Desktop File

[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