Minituff / nautical-backup

A simple Docker volume backup tool.
https://minituff.github.io/nautical-backup/
GNU General Public License v3.0
217 stars 3 forks source link

Advice on Group label #307

Closed robflate closed 2 weeks ago

robflate commented 2 weeks ago

What is the suggested route for backing up the following stack. I have removed all but the relevant info and left in my not working attempt at settings nautical-backup labels. Note that the immich_server container has no volumes to backup but should be stopped (preferably 1st) and re-started (preferably last).

Apologies for posting a support request here but I couldn't find a Discord or more suitable channel;

# ${APPDATADIR} = /home/myuser/docker/media-server/appdata

services:

nautical-backup:
    container_name: nautical-backup
    image: minituff/nautical-backup:2.5
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock 
      - ${APPDATADIR}/nautical-backup:/config 
      - ${APPDATADIR}:/app/source 
      - ${VOLUMES}/htpc10/Backup/nautical-backup:/app/destination 
    environment:
      TZ: ${TZ}
      CRON_SCHEDULE_ENABLED: false
      REQUIRE_LABEL: true
      LOG_LEVEL: TRACE
      BACKUP_ON_START: true
      RUN_ONCE: false

  immich-server:
    container_name: immich_server
    volumes:
      # No volumes to backup
    labels:
      - "nautical-backup.enable=true"
      - "nautical-backup.group=immich"

  immich-machine-learning:
    container_name: immich_machine_learning
    volumes:
      - ${APPDATADIR}/immich/immich-machine-learning:/.config
      - ${APPDATADIR}/immich/immich-machine-learning:/.cache
    labels:
      - "nautical-backup.enable=true"
      - "nautical-backup.group=immich"
      - "nautical-backup.override-source-dir=immich/immich-machine-learning"

  immich-redis:
    container_name: immich_redis
    volumes:
      - ${APPDATADIR}/immich/redis:/data
    labels:
      - "nautical-backup.enable=true"
      - "nautical-backup.group=immich"
      - "nautical-backup.override-source-dir=immich/redis"

  immich-database:
    container_name: immich_postgres
    volumes:
      - ${APPDATADIR}/immich/database:/var/lib/postgresql/data
    labels:
      - "nautical-backup.enable=true"
      - "nautical-backup.group=immich"
      - "nautical-backup.override-source-dir=immich/database"
Minituff commented 2 weeks ago

Hey @robflate,

This looks like a really great config to me-- I can tell you spent time reading the docs :) Your grouping makes sense and I think you are you using the overrides properly since you have the source dirs nested in the immich folder.

Are there any issues with this config or are you just wanting some validation before you deploy?

not working attempt at settings nautical-backup labels

Edit: Could you attach some of the Nautical logs on TRACE?

robflate commented 2 weeks ago

Trace Logs nautical-backup-2024-09-06T17-23-09.log

My folder structure

Screenshot 2024-09-06 at 18 25 55

Also, I would like to stop immich-server even though it has no volumes to backup and start it again after the others have restarted. Thanks.

Minituff commented 2 weeks ago

Ahh okay I think I see the problem here.

ERROR: Destination directory '/app/destination/immich/redis' does not exist
ERROR: Destination directory '/app/destination/immich/database' does not exist
ERROR: Destination directory '/app/destination/immich/immich-machine-learning' does not exist

I don't think this is a config problem. I think I may need to update the code to create the nested folders beginning with /app/destination/immich You may be able to use a workaround in the meatime (until I push an update) by creating the immich folder:

# On the machine running the containers
mkdir -p ${VOLUMES}/htpc10/Backup/nautical-backup/immich

# These 3 commands may or may not be necessary
mkdir -p ${VOLUMES}/htpc10/Backup/nautical-backup/immich/redis
mkdir -p ${VOLUMES}/htpc10/Backup/nautical-backup/immich/database
mkdir -p ${VOLUMES}/htpc10/Backup/nautical-backup/iimmich/mmich-machine-learning

I would like to stop immich-server even though it has no volumes to backup and start it again after the others have restarted.

This is a good use case I don't think I've added natively yet. I'll work to add this as a new upcoming feature as well. As a workaround you could just create a folder linked to immich-server so that Nautical still sees a folder and therefore stops the container during the group. I know this is not ideal, but it should work until I get the feature rolled out.

# On the machine running the containers
mkdir -p ${VOLUMES}/htpc10/Backup/nautical-backup/immich/server
touch ${VOLUMES}/htpc10/Backup/nautical-backup/immich/server/placeholder.txt

  immich-server:
    container_name: immich_server
    volumes:
      # Still no volumes needed to mount (only Nautical thinks there is)
    labels:
      - "nautical-backup.enable=true"
      - "nautical-backup.group=immich"
      - "nautical-backup.override-source-dir=immich/server" # Should match the temp folder
robflate commented 2 weeks ago

Amazing! All working now.

I've put off backing up my stack for so long and this project finally got me to sort that so thanks so much!