add wiki, wordpresscmoag, wordpressacmoag, update doc
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
onyx.nbit.ch is used to run rootless Podman containers, using Traefik as a Reverse Proxy
|
||||
|
||||
Additionally it acts as a secondary nameserver ns2.nbit.ch
|
||||
|
||||
In this directory (/home/containers/onyx_pods), you will find all configuration files to run the containers (with Podman and Kubernetes YAML files)
|
||||
|
||||
Specs:
|
||||
@@ -77,39 +79,7 @@ command to check who is banned:
|
||||
|
||||
## Backup Server
|
||||
|
||||
TODO
|
||||
|
||||
```bash
|
||||
Backup MySQL-DBs:
|
||||
|
||||
/usr/local/bin/backup-mysql-dbs.sh (sinngemaess, eine Zeile pro Container):
|
||||
root@moby:/usr/local/bin# more backup-mysql-dbs.sh
|
||||
#!/bin/bash
|
||||
# Backup der MySQL DBs (Docker)
|
||||
#
|
||||
for container_name in $(docker ps --format "{{.Image}} {{.Names}}" |grep mysql |awk '{print $2}'); do
|
||||
if [ -f /usr/local/bin/${container_name}.pwd ]; then
|
||||
# im pwd-File muss "PWD=XXXX" (root) gesetzt werden
|
||||
. /usr/local/bin/${container_name}.pwd
|
||||
docker exec ${container_name} /usr/bin/mysqldump -u root --password=${PWD} --all-databases > /backup/mysql-databases-${container_name}-$(date +%Y%m%W).sql 2>/dev/null
|
||||
else
|
||||
>&2 echo "Password must be set as PWD=XXXX in /usr/local/bin/${container_name}.pwd"
|
||||
fi
|
||||
done
|
||||
|
||||
# Cleanup Old Backups
|
||||
find /backup -type f -mtime +30 -exec rm {} \;
|
||||
|
||||
/etc/cron.d/backup-mysql-dbs:
|
||||
# Backup MySQL DBs
|
||||
#
|
||||
45 5 * * * root /usr/local/bin/backup-mysql-dbs.sh >/dev/null
|
||||
|
||||
|
||||
Restore: just in case:
|
||||
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
|
||||
|
||||
|
||||
# dnf install restic
|
||||
# mkdir /backup
|
||||
# mkdir /backup-restic
|
||||
@@ -119,8 +89,6 @@ SSH Keypaar fuer User root erstellen und auf Hetzner Storagebox hinterlegen:
|
||||
|
||||
# ssh-keygen
|
||||
|
||||
|
||||
|
||||
Restic Script:
|
||||
|
||||
/usr/local/bin/backup-to-disk.sh
|
||||
@@ -155,6 +123,46 @@ Backup auf Storag Box:
|
||||
HERE
|
||||
```
|
||||
|
||||
```bash
|
||||
Backup MySQL-DBs:
|
||||
|
||||
# mkdir /backup/mysql-dbs
|
||||
# chown containers:containers /backup/mysql-dbs/
|
||||
|
||||
/usr/local/bin/backup-mysql-dbs.sh (sinngemaess, eine Zeile pro Container):
|
||||
[root@onyx bin]# more backup-mysql-dbs.sh
|
||||
#!/bin/bash
|
||||
# Backup der MySQL DBs (Podman)
|
||||
#
|
||||
for container_name in $(podman ps --format "{{.Image}} {{.Names}}" |grep mysql |awk '{print $2}'); do
|
||||
if [ -f /usr/local/bin/${container_name}.pwd ]; then
|
||||
# im pwd-File muss "PWD=XXXX" (root) gesetzt werden
|
||||
. /usr/local/bin/${container_name}.pwd
|
||||
podman exec ${container_name} /usr/bin/mysqldump -u root --password=${PWD} --all-databases > /backup//mysql-dbs/mysql-databases-${container_name}-$(date +%Y%m%W).sql 2>/dev/null
|
||||
else
|
||||
>&2 echo "Password must be set as PWD=XXXX in /usr/local/bin/${container_name}.pwd"
|
||||
fi
|
||||
done
|
||||
|
||||
# Cleanup Old Backups
|
||||
find /backup/mysql-dbs -type f -mtime +30 -exec rm {} \;
|
||||
|
||||
[root@onyx bin]# ls -l *pwd
|
||||
-r--------. 1 containers containers 15 Dec 10 09:42 wordpressacmoag-pod-db.pwd
|
||||
-r--------. 1 containers containers 15 Dec 10 09:38 wordpresscmoag-pod-db.pwd
|
||||
|
||||
/etc/cron.d/backup-mysql-dbs:
|
||||
# Backup MySQL DBs
|
||||
#
|
||||
45 5 * * * containers /usr/local/bin/backup-mysql-dbs.sh >/dev/null
|
||||
|
||||
|
||||
Restore: just in case:
|
||||
cat backup.sql | podman exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Wordpress behind Traefik
|
||||
|
||||
@@ -281,3 +289,18 @@ containers$ escaped=$(systemd-escape ~/onyx_pods/${backendservice}/${backendserv
|
||||
containers$ systemctl --user start podman-kube@$escaped.service
|
||||
containers$ systemctl --user enable podman-kube@$escaped.service
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Secondary Nameserver
|
||||
|
||||
```bash
|
||||
# dnf install bind bind-utils
|
||||
# systemctl enable --now named
|
||||
# firewall-cmd --add-service=dns --permanent
|
||||
# firewall-cmd --reload
|
||||
|
||||
Adopt /etc/named.conf:
|
||||
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user