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

Automatic / periodical backups #477

Open
jtagcat opened this issue Sep 25, 2021 · 7 comments
Open

Automatic / periodical backups #477

jtagcat opened this issue Sep 25, 2021 · 7 comments
Labels
area:deployment related to how uptime kuma can be deployed area:settings Related to Settings page and application configration feature-request Request for new features to be added

Comments

@jtagcat
Copy link
Contributor

jtagcat commented Sep 25, 2021

Allow making backups automatically, saving to a specified local storage directory.

Cleanup may be left to the user or implemented with 'keep last n backups'.

@jtagcat jtagcat added the feature-request Request for new features to be added label Sep 25, 2021
@Mellowor
Copy link

Mellowor commented Oct 3, 2021

Hi, i would like to try implement this feature, could you assign it to me @louislam ? Also this is one of my first contributions do you have some specific advice beyond the contribution file?

@louislam
Copy link
Owner

louislam commented Oct 3, 2021

Hi, i would like to try implement this feature, could you assign it to me @louislam ? Also this is one of my first contributions do you have some specific advice beyond the contribution file?

Thank you so much!

But I would not recommend to implement this in the current stage, because the backup is done via the frontend in the current implementation, which means that you have to rewrite the backup feature in backend before you start to implement this feature. I don't think it is an easy task.

Also, as most Uptime Kuma users are able to access the machine, using any existing backup tools such as rsync/zip/cron is more reliable and flexible in my opinion.

@b-a0
Copy link

b-a0 commented May 22, 2023

If you are using docker you can backup the volume with the data periodically using the offen/docker-volume-backup image. It can take care of writing to remote storage, pruning old back-ups and sending notifications in case of backup failure.

The full compose file would look something like:

version: '3'

services:
  uptime:
    container_name: uptime
    image: louislam/uptime-kuma:1
    volumes:
      - uptime-kuma:/app/data
    environment:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    labels:
      - docker-volume-backup.stop-during-backup=true
    restart: always

  backup-kuma:
    container_name: backup-kuma
    image: offen/docker-volume-backup:v2.27.0
    restart: always
    env_file: ./.backup.env
    volumes:
      - uptime-kuma:/backup/uptime-kuma_mount:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /home/user/backups:/archive
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro

With the .backup.env containing:

BACKUP_ARCHIVE="/archive"
BACKUP_CRON_EXPRESSION="0 0 * * 0"
BACKUP_FILENAME="uptime-backup-%Y-%m-%dT%H-%M-%S.tar.gz"
BACKUP_PRUNING_PREFIX="uptime-backup-"
BACKUP_RETENTION_DAYS="31"
NOTIFICATION_URLS=ntfy://ntfy.sh/example_uptime_backup_topic?title=Uptime%20Kuma%20backup

Above example would backup the volume uptime-kuma to the location /home/user/backups on the docker host, every Sunday at midnight. It would keep backups of the past 31 days, after which it will prune older backups. In case of error it sends a notification via ntfy.sh.

No affiliation, just a happy user of the volume-backup image.

@CommanderStorm CommanderStorm added area:deployment related to how uptime kuma can be deployed area:settings Related to Settings page and application configration labels Dec 7, 2023
@Genc

This comment was marked as off-topic.

@CommanderStorm

This comment was marked as resolved.

@Genc

This comment was marked as resolved.

@CommanderStorm

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:deployment related to how uptime kuma can be deployed area:settings Related to Settings page and application configration feature-request Request for new features to be added
Projects
None yet
Development

No branches or pull requests

6 participants