13 KiB
Setting Up Storage
💬 We offer consulting services to set up, secure, and maintain ArchiveBox on your preferred storage provider.
We use this revenue (from corporate clients who can afford to pay) to support open source development and keep ArchiveBox free.
ArchiveBox supports a wide range of local and remote filesystems using rclone and/or Docker storage plugins. The examples below use Docker Compose bind mounts to demonstrate the concepts, you can adapt them to your OS and environment needs.
Example docker-compose.yml storage setup:
services:
archivebox:
# ...
volumes:
# your index db, config, logs, etc. should be stored on a local SSD (usually <10Gb)
- ./data:/data
# but bulk archive/ content can be located on an HDD or remote filesystem
- /mnt/archivebox-s3/data/archive:/data/archive
Related Docs
- README: Archive Layout
- Wiki: Usage (Disk Layout)
- Wiki: Usage (Large Archives)
- Wiki: Security Overview (Output Folder)
- Wiki: Publishing Your Archive
- Wiki: Upgrading or Merging Archives
- Wiki: Troubleshooting Filesystem Issues
Supported Local Filesystems
EXT4 (default on Linux), APFS (default on macOS)
Tip
These default filesystems are fully supported by ArchiveBox on Linux and macOS (w/wo Docker).
ZFS (recommended for best experience on Linux/BSD) ⭐️
Tip
This is the recommended filesystem for ArchiveBox on Linux, macOS, and BSD (w/wo Docker).
apt install zfsutils-linux
Provides RAID, compression, encryption, deduping, 0-cost point-in-time backups, remote sync, integrity verification, and more...
- https://openzfs.github.io/openzfs-docs/
- https://openzfs.github.io/openzfs-docs/man/v2.2/8/zpool-create.8.html
- https://openzfs.github.io/openzfs-docs/man/v2.2/8/zfs-create.8.html
- https://docs.docker.com/storage/storagedriver/zfs-driver/
- https://www.ixsystems.com/blog/fast-dedup-is-a-valentines-gift-to-the-openzfs-and-truenas-communities/
set -euo pipefail; apt-get update -qq
apt-get install -y zfsutils-linux
command -v zpool
command -v zfs
zpool --version
zfs --version
zpool create --help >/dev/null
zfs create --help >/dev/null
work_dir="$(mktemp -d)"
disk_one="$work_dir/disk1.img"
disk_two="$work_dir/disk2.img"
truncate -s 128M "$disk_one"
truncate -s 128M "$disk_two"
test "$(stat -c %s "$disk_one")" -eq 134217728
test "$(stat -c %s "$disk_two")" -eq 134217728
printf '%s\n' 'zpool create -f -O mountpoint=/mnt/archivebox archivebox /dev/disk/by-uuid/disk1 /dev/disk/by-uuid/disk2'
printf '%s\n' 'zfs create -o mountpoint=/mnt/archivebox/data archivebox/data'
printf '%s\n' 'zfs create -o encryption=on -o keysource=passphrase,prompt archivebox/encrypted'
zpool status >/dev/null 2>&1 || test ! -e /dev/zfs
test -d "$work_dir"
rm -f "$disk_one"
rm -f "$disk_two"
rmdir "$work_dir"
test ! -e "$work_dir"
NTFS, HFS+, BTRFS
Warning
These filesystems are likely supported, but are not officially tested.
EXT2, EXT3, FAT32, exFAT
Caution
Not recommended. Cannot store files >4GB or more than 31k ~ 65k Snapshot entries due to directory entry limits.
Supported Remote Filesystems
ArchiveBox supports many common types of remote filesystems using RClone, FUSE, Docker Storage providers, and Docker Volume Plugins.
The data/archive/ subfolder contains the bulk archived content, and it supports being stored on a slower remote server (SMB/NFS/SFTP/etc.) or object store (S3/B2/R2/etc.). For data integrity and performance reasons, the rest of the data/ directory (data/ArchiveBox.conf, data/logs, etc.) must be stored locally while ArchiveBox is running.
Important
data/index.sqlite3is your main archive DB, it must be on a fast, reliable, local filesystem which supports FSYNC (SSD/NVMe recommended for best experience).
Tip
If you use a remote filesystem, you should switch ArchiveBox's search backend from
ripgreptosonic(orFTS5).
(ripgrepscans over every byte in the archive to do each search, which is slow and potentially costly on remote cloud storage)
NFS (Docker Driver)
docker-compose.yml:
services:
archivebox:
volumes:
- ./data:/data
- archivebox-archive:/data/archive
volumes:
archivebox-archive:
driver_opts:
type: "nfs"
o: "addr=some-remote-server.example.com,nolock,soft,rw,nfsvers=4"
device: ":/archivebox-archive"
SMB / Ceph (Docker CIFS Driver)
docker-compose.yml:
services:
archivebox:
volumes:
- ./data:/data
- archivebox-archive:/data/archive
volumes:
archivebox-archive:
driver: local
driver_opts:
type: cifs
device: "//some-remote-server.example.com/archivebox-archive"
o: "username=XXX,password=YYY,uid=911,gid=911"
Amazon S3 / Backblaze B2 / Google Drive / etc. (RClone)
set -euo pipefail; apt-get update -qq; apt-get install -y rclone fuse3
fuse_conf_backup="$(mktemp)"; test ! -e /etc/fuse.conf || cp /etc/fuse.conf "$fuse_conf_backup"
trap 'if test -s "$fuse_conf_backup"; then cp "$fuse_conf_backup" /etc/fuse.conf; else rm -f /etc/fuse.conf; fi' EXIT
grep -qxF user_allow_other /etc/fuse.conf 2>/dev/null || printf '%s\n' user_allow_other >> /etc/fuse.conf
rclone version; fusermount3 --version
Then define your remote storage config ~/.config/rclone/rclone.conf:
Tip
You can also create
rclone.confusing the RClone Web GUI:rclone rcd --rc-web-gui
# Example rclone.conf using Amazon S3 for storage:
[archivebox-s3]
type = s3
provider = AWS
access_key_id = XXX
secret_access_key = YYY
region = us-east-1
RClone Config Examples
- SMB / Ceph / SFTP / FTP / WebDAV (e.g. Nextcloud)
- Google Drive / Dropbox / OneDrive
- Amazon S3 / Backblaze B2 / Cloudflare R2 / DigitalOcean Spaces
- Google Cloud Storage / Azure Blob / Azure Files
- Storj / Sia / Archive.org Storage
- And many more...
Bonus:
- Set up gzip compression: https://rclone.org/compress/
- Set up file encryption: https://rclone.org/crypt/
- Set up hashing engine: https://rclone.org/hasher/
Option A: Running RClone on Bare Metal host
- If Needed: Transfer any existing local archive data to the remote volume first
set -euo pipefail; source_archive="$(mktemp -d)"; remote_archive="$(mktemp -d)"; printf 'ArchiveBox storage test\n' > "$source_archive/snapshot.txt"; rclone sync --fast-list --transfers 20 "$source_archive/" "$remote_archive/"
cmp "$source_archive/snapshot.txt" "$remote_archive/snapshot.txt"; mv "$source_archive" "$source_archive.localbackup"; test -f "$source_archive.localbackup/snapshot.txt"
- Mount the remote storage volume as FUSE filesystem
rclone mount
--allow-other \ # essential, allows Docker to access FUSE mounts
--uid 911 --gid 911 \ # 911 is the default used by ArchiveBox
--vfs-cache-mode=full \ # cache both file metadata and contents
--transfers=16 --checkers=4 \ # use 16 threads for transfers & 4 for checking
archivebox-s3/data/archive:/opt/archivebox/data/archive # remote:local
See here for full more detailed instructions here: RClone Documentation: The rclone mount command
Tip
You can use any RClone FUSE mounts as a normal volumes (bind mount) for Docker ArchiveBox, typically no storage plugin is needed as long as
allow-otheris setup properly.
docker run -v $PWD:/data -v /opt/archivebox/data/archive:/data/archive
docker-compose.yml:
services:
archivebox:
# ...
volumes:
- ./data:/data
- /opt/archivebox/data/archive:/data/archive
Option B: Running RClone with Docker Storage Plugin
This is only needed if you are unable to Option A for compatibility or performance reasons, or if you prefer defining your remote storage config in docker-compose.yml instead of rclone.conf.
See here for full instructions: RClone Documentation: Docker Plugin
- First, install the Rclone Docker Volume Plugin for your CPU architecture (e.g.
amd64orarm64):
set -euo pipefail; installed_rclone_plugin=false; docker plugin inspect rclone >/dev/null 2>&1 || { docker plugin install rclone/docker-volume-rclone:amd64 --grant-all-permissions --alias rclone; installed_rclone_plugin=true; }; trap 'if [ "$installed_rclone_plugin" = true ]; then docker plugin disable --force rclone; docker plugin rm rclone; fi' EXIT
docker plugin inspect rclone --format '{{.Name}} {{.Enabled}}' | grep -q '^rclone true$'
docker-compose.yml:
services:
archivebox:
volumes:
- ./data:/data
- archivebox-s3:/data/archive
volumes:
archivebox-s3:
driver: rclone
driver_opts:
remote: 'archivebox-s3/data/archive'
allow_other: 'true'
vfs_cache_mode: full
poll_interval: 0
uid: 911
gid: 911
transfers: 16
checkers: 4
To start the container and verify the filesystem is accessible within it:
set -euo pipefail; docker_data="$(mktemp -d)"; docker run --rm -v "$docker_data:/data" archivebox-docs-ci init; docker run --rm -v "$docker_data:/data" archivebox-docs-ci /bin/bash -c 'ls -lah /data/archive/ | tee /data/archive/.write_test.txt'; test -s "$docker_data/archive/.write_test.txt"
---