From 4a812e6249e5db1d4b50bce3bebdb97e39a528e8 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Wed, 4 Mar 2026 21:47:28 +0100 Subject: [PATCH] Write better readme Signed-off-by: Nikolai Rodionov --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ build/set_image_metadata | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..5769164 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# MySQL backup container for DB Operator + +Small docker container for creating a backup of a musql database and uploading it to an external storage using rclone. + +Every backup is uploaded twice, once with a **timestamp** and once as **latest**. So you can always download the latest backup. + +There is no clean-up logic, please take care of old backups using external tools, for example bucket retention policies. + +## How to restore + +You need to unzip the backup file and restore it with `mysql` cli: +```shell +$ gzip -dk +$ mysql -u --password= -h -P --database working_namespace_mysql < +``` + +## How to use + +This container is supposed to be used by the DB Operator for setting up backup CronJobs. + +To backup a mysql/mariadb database using this container you need to pass env variables for `mariadb-dump` and for `rclone`: + +**mariadb-dump** variables: + +- **DB_NAME**: A name of a database to back up +- **DB_PORT**: A port on which database is listening +- **DB_HOST**: A database server host +- **DB_PASSWORD_FILE**: A path to a file with a database password (file must be mounted to the container) +- **DB_USER**: User that should perform the backup + +**rclone** variables: + +- **STORAGE_BUCKET**: A name of a bucket/directory that should be used for uploading the backup + +For the rest, please check here: . + +The backend name is hardcoded to 'storage', so your env vars should be prefixed by `RCLONE_CONFIG_STORAGE_` + diff --git a/build/set_image_metadata b/build/set_image_metadata index f341f78..f071238 100755 --- a/build/set_image_metadata +++ b/build/set_image_metadata @@ -21,7 +21,7 @@ org.opencontainers.image.revision=$GITHUB_SHA org.opencontainers.image.vendor=$GITHUB_REPOSITORY_OWNER org.opencontainers.image.license=GNU GENERAL PUBLIC LICENSE v3 org.opencontainers.image.title=$GITHUB_REPOSITORY -org.opencontainers.image.description=Backup databases using pg_dump and upload backups using rclone +org.opencontainers.image.description=Backup databases using mariadb-dump and upload backups using rclone EOF )