Best way to backup seafile docker installation?

Hey guys, I have a seafile docker container running on my ubuntu server and I am pretty satisfied so far. Now I want to have a backup strategy using my second server. I am pretty new to linux servers and especially docker.

I also got a custom data directory on a secondary hard drive by altering the launcher file. I am already backing up this data directory using rsync but from what I understand this is pretty useless without the mysql data. Normally I would perform a mysql dump but with docker this seems to be pretty tough.

So, whats your backup strategy for seafile docker?

So far I can only think of these ways:

  1. Make an image backup of both drives - seems pretty risky as both of them are running

  2. rsync the whole file system of both drives to the remote server - basically creating a copy of the server

  3. log in to the docker container creating a mysql dump and getting it to my remote server somehow - must be an easier way

  4. Using one of the ways descibed on the docker website: https://docs.docker.com/engine/tutorials/dockervolumes/#backup-restore-or-migrate-data-volumes - to be honest, I think i need some help there…:wink:

  5. using a tool like docker-backup or conplicity - any experiences here?

thank you :slight_smile:

1 Like

Is it possible that by moving the data folder to the secondary drive, I also moved the docker volumes (db etc.) there? So my rsync strategy isnt that insufficent at all…

inspecting the docker volumes of the seafile container shows this:

[
    {
        "Destination": "/shared",
        "Mode": "",
        "Propagation": "",
        "RW": true,
        "Source": "/media/seafile-data",
        "Type": "bind"
    },
    {
        "Destination": "/var/lib/mysql",
        "Mode": "",
        "Propagation": "",
        "RW": true,
        "Source": "/media/seafile-data/db",
        "Type": "bind"
    },
    {
        "Destination": "/var/log",
        "Mode": "",
        "Propagation": "",
        "RW": true,
        "Source": "/media/seafile-data/logs/var-log",
        "Type": "bind"
    },
    {
        "Destination": "/root/.bash_history",
        "Mode": "",
        "Propagation": "",
        "RW": true,
        "Source": "/media/seafile-data/.bash_history",
        "Type": "bind"
    }
]

So I all the dynamic data is stored on the secondary drive an therefore backed up already.

Any opinions about this?

As backup I’d dump the database and copy /media/seafile-data afterwards. Such a backup should always be restorable, also in case there is new data being added in between creating the database dump and copying the data. Just make sure the garbage collector is not running while copying seafile-data.

1 Like

Well 4 years later :slight_smile:

I want to set up incremental rsync daily, should i stop the gc and restart or something?

The gc only runs when you start it. You don’t want to run it while the backup runs.

Oh wow thanks man, I feel like I woke up an ancient :slight_smile: from a long ago.

If you have a min, I have another question. I plan on doing incremental rsync for the seafile data. And since the seafile stores data in datablocks is incremental rsync a sane way to do it, seafile data files will not be exported to ext4. Should there be any problems as opposed to running a full backup daily and removing the one from yesterday.

I guess I found the answer

https://seafile.readthedocs.io/en/latest/backup/backup-rsync/

Blocks/fs/commits are immutable, so a file backed up once does not need to be copied, again.

Thanks man, I did have to research all of this and now I’m sure it’s good. I knew rsync was good, but I wasn’t sure exactly how it works, today I know more.