diff --git a/docs/PODMAN.md b/docs/PODMAN.md index f644338..40857b1 100644 --- a/docs/PODMAN.md +++ b/docs/PODMAN.md @@ -15,4 +15,6 @@ Example using [alvistack/ansible-role-podman](https://github.com/alvistack/ansib command: cmd: "loginctl enable-linger {{ sysadmin_username }}" creates: "/var/lib/systemd/linger/{{ sysadmin_username }}" -``` \ No newline at end of file +``` + +Depending on the OS version you're using, you may have to account for the usage of deprecated apt-key functionality. \ No newline at end of file diff --git a/docs/POSTGRES.md b/docs/POSTGRES.md index 76c22ee..f7c3897 100644 --- a/docs/POSTGRES.md +++ b/docs/POSTGRES.md @@ -1,6 +1,6 @@ # PostgreSQL -This variation of the [original role](https://github.com/Tronde/ansible_role_deploy_wikijs_with_mariadb_pod) is intended to be composed with another role that sets up the database. Here is an example using [anxs.postgresql](https://github.com/ANXS/postgresql) +Here is an example using [anxs.postgresql](https://github.com/ANXS/postgresql) ## Example Playbook @@ -23,3 +23,36 @@ postgresql_databases: owner: wikijs state: present ``` + +Depending on the OS version you're using, you may have to account for the usage of deprecated apt-key functionality. + +## PG 15 + +I'm temporarily using this branch to get PG15: + +```yaml + - src: https://github.com/ANXS/postgresql + name: anxs.postgresql + version: development +``` +## Backups + +```bash +BACKUP_PG_DB() { + BACKUP_DIR=$HOME/archive/${TARGET}/postgresql + DUMP_FILE=/var/lib/postgresql/${1}_${TIMESTAMP}.dump.bz2 + ssh root@${TARGET} "cd /var/lib/postgresql && doas -u postgres /usr/bin/pg_dump -Fc ${1} | /usr/bin/bzip2 > ${DUMP_FILE}" + mkdir -p ${BACKUP_DIR} + rsync -tav root@${TARGET}:${DUMP_FILE} ${BACKUP_DIR}/ + ssh root@${TARGET} rm -v ${DUMP_FILE} + + # Only remove older backups if newer backups exist + NEWER_BACKUPS=$(find $BACKUP_DIR -mtime -60 -type f -name "${1}_*.dump.bz2") + if [[ -n $NEWER_BACKUPS ]]; then + find $BACKUP_DIR -mtime +60 -type f -name "${1}_*.dump.bz2" -delete + else + echo "No newer backups found. Old backups not pruned." + fi +} +BACKUP_PG_DB wikijs +``` \ No newline at end of file