Skip to content

Commit 1bdf0ae

Browse files
authored
feat: disaster recovery docs (#99)
1 parent 992c747 commit 1bdf0ae

File tree

6 files changed

+728
-16
lines changed

6 files changed

+728
-16
lines changed

.cspell.json

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
{
22
"version": "0.1",
33
"allowCompoundWords": true,
4-
"enabledLanguageIds": [
5-
"json",
6-
"jsonc",
7-
"markdown",
8-
"yaml",
9-
"yml"
10-
],
11-
"ignoreRegExpList": [
12-
"/'s\\b/"
13-
],
4+
"enabledLanguageIds": ["json", "jsonc", "markdown", "yaml", "yml"],
5+
"ignoreRegExpList": ["/'s\\b/"],
146
"ignoreWords": [
157
"AGE-SECRET-KEY-1KTYK6RVLN5TAPE7VF6FQQSKZ9HWWCDSKUGXXNUQDWZ7XXT5YK5LSF3UTKQ",
168
"FPpLvZyAdAmuzc3N",
@@ -112,7 +104,10 @@
112104
"favourite",
113105
"WPUE",
114106
"wsbtpg",
115-
"uxqf"
107+
"uxqf",
108+
"xvjf",
109+
"initdb",
110+
"creds"
116111
],
117112
"language": "en",
118113
"words": [
@@ -179,6 +174,7 @@
179174
"prio",
180175
"rabbitmq",
181176
"rbac",
177+
"rclone",
182178
"redkubes",
183179
"rego",
184180
"repos",
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
slug: gitea
3+
title: Gitea repositories and database
4+
sidebar_label: Gitea
5+
---
6+
## Introduction
7+
8+
Gitea stores the platform configuration (in the `values` repository), the workload catalog (in the `charts` repository), and user-created repositories.
9+
10+
The recovery procedure described here uses the application-level backup of Gitea, i.e. using the `gitea dump` command line. This includes a current SQL dump of the database as well as all repositories and data. However, [Gitea documentation](https://docs.gitea.com/administration/backup-and-restore) recommends different methods for restoring the database, due to potential compatibility issues.
11+
12+
A restore using this backup is advised if for some reason only Gitea has been affected by a severe operational event leading to data corruption or loss. It is also possible to restore the complete the database or single repositories. Be aware that after a partial restore there may be mismatches between the repository information and the database.
13+
14+
## Retrieving backups
15+
16+
When uploading and storing backups in the configured object storage bucket, there is also a local retention of the backups on a local volume for one day. After the local retention has expired, archives can be retrieved from the remote storage.
17+
18+
Note that `rclone` is installed on the first time upload of a Gitea backup. If not present, it can be obtained from the releases page at https://github.com/rclone/rclone/releases/. Following variables such as `$BUCKET_NAME` or storage authentication are pre-configured in the container, so they do not need to be changed.
19+
20+
```sh
21+
##
22+
## In the local terminal
23+
##
24+
kubectl exec -it -n gitea gitea-0 -- /bin/bash
25+
26+
##
27+
## The following to be run in the remote container
28+
##
29+
30+
## If needed, obtain and install Rclone
31+
mkdir -p /backup/.bin
32+
cd /backup/.bin
33+
curl -fsSL -o rclone.zip https://github.com/rclone/rclone/releases/download/v1.69.0/rclone-v1.69.0-linux-amd64.zip
34+
unzip -oj rclone.zip
35+
cd /backup
36+
37+
## Optional, not required if backup is available locally
38+
.bin/rclone lsf gitea:/$BUCKET_NAME # List files
39+
.bin/rclone copy gitea:/$BUCKET_NAME/<backup-name>.tar.bz2 /backup/ # Retrieve file from remote
40+
41+
## Extract the backup
42+
mkdir restore
43+
tar xvjf <backup-name>.tar.bz2 -C restore
44+
cd restore
45+
```
46+
47+
## Restoring a single repository
48+
49+
Repositories are stored in the mounted container path `/data/git/gitea-repositories`, with the owning user or organization as a subdirectory. To restore a single repository, find the backup in the backup's `data/repos/<owner>` directory and copy it over to `/data/git/gitea-repositories/<owner>`.
50+
51+
Note it is not recommended to restore the `otomi/values` repository with this method after restoring a full cluster.
52+
53+
```sh
54+
## ... commands above to obtain and extract the backup
55+
cp -R repos/otomi/charts.git /data/git/gitea-repositories/otomi/
56+
```
57+
58+
## Other assets
59+
60+
Gitea file assets such as avatar images are to be found in the `data` directory of the backup. Similarly, they can be copied to the `/data/` subdirectory as needed, e.g.
61+
62+
```sh
63+
## ... commands above to obtain and extract the backup
64+
cp -R data/avatars /data/
65+
```
66+
67+
## Restoring the database
68+
69+
For restoring the database of Gitea, please refer to the [platform database instructions](platform-databases.md).
70+
71+
## Cleaning up
72+
73+
Remove any extracted files from the local backup directory to free up space. They are not removed automatically. Only compressed backups with the `.tar.bz2` are cleaned up after one day.
74+
75+
```sh
76+
cd /backup
77+
rm -R restore
78+
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
slug: overview
3+
title: Disaster Recovery Overview
4+
sidebar_label: Overview
5+
---
6+
7+
## Prerequisites
8+
9+
This area covers some potential scenarios, when a complete or partial restore of the platform is required.
10+
11+
This guide has the following prerequisites and limitations that should be checked regularly:
12+
13+
1. The following items should be backed up regularly by the platform administrator:
14+
- The Kubernetes secret ending in "-wildcard-cert" in namespace "istio-system" (if installed via the Linode cloud console, or using your own certificate).
15+
- The Kubernetes secret "otomi-sops-secrets" in namespace "otomi-pipelines".
16+
- A download of the complete values in Platform -> Maintenance. Depending on whether these are downloaded with or without secrets, some passwords might have to be reset after recovery.
17+
- Optionally manual backups of databases, as covered in this guide for the CloudNative PostgreSQL Operator, should be taken.
18+
19+
2. Object storage needs to be set up for all backup types referred to. Credentials should be added to Platform Settings -> Object Storage.
20+
21+
3. All backup types should be activated in the Platform Settings -> Backup.
22+
23+
4. This guide does not cover the partial or complete loss of attached object storage. For production environments, it is advised to set up additional object storage in a different region, where all contents of the platform object storage is mirrored to, and can be retrieved in the event of accidental deletes, data center availability issues etc. The transfer to and from these remote storage locations is not covered in this guide.
24+
25+
5. Workloads may store data in local storage, object storage, different types of databases, message queues etc. The backup and recovery strategy of Workload storage is not covered here.
26+
27+
6. Currently it is not supported to reinstall a cluster in-place that has been provisioned directly using the Linode API or Console. Such an LKE cluster must instead be reprovisioned with the application platform through a Helm install. However, since the cluster ID changes, the domainsuffix will also change. Adjustments need to be made to the values file before the restore. Also, you will need a domain name set up with a DNS provider supported by App Platform and the credentials should be added to the values file.
28+
29+
7. All instructions assume you are familiar with essential Kubernetes tools such as `kubectl` and have access to the Kubernetes API. Usage of TUI applications such as `k9s` from the administration terminal is strongly recommended.
30+
31+
## Guides
32+
33+
* [Gitea](gitea.md): Restoring the platform's Gitea database and repositories from the application backup
34+
* [Databases](platform-databases.md): Backup and restore of the CNPG databases
35+
* [Reinstall](platform-reinstall.md): Restoring the complete platform, including settings and data

0 commit comments

Comments
 (0)