Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use on Linux servers and project updates #15

Open
cairoapcampos opened this issue Nov 1, 2023 · 5 comments
Open

Use on Linux servers and project updates #15

cairoapcampos opened this issue Nov 1, 2023 · 5 comments

Comments

@cairoapcampos
Copy link

I was looking for a solution to backup volumes via Docker CLI. I found Vackup and tested it. I found it interesting because I can use it in bash scripts to backup volumes from different containers on Linux servers. Will this project continue to be updated? I tested the backup of an application volume and a bank volume. Backup and restore worked perfectly!

Do you have any advice on using this tool in a production environment?

@BretFisher
Copy link
Owner

Hey there. I don't think this will need many (or any) updates because 1. it's just bash and 2. it's just basic docker commands that have worked for 10 years without edits.

In real storage, you usually need more than a file copy for backups. Databases all have their own backup tools to ensure you get proper backups, and backup systems usually are on a schedule, do retries, etc. This script isn't meant to replace a full backup system, but just an easy way to copy volumes from one system to another.

@cairoapcampos
Copy link
Author

I was able to create a shell script that uses the vackup script. This way I can backup all volumes on the system. Look:

#!/bin/bash

# Note: Before running this script, install the Vackup command,
# installation information can be found at the link below:
# https://github.com/BretFisher/docker-vackup

clear

## Variables
volumes=$(docker volume ls -q)
dts=$(date +%d%m%y_%H%M%S)
pathroot=/backup
pathbkp=$pathroot/$dts

## Remove subfolders from the backup directory that are more than 7 days old
find $pathroot -mindepth 1 -maxdepth 1 -type d -mtime +7 -exec rm -r {} \;

## Create and enter the backup directory
mkdir $pathbkp && cd $pathbkp

## Backing up volumes and creating backup logs
for volume in $volumes
do
    /usr/local/bin/vackup export $volume $volume.tar.gz | tee log_$volume.txt
done

@cerebrux
Copy link

cerebrux commented Dec 26, 2023

I was able to create a shell script that uses the vackup script. This way I can backup all volumes on the system. Look:

Thanks for your script. I managed to create a systemd service with your script to automate the backup once every day. If anyone is interested : Vackup all

@cairoapcampos
Copy link
Author

@cerebrux I'm very happy to know that my script was useful to you.

@Guiorgy
Copy link
Contributor

Guiorgy commented Feb 7, 2024

In case anybody is interested, I'm using this script to backup all my containers. The main differences are, that the script stops all running containers before copying the volumes and restarting stopped containers, and also that it uses the docker-autocompose script as well to generate a compose file with all containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants