There's a new tool that's been talked about lately called copyparty. It's a "simple" fileserver with tons of features and neat tricks. This is a quick guide on my configuration to get it working from an SMB fileshare, behind Pangolin/Traefik (so it's exposed but not too exposed).
Docker Compose File
services:
copyparty:
image: copyparty/iv # https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker#editions
networks:
- pangolin-public
volumes:
- data:/w
- config:/cfg
- db:/copyparty_db
config_backup:
image: offen/docker-volume-backup:latest
environment:
BACKUP_FILENAME: copyparty-config-backup-%Y-%m-%dT%H-%M-%S.tar.gz
BACKUP_PRUNING_PREFIX: copyparty-config-backup-
BACKUP_RETENTION_DAYS: '7'
volumes:
- config:/backup/my-app-backup:ro
- offen_backup_config:/archive
deploy:
placement:
constraints:
- node.labels.copyparty-config-data == true
db_backup:
image: offen/docker-volume-backup:latest
environment:
BACKUP_FILENAME: copyparty-db-backup-%Y-%m-%dT%H-%M-%S.tar.gz
BACKUP_PRUNING_PREFIX: copyparty-db-backup-
BACKUP_RETENTION_DAYS: '7'
volumes:
- db:/backup/my-app-backup:ro
- offen_backup_db:/archive
deploy:
placement:
constraints:
- node.labels.mac-mini != true
- node.labels.copyparty-config-data == true
networks:
pangolin-public:
external: true
volumes:
config:
db:
data:
driver_opts:
type: cifs
o: username=user,password=password,sec=ntlmssp,rw
device: //some_network_volume/copyparty_data
offen_backup_config:
driver_opts:
type: cifs
o: username=user,password=password,sec=ntlmssp,rw
device: //some_network_volume/copyparty_config_backup
offen_backup_db:
driver_opts:
type: cifs
o: username=user,password=password,sec=ntlmssp,rw
device: //some_network_volume/copyparty_db_backup
copyparty Config
# first declare the accounts just once:
[accounts]
myuser: mypassword
# (inline comments are OK if there is 2 spaces before the #)
[global]
# i: 127.0.0.1 # listen on 127.0.0.1 only,
p: 3923 # listen on ports 8086 and 3939
e2dsa # enable file indexing and filesystem scanning
e2ts # and enable multimedia indexing
z, qr # and zeroconf and qrcode (you can comma-separate arguments)
dedup
xff-src: 10.0.0.0/16
dbpath: /copyparty_db
# create volumes:
[/] # create a volume at "/" (the webroot), which will
. # share the contents of "." (the current directory)
accs:
rwd: myuser # the user "myuser" gets read-write-delete
Explanations
Why all the docker volumes?
In both config
and db
lives a SQLite database. These require file locking and therefor don't play nice when living on an SMB fileshare. So we keep it on the local machine while mounting the main data volume as normal.
Why a seperate DB volume?
If you look at the docs, it does not mention a db volume or a /copyparty_db
directory. Normally, a .hist/
directory is made in the main data volume you mount to store indexes, thumbnails, etc. And since our data volume is a mounted share, it fails to create that database. An explanation for the error (and a fix) can be found here:
* VirtualBox: sqlite throws `Disk I/O Error` when running in a VM and the up2k database is in a vboxsf
* use `--hist` or the `hist` volflag (`-v [...]:c,hist=/tmp/foo`) to place the db and thumbnails inside the vm instead
* or, if you only want to move the db (and not the thumbnails), then use `--dbpath` or the `dbpath` volflag
* also happens on mergerfs, so put the db elsewhere
And so we move the db to another location, thumbnails and other generated files stay on the smb mounted volume.
Why is the listening IP commented out?
# i: 127.0.0.1 # listen on 127.0.0.1 only,
This breaks traefik, see below.
What is the xff-src setting?
xff-src: 10.0.0.0/16
This is the IP traffic comes from, in the eyes of copyparty. The logs told me to set this, so I did. Off the top of my head, this is traefik and copypart seems skeptical running behind a reverse proxy.
What port does copyparty listen on?
A lot. But their web port for http/https traffic is 3923