The .service unit assumed a native systemd install (ExecStart=/usr/bin/node
/opt/prometheus/scripts/snapshot.mjs --upload) that does not match how the
service actually runs on p2pexchange — it is a docker-compose sibling of
Hephaestus's Caddy stack, not a user=prometheus host process.
Two phases now:
1. docker exec into the running prometheus container, render the static
mirror into /data/build (which is in the container's data volume on
the host at /var/lib/docker/volumes/prometheus_data/_data/build).
2. On the host, aws --profile sia-storage s3 sync that directory to
bns/prometheus/, using the operator's existing sia-storage credentials
per [[sia-storage-credentials-location]].
Keeping aws CLI out of the service image is a deliberate trade — adding
it would bloat the image by ~100 MB for a once-a-week job the host is
already set up to run.
Not yet installed on the VPS. To enable:
install -m644 ~/prometheus/deploy/prometheus-snapshot.{service,timer} \
/etc/systemd/system/
systemctl daemon-reload
systemctl enable --now prometheus-snapshot.timer
20 lines
1.1 KiB
Desktop File
20 lines
1.1 KiB
Desktop File
[Unit]
|
|
Description=Prometheus — render + upload the static snapshot to bns/prometheus
|
|
After=docker.service network-online.target
|
|
Wants=network-online.target
|
|
Requires=docker.service
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
# Two phases:
|
|
# 1. Render inside the prometheus container — it already has the DB, the
|
|
# Node service's imports, and the right USER. --upload is deliberately
|
|
# NOT passed; the aws CLI is not installed in the container (adding it
|
|
# bloats the image by ~100 MB for a once-a-week job).
|
|
# 2. Upload from the host, using root's existing sia-storage AWS profile
|
|
# per [[sia-storage-credentials-location]]. The docker-named volume
|
|
# mounts at /var/lib/docker/volumes/prometheus_data/_data; the build
|
|
# dir inside it is what the container just wrote.
|
|
ExecStart=/usr/bin/docker exec prometheus-prometheus-1 node scripts/snapshot.mjs --out /data/build
|
|
ExecStart=/usr/bin/aws --profile sia-storage --endpoint-url https://p2pexchange.silentmode.st:9980 s3 sync /var/lib/docker/volumes/prometheus_data/_data/build/ s3://bns/prometheus/ --delete
|
|
Nice=10
|