Something went wrong. Try again.
A free, open-source, self-hosted place to write a novel.
Something went wrong. Try again.
2.5 kB · 71 lines
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172# Fablewright under systemd, for a bare Node install with no container.## 1. Build: pnpm install --frozen-lockfile && pnpm build# 2. Copy: build/, node_modules/, package.json, server.js, scripts/ and drizzle/ to /opt/fablewright# 3. Install: cp deploy/fablewright.service /etc/systemd/system/# systemctl daemon-reload && systemctl enable --now fablewright## The unit runs as its own unprivileged user, keeps its state in# /var/lib/fablewright, and restarts on failure. It never runs as root.## Backups run from a separate timer. See deploy/fablewright-backup.service and# docs/operations.md.
[Unit]Description=Fablewright, a self-hosted novel-writing platformDocumentation=https://tangled.org/katsuricata.com/FablewrightAfter=network-online.targetWants=network-online.target
[Service]Type=simpleUser=fablewrightGroup=fablewrightWorkingDirectory=/opt/fablewright
# The database and the signing secret live here, and here only.StateDirectory=fablewrightStateDirectoryMode=0750
Environment=NODE_ENV=productionEnvironment=PORT=3000Environment=HOST=127.0.0.1Environment=DATABASE_URL=file:/var/lib/fablewright/fablewright.dbEnvironment=BODY_SIZE_LIMIT=101M# Set this to the public URL when a proxy terminates TLS in front of the app.# Prefer it over the forwarded headers: it pins the origin the app advertises.# Environment=ORIGIN=https://fable.example.com# Passkeys use ORIGIN. Set this only when ORIGIN is empty for alias domains.# The advertised address is also what a reset mail carries, so mail needs one# of the two.# Environment=INSTANCE_ORIGIN=https://fable.example.com# If the origin cannot be pinned, trust the proxy instead. Use this only when# every request arrives through the proxy and the app is not directly reachable.# Environment=TRUST_PROXY=1
# A long writing session keeps a connection open; do not cut it short.# SHUTDOWN_TIMEOUT gives in-flight saves time to land.Environment=SHUTDOWN_TIMEOUT=30Environment=KEEP_ALIVE_TIMEOUT=65
ExecStart=/usr/bin/node /opt/fablewright/server.jsRestart=on-failureRestartSec=5
# Hardening. The app needs its own state directory and nothing else.NoNewPrivileges=yesPrivateTmp=yesPrivateDevices=yesProtectSystem=strictProtectHome=yesProtectKernelTunables=yesProtectKernelModules=yesProtectControlGroups=yesRestrictAddressFamilies=AF_INET AF_INET6 AF_UNIXRestrictNamespaces=yesLockPersonality=yesMemoryDenyWriteExecute=yesReadWritePaths=/var/lib/fablewright
[Install]WantedBy=multi-user.target