Merge pull request #138 from CuzImBisonratte/backup-uptime-kuma

Add Backup & Restore of Uptime Kuma
This commit is contained in:
Christoph 2023-10-09 12:24:51 +02:00 committed by GitHub
commit 890e12a595
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 178 additions and 0 deletions

View file

@ -0,0 +1,89 @@
---
title: Back up & Restore Your Uptime Kuma Instance
description: Learn how to back up and restore your Uptime Kuma instance.
level: beginner
updated_at: 2023-08-16
slug: backup-uptime-kuma
author_name: Konstantin Protzen
author_url: https://github.com/cuzimbisonratte
author_image: https://github.com/cuzimbisonratte.png
author_bio:
tags: [linux, ubuntu, uptime, monitoring, kuma, nodejs, nginx, backup, restore]
netcup_product_url: https://www.netcup.de/bestellen/produkt.php?produkt=2991
language: en
available_languages: [en, de]
---
# Introduction
This tutorial is a follow-up of the tutorial [Setup of Uptime Kuma Standalone on Ubuntu with a Reverse Proxy](https://community.netcup.com/en/tutorials/ubuntu-uptime-kuma-standalone-installation).
This tutorial describes how to back up your Uptime Kuma instance and restore it, if needed.
The time required for this tutorial is about 3-5 minutes.
# Requirements
You need a running Uptime Kuma instance that does not use the Docker setup.
# Step 1 - Backup
1. Log in to your server via SSH.
2. Enter `sudo -s` to get root permissions.
3. Enter your password and press `Enter`.
4. Install the package `zip` (along with `unzip`) with `apt install -y zip unzip`.
5. If a pink window appears, press `Enter` once to continue.
6. Stop the Uptime Kuma service with `systemctl stop uptime-kuma`.
7. Enter `exit` to leave the root shell.
8. Enter `zip -r uptimekuma-backup.zip ./uptime-kuma/data` to create a backup of your Uptime Kuma data.
9. Restart the Uptime Kuma service with `sudo systemctl start uptime-kuma`.
10. Enter `exit` to leave the SSH session.
Now you have a backup of your Uptime Kuma data in the file `uptimekuma-backup.zip` in the home directory of the user you used to log in to your server.
# Step 2 - Restoring a backup
Warning: If you carry out the steps below, your current Uptime Kuma data will be overwritten!
For using this tutorial the backup file needs to be stored in the user's home directory. If it is not there, you can upload it with `scp` or `sftp` to your server.
If it is just the database that is broken, you can restore it easily.
If the entire Uptime Kuma instance is broken, you need to delete the current instance first and then restore the backup. For this purpose, you must delete the current instance using the command `rm -r uptime-kuma` and then reinstall it by following [Step 4 of the installation tutorial](https://community.netcup.com/en/tutorials/ubuntu-uptime-kuma-standalone-installation#step-4---installing-uptime-kuma).
1. Log in to your server via SSH.
2. Enter `sudo systemctl stop uptime-kuma` to get root permissions.
3. Enter your password and press `Enter`.
4. Enter `rm -r uptime-kuma/data` to delete the current Uptime Kuma data.
5. Move the backup to the correct location with `mv uptimekuma-backup.zip uptime-kuma && cd uptime-kuma`.
6. Enter `unzip uptimekuma-backup.zip` to restore the backup.
7. Enter `sudo systemctl start uptime-kuma` to start the Uptime Kuma service.
# Conclusion
Now you know how to back up and restore your Uptime Kuma instance.
Thank you for reading this tutorial.
# License
[MIT](https://github.com/netcup-community/community-tutorials/blob/main/LICENSE)
Copyright (c) 2023 Konstantin Protzen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Contributor's Certificate of Origin
By making a contribution to this project, I certify that:
1. The contribution was created in whole or in part by me and I have the right to submit it under the license indicated in the file; or
2. The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same license (unless I am permitted to submit under a different license), as indicated in the file; or
3. The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
4. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the license(s) involved.

View file

@ -0,0 +1,89 @@
---
title: Sichern & Wiederherstellen deiner Uptime Kuma-Instanz
description: Lerne, wie du deine Uptime Kuma-Instanz sicherst und wiederherstellst.
level: beginner
updated_at: 2023-08-16
slug: backup-uptime-kuma
author_name: Konstantin Protzen
author_url: https://github.com/cuzimbisonratte
author_image: https://github.com/cuzimbisonratte.png
author_bio:
tags: [linux, ubuntu, uptime, monitoring, kuma, nodejs, nginx, sicherung, wiederherstellung, backup, restore]
netcup_product_url: https://www.netcup.de/bestellen/produkt.php?produkt=2991
language: de
available_languages: [en, de]
---
# Einleitung
Dieses Tutorial ist eine Fortsetzung von [Einrichtung von Standalone Uptime Kuma auf Ubuntu mit einem Reverse-Proxy](https://community.netcup.com/de/tutorials/ubuntu-uptime-kuma-standalone-installation).
Dieses Tutorial erklärt dir, wie du deine Uptime Kuma-Instanz sicherst und wiederherstellst.
Die Zeit, die du für das Befolgen dieses Tutorials benötigst, liegt bei etwa 3-5 Minuten.
# Anforderungen
Du benötigst eine Uptime Kuma-Instanz, die nicht per Docker eingerichtet wurde.
# Schritt 1 - Sicherung erstellen
1. Melde dich über SSH bei deinem Server an.
2. Gib `sudo -s` ein, um Root-Rechte zu erhalten.
3. Gib dein Passwort ein und drücke `Enter`.
4. Installiere das Paket `zip` (zusammen mit `unzip`) mittels `apt install -y zip unzip`.
5. Wenn ein rosafarbiges Fenster erscheint, drücke einmal `Enter`, um fortzufahren.
6. Stoppe den Uptime-Kuma-Dienst mit `systemctl stop uptime-kuma`.
7. Gib`exit` ein, um die Root-Shell zu verlassen.
8. Gib `zip -r uptimekuma-backup.zip ./uptime-kuma/data` ein, um ein Backup deiner Uptime-Kuma-Daten zu erstellen.
9. Starte den Uptime Kuma-Dienst mit `sudo systemctl start uptime-kuma` neu.
10. Gib `exit` ein, um die SSH-Sitzung zu verlassen.
Nun hast du ein Backup deiner Uptime Kuma Daten in der Datei `uptimekuma-backup.zip` im Home-Verzeichnis des Benutzers, mit dem du dich auf deinem Server angemeldet hast.
# Schritt 2 - Wiederherstellung einer Sicherung
Warnung! Dieser Ablauf wird deine aktuellen Uptime Kuma-Daten überschreiben!
Um dieses Tutorial nutzen zu können, muss sich die Backup-Datei im Home-Verzeichnis des Benutzers befinden, mit dem du dich anmeldest. Wenn die Datei sich nicht dort befindet, kannst du diese mit `SCP` oder `SFTP` auf deinen Server hochladen.
Wenn nur die Datenbank defekt ist, kannst du diese sehr einfach wiederherstellen.
Wenn die gesamte Uptime Kuma-Instanz defekt ist, musst du zuerst die aktuelle Instanz löschen und dann das Backup wiederherstellen. Du musst zunächst die aktuelle Instanz mit dem Befehl `rm -r uptime-kuma` löschen und kannst sie dann neu installieren, indem du [Schritt 4 des Installations-Tutorials](https://community.netcup.com/de/tutorials/ubuntu-uptime-kuma-standalone-installation#step-4---installing-uptime-kuma) durchführst.
1. Melde dich über SSH an deinem Server an.
2. Gib `sudo systemctl stop uptime-kuma` ein, um Root-Rechte zu erhalten.
3. Gib dein Passwort ein und drücke `Enter`.
4. Gib `rm -r uptime-kuma/data` ein, um die aktuellen Uptime-Kuma-Daten zu löschen.
5. Verschiebe das Backup mit `mv uptimekuma-backup.zip uptime-kuma && cd uptime-kuma` an den richtigen Ort.
6. Gib `unzip uptimekuma-backup.zip` ein, um die Sicherung wiederherzustellen.
7. Gib `sudo systemctl start uptime-kuma` ein, um den Uptime Kuma-Dienst wieder zu starten.
# Fazit
Du kannst nun deine Uptime Kuma-Instanz sichern und wiederherstellen.
Vielen Dank, dass du dieses Tutorial gelesen hast.
# License
[MIT](https://github.com/netcup-community/community-tutorials/blob/main/LICENSE)
Copyright (c) 2023 Konstantin Protzen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Contributor's Certificate of Origin
By making a contribution to this project, I certify that:
1. The contribution was created in whole or in part by me and I have the right to submit it under the license indicated in the file; or
2. The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same license (unless I am permitted to submit under a different license), as indicated in the file; or
3. The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
4. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the license(s) involved.