[Unit]
Description=Padelnomics Landing Zone Backup to R2
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
User=padelnomics_service
EnvironmentFile=/opt/padelnomics/.env
Environment=LANDING_DIR=/data/padelnomics/landing
ExecStart=/usr/bin/rclone sync ${LANDING_DIR} :s3:${LITESTREAM_R2_BUCKET}/padelnomics/landing \
    --s3-provider Cloudflare \
    --s3-access-key-id ${LITESTREAM_R2_ACCESS_KEY_ID} \
    --s3-secret-access-key ${LITESTREAM_R2_SECRET_ACCESS_KEY} \
    --s3-endpoint https://${LITESTREAM_R2_ENDPOINT} \
    --s3-no-check-bucket \
    --exclude ".state.sqlite*"

StandardOutput=journal
StandardError=journal
SyslogIdentifier=padelnomics-landing-backup
