132bbcafbf
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
45 lines
1.5 KiB
Bash
Executable File
45 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# Mount the Hetzner Object Storage bucket via rclone, then run icloudpd writing
|
|
# into it. rclone is configured entirely from RCLONE_CONFIG_HZ_* env vars.
|
|
set -e
|
|
|
|
MNT=/mnt/photos
|
|
mkdir -p "$MNT"
|
|
|
|
echo "[entrypoint] mounting hz:${BUCKET}/library at ${MNT}"
|
|
# The cache (bind-mounted at /cache on the root disk) buffers icloudpd's fast
|
|
# downloads against the slow US->EU upload. For an 839G library that buffer can
|
|
# exceed any disk, so --vfs-cache-min-free-space is the critical knob: rclone keeps
|
|
# this much free on the cache disk and applies BACKPRESSURE (throttles writes /
|
|
# icloudpd) rather than overflowing. --vfs-cache-max-size is a secondary cap.
|
|
# (3 disk-fill incidents on 2026-06-06/07 before this was added; a host watchdog
|
|
# auto-stops this container as a hard backstop if root ever crosses 85%.)
|
|
mkdir -p /cache
|
|
rclone mount "hz:${BUCKET}/library" "$MNT" \
|
|
--cache-dir /cache \
|
|
--vfs-cache-mode writes \
|
|
--vfs-cache-max-size "${VFS_CACHE:-30G}" \
|
|
--vfs-cache-min-free-space "${VFS_MIN_FREE:-50G}" \
|
|
--vfs-cache-max-age 2m \
|
|
--vfs-cache-poll-interval 20s \
|
|
--vfs-write-back 5s \
|
|
--dir-cache-time 24h \
|
|
--transfers 12 \
|
|
--daemon
|
|
|
|
# wait for the mount to come up
|
|
i=0
|
|
until mountpoint -q "$MNT"; do
|
|
i=$((i+1)); [ "$i" -gt 30 ] && echo "[entrypoint] mount failed" && exit 1
|
|
sleep 1
|
|
done
|
|
echo "[entrypoint] mount ready; starting icloudpd"
|
|
|
|
exec /app/icloudpd \
|
|
--username "$APPLE_ID" \
|
|
--cookie-directory /cookies \
|
|
--directory "$MNT" \
|
|
--folder-structure "{:%Y/%m}" \
|
|
--watch-with-interval "${INTERVAL:-21600}" \
|
|
--no-progress-bar
|