-
-
Notifications
You must be signed in to change notification settings - Fork 1
Restore corporate website from a backup
Corporate website needs two components:
- a PHP webserver
- a MariaDB instance
As of March 2025, this is provided by Cyon through a "classical" shared web hosting offer.
DB as of March 2025:
Server version: 10.6.19-MariaDB-cll-lve-log - MariaDB Server
Protocol version: 10
PHP as of March 2025: CyonPHP-March2025.pdf
Procedure below will assume you have access to something equivalent.
Backups for both components is stored in BorgBase:
-
website-wordpress-db
: database -
website-files
: static files
To download them you need the read-only credentials:
# those are all static values you need to enter
# those are all for the _slave_ (aka readonly) bitwarden account
export BW_CLIENTID=user.xxxxxxxxx
export BW_CLIENTSECRET=xxxxxxxxxxxx
export BW_PASSWORD=xxxxxxxxxxxx
docker run --rm -e BW_CLIENTID=$BW_CLIENTID -e BW_CLIENTSECRET=$BW_CLIENTSECRET -e BW_PASSWORD=$BW_PASSWORD ghcr.io/kiwix/borg-backup restore --name website-wordpress-db --list
website-wordpress-db
is the name of the Borgbase repository in which we archive the website DB backups.
Output would look like
List avaible archives ...
Remote: Warning: Permanently added the ECDSA host key for IP address '95.216.113.224' to the list of known hosts.
Warning: Attempting to access a previously unknown unencrypted repository!
Do you want to continue? [yN] yes (from BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK)
website-wordpress-db__backup__2025-01-31T00:00:51 Fri, 2025-01-31 00:00:52 [a503bce5e117ca9ec7cb7b319fc02bfe38c07f5856842f6b84a096636c3993e5]
website-wordpress-db__backup__2025-02-02T00:00:52 Sun, 2025-02-02 00:00:53 [37920abb699db3c5b391154c340c118954d1f9bfd6f56079ee1c9ba0ed2ce8e6]
website-wordpress-db__backup__2025-02-09T00:00:53 Sun, 2025-02-09 00:00:54 [d791adec355f5a692d13769ae33547963c670a08ec0553b0c96318eb5a30b1b0]
website-wordpress-db__backup__2025-02-16T00:01:03 Sun, 2025-02-16 00:01:04 [2730bdc7f53366ada6dd4b5f6e8e3798b5243903be9b8c21909dee365b27a111]
website-wordpress-db__backup__2025-02-23T00:01:01 Sun, 2025-02-23 00:01:02 [7fab0e333b025fb9396e2ed68c30b6b08c40186f7f50147a32ad4bd9b8484ddc]
website-wordpress-db__backup__2025-02-28T00:01:10 Fri, 2025-02-28 00:01:11 [bb9f747a5d46e1dc60482d3d6f889875c4fc8f3a0277bf31e6e3351f6b3e5fdf]
website-wordpress-db__backup__2025-03-02T00:00:52 Sun, 2025-03-02 00:00:53 [a4d48323585671a0d244307610b8b21b4a58cb7199d3ccaa948d404a4ebc70d9]
website-wordpress-db__backup__2025-03-03T00:00:46 Mon, 2025-03-03 00:00:47 [bc65f3922f690728dbe77c4b5a525779379ae916bede489f71e908f03f5c26fb]
website-wordpress-db__backup__2025-03-04T00:01:02 Tue, 2025-03-04 00:01:02 [6f07433cf12518b7ecbdc5ade1b83ced897fb14d8886a501f17661382145c49a]
website-wordpress-db__backup__2025-03-05T00:01:02 Wed, 2025-03-05 00:01:03 [75eaa820031a53d3edb7ba7b56297e51f5202a7e536fb0ef3854ad441f8ecbe6]
website-wordpress-db__backup__2025-03-06T00:00:55 Thu, 2025-03-06 00:00:56 [aafea1e3da233f1eee79fb57322d4a2035b989dae83f85428825597ccb3cb09d]
website-wordpress-db__backup__2025-03-07T00:01:07 Fri, 2025-03-07 00:01:08 [a5499772a2379d009d19d09158c068fd88ae4175a021a5043653286b031df756]
website-wordpress-db__backup__2025-03-08T00:01:13 Sat, 2025-03-08 00:01:14 [aa18564ff1d57787612d4eaf19ff63a63fed72d9e38ab79332e39205213caf83]
website-wordpress-db__backup__2025-03-09T00:01:10 Sun, 2025-03-09 00:01:11 [b9fc2cf4d170d24d84900057edcfbaf077ac30892ed6748306a432fc0a07fdd2]
website-wordpress-db__backup__2025-03-10T00:01:22 Mon, 2025-03-10 00:01:23 [23e855bce93daf99db1f2322932bd8125524b86360e174b02bebd2fcfbc24e1b]
Choose one based on its date.
Note: the archive name is the first column (stops at first space). ex: website-wordpress-db__backup__2025-03-10T00:01:22
.
With your selected archive name, download+extract it to your filesystem:
docker run -v /data/restore:/restore:rw -e BW_CLIENTID=$BW_CLIENTID -e BW_CLIENTSECRET=$BW_CLIENTSECRET -e BW_PASSWORD=$BW_PASSWORD ghcr.io/kiwix/borg-backup restore --name website-wordpress-db --extract website-wordpress-db__backup__2025-03-10T00:01:22
Zimfarm backup is a single Custom Database Dump file that would be extracted to /data/restore
in this example. The file has no extension ; move it to a more practical location
mv /data/restore/root/.borgmatic/mysql_databases/s022.cyon.net/kiwixorg_web2023 <...>
If you want to directly restore to a K8S volume, in order to get the dump file into the volume, one needs to launch borg-backup into the cluster. This would be done with a temporary Job
---
apiVersion: batch/v1
kind: Job
metadata:
name: borg-accessor
namespace: website
spec:
backoffLimit: 1
template:
metadata:
labels:
app: borg-app
spec:
containers:
- name: borg-backup
image: ghcr.io/kiwix/borg-backup
command: ["restore", "--name", "website-wordpress-db", "--extract", "website-wordpress-db__backup__2025-03-10T00:01:22"]
imagePullPolicy: Always
env:
- name: BW_CLIENTID
value: "xxxx"
- name: BW_CLIENTSECRET
value: "xxxx"
- name: BW_PASSWORD
value: "xxx"
volumeMounts:
- name: data-volume
subPath: restore
mountPath: "/restore"
readOnly: false
volumes:
- name: data-volume
persistentVolumeClaim:
claimName: website-restore-db-pvc
restartPolicy: Never
nodeSelector:
k8s.kiwix.org/role: "services"
You can then get a shell to the MariaDB container and restore directly:
mariadb -p -u$MARIADB_USER $MARIADB_DATABASE < /var/lib/mysql/restore/root/.borgmatic/mysql_databases/s022.cyon.net/kiwixorg_web2023