prometheus/deploy/prometheus-snapshot.service

21 lines
1.1 KiB
SYSTEMD
Raw Normal View History

[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