Last active
September 30, 2024 21:53
-
-
Save tlnagy/12a6538ea8c8164ea315675987afc302 to your computer and use it in GitHub Desktop.
Immich backups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TrueNAS Immich K3S container commands | |
# Use at your own risk! | |
# | |
# I assume that you're running these commands in your home directory (containing a folder called | |
# 'immich-backups'), you have sudo access, the immich app is using the default TrueNAS namespace | |
# (aka ix-immich). | |
# Tamas Nagy 2024 | |
# backs up the postgres database to the 'immich-backups' folder in your current directory | |
sudo k3s kubectl -n ix-immich exec -ti $(sudo k3s kubectl get pods -o=name --all-namespaces | cut -c 5- | grep immich-postgres) -- pg_dumpall --clean --if-exists --username=immich | gzip > immich-backups/immichdb-$(date +%y-%m-%d-%H-%M-%S).tar.gz | |
# follow logs from the postgres container | |
sudo k3s kubectl -n ix-immich logs --follow $(sudo k3s kubectl get pods -o=name --all-namespaces | cut -c 5- | grep immich-postgres) | |
# follow logs from the main immich container | |
sudo k3s kubectl -n ix-immich logs -c immich --follow $(sudo k3s kubectl get pods -o=name --all-namespaces | cut -c 5- | grep -oP '^immich-[\w]+-[\w]+$') | |
# open a shell to the main immich container | |
sudo k3s kubectl -n ix-immich exec -ti -c immich $(sudo k3s kubectl get pods -o=name --all-namespaces | cut -c 5- | grep -oP '^immich-[\w]+-[\w]+$') -- sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment