# Continuous off-box replication of the fleet's SQLite files under /data to S3 # via litestream (WAL shipping; the fleet is single-writer-per-DB by design, # which is exactly litestream's model). /etc/litestream.yml is GENERATED by # `carlos ops litestream` — never hand-edit it; re-run the verb after adding or # removing an instance. Hibernating routes are excluded from the config (their # DBs are replicated by the activator's per-host lease — two replicators on one # DB was Eleven's lesson). Credentials live in /data/litestream.env (0600). # Ported from titogo's deploy/systemd/titogo-litestream.service. [Unit] Description=carlos litestream (replicate /data SQLite files to S3) Documentation=https://litestream.io After=network-online.target data-instances.mount Wants=network-online.target [Service] ExecStart=/usr/local/bin/litestream replicate -config /etc/litestream.yml EnvironmentFile=/data/litestream.env User=carlos Group=carlos CapabilityBoundingSet= NoNewPrivileges=yes ProtectSystem=strict # litestream checkpoints the databases it replicates, so it needs /data rw. ReadWritePaths=/data ProtectHome=yes PrivateTmp=yes PrivateDevices=yes RestrictAddressFamilies=AF_INET AF_INET6 MemoryDenyWriteExecute=yes MemoryMax=256M CPUWeight=50 Restart=always RestartSec=2 [Install] WantedBy=multi-user.target