Minituff / nautical-backup

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

Containers skipped #326

Open tetra-archos opened 1 month ago

tetra-archos commented 1 month ago

I get the following in my log file:

Backup Report - 2024-09-19 03:00:01.122325
2024-09-19 03:00:01.139351 - INFO: Starting backup...
2024-09-19 03:00:01.189656 - INFO: Processing 6 containers...
2024-09-19 03:00:01.236685 - INFO: Stopping nautical-backup...
2024-09-19 03:00:01.423824 - INFO: Shutting down API...

My compose file is:

services:
  nautical-backup:
    image: minituff/nautical-backup:latest
    restart: unless-stopped
    container_name: nautical-backup
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /opt/nautical-backup/config:/config
      - /opt/:/app/source
      - /media/files/Settings/Backups/Docker/Iris:/app/destination
      - /opt/nautical-backup/ntfy.sh:/ntfy.sh # Mount ntfy script
    environment:
      - CRON_SCHEDULE=0 3 * * *
      - SKIP_CONTRAINERS=nautical-backup
      - TZ=America/New_York
      - POST_BACKUP_EXEC=/ntfy.sh

and all that is in my backup directory after running is my log file. The ntfy.sh is just a script pushing the output to ntfy.

Minituff commented 1 month ago

Hi,

It seems like Nautical is attempting to backup itself. I have some steps in place to prevent this but it seems like that isn't working.

Could you add the following label to your Nautical config:

"nautical-backup.enable=false"
"nautical-backup.stop-before-backup=false"

If this fixes the problem, then I need to troubleshoot further as to why Nautical didn't skip itself.

Could you also set the console LOG_LEVEL to TRACE and share what you find in the Docker console (not the backup report).

Also, great use of the nfty script. I love that service!

tetra-archos commented 1 month ago
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 2 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 0 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 0 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 0 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 0 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 0 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 0 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 0 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 0 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 0 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | INFO: Connected to database at '/config/nautical-db.json'
nautical-backup    | /app/logger.sh: line 46: ((: 1 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 0 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 2 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 2 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | /app/logger.sh: line 46: ((: 0 >= : syntax error: operand expected (error token is ">= ")
nautical-backup    | INFO: Connected to database at '/config/nautical-db.json'
nautical-backup    | DEBUG: Verifying source directory '/app/source'...
nautical-backup    | TRACE: Source directory '/app/source' READ access verified
nautical-backup    | DEBUG: Verifying Nautical destination directory '/app/destination'...
nautical-backup    | TRACE: Destination directory '/app/destination' READ/WRITE access verified
nautical-backup    | INFO: Starting backup...
nautical-backup    | DEBUG: Verifying destination directory '/app/destination'...
nautical-backup    | TRACE: Destination directory '/app/destination' READ/WRITE access verified
nautical-backup    | INFO: Processing 6 containers...
nautical-backup    | DEBUG: Containers: nautical-backup, diun-diun-1, uptime-kuma, komodo_core_1, komodo_ferretdb_1, komodo_periphery_1
nautical-backup    | TRACE: Skipping nautical-backup c1f8057178d6b4fa25b84c8c17b06ee7ac5316c7dfc02fa60a2aeb1adc745e1a because it's image matches 'minituff/nautical-backup'.
nautical-backup    | TRACE: Skipping nautical-backup c1f8057178d6b4fa25b84c8c17b06ee7ac5316c7dfc02fa60a2aeb1adc745e1a because it's image matches 'nautical-backup'.
nautical-backup    | DEBUG: Skipping nautical-backup based on label
nautical-backup    | DEBUG: diun-diun-1 - Source directory '/app/source/diun-diun-1' does not exist. Skipping
nautical-backup    | DEBUG: Container diun-diun-1 was not stopped. No need to start.
nautical-backup    | INFO: Stopping uptime-kuma...
nautical-backup    | DEBUG: Verifying destination directory '/app/destination'...
nautical-backup    | TRACE: Destination directory '/app/destination' READ/WRITE access verified
nautical-backup    | ERROR: Destination directory '/app/destination/uptime-kuma' does not exist
nautical-backup    | INFO: Backing up uptime-kuma...
nautical-backup    | DEBUG: RUNNING: 'rsync -raq  /app/source/uptime-kuma/ /app/destination/uptime-kuma/'
nautical-backup    | INFO: Starting uptime-kuma...
nautical-backup    | INFO: Backup of uptime-kuma complete!
nautical-backup    | DEBUG: komodo_core_1 - Source directory '/app/source/komodo_core_1' does not exist. Skipping
nautical-backup    | DEBUG: Container komodo_core_1 was not stopped. No need to start.
nautical-backup    | DEBUG: komodo_ferretdb_1 - Source directory '/app/source/komodo_ferretdb_1' does not exist. Skipping
nautical-backup    | DEBUG: Container komodo_ferretdb_1 was not stopped. No need to start.
nautical-backup    | DEBUG: komodo_periphery_1 - Source directory '/app/source/komodo_periphery_1' does not exist. Skipping
nautical-backup    | DEBUG: Container komodo_periphery_1 was not stopped. No need to start.
nautical-backup    | DEBUG: Running POST_BACKUP_EXEC
nautical-backup    | TRACE: Setting environment variable NB_EXEC_COMMAND to /ntfy.sh
nautical-backup    | TRACE: Setting environment variable NB_EXEC_ATTACHED_TO_CONTAINER to False
nautical-backup    | TRACE: Setting environment variable NB_EXEC_CONTAINER_NAME to None
nautical-backup    | TRACE: Setting environment variable NB_EXEC_CONTAINER_ID to None
nautical-backup    | TRACE: Setting environment variable NB_EXEC_BEFORE_DURING_OR_AFTER to AFTER
nautical-backup    | INFO: Running EXEC command: /ntfy.sh
nautical-backup    | WARN: Exec command error: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
nautical-backup    |                                  Dload  Upload   Total   Spent    Left  Speed
100   332  100   226  100   106   1458    684 --:--:-- --:--:-- --:--:--  2155
nautical-backup    | DEBUG: Exec command output: {"id":"Xqg24Z07XI3E","time":1726815606,"expires":1726858806,"event":"message","topic":"nautical-backups","message":"Iris nautical-backup failed with status 127:\\n/ntfy.sh: line 8: nautical-backup-command: command not found"}
nautical-backup    | DEBUG: Containers completed: uptime-kuma
nautical-backup    | DEBUG: Containers skipped: nautical-backup, komodo_periphery_1, komodo_ferretdb_1, diun-diun-1, komodo_core_1
nautical-backup    | INFO: Completed in 00m 05s
nautical-backup    | INFO: Success. 1 containers backed up! 5 skipped.
Backup Report - 2024-09-20 03:00:01.290184
2024-09-20 03:00:01.302373 - INFO: Starting backup...
2024-09-20 03:00:01.347862 - INFO: Processing 6 containers...
2024-09-20 03:00:01.391589 - INFO: Stopping uptime-kuma...
2024-09-20 03:00:05.725986 - ERROR: Destination directory '/app/destination/uptime-kuma' does not exist
2024-09-20 03:00:05.749564 - INFO: Backing up uptime-kuma...
2024-09-20 03:00:06.247634 - INFO: Starting uptime-kuma...
2024-09-20 03:00:06.566118 - INFO: Backup of uptime-kuma complete!
2024-09-20 03:00:06.593174 - INFO: Running EXEC command: /ntfy.sh
2024-09-20 03:00:06.769319 - WARN: Exec command error: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   332  100   226  100   106   1458    684 --:--:-- --:--:-- --:--:--  2155
2024-09-20 03:00:06.791666 - INFO: Completed in 00m 05s
2024-09-20 03:00:06.806711 - INFO: Success. 1 containers backed up! 5 skipped.
2024-09-20 07:42:12.298277 - INFO: Shutting down API...
2024-09-20 07:42:19.267723 - INFO: Starting API on port 8069...
Minituff commented 1 month ago

Thanks for sending me the logs. I think I may have misunderstood your issue before.

Based on these logs, I can see that Nautical is not trying to back itself up

nautical-backup    | TRACE: Skipping nautical-backup c1f8057178d6b4fa25b84c8c17b06ee7ac5316c7dfc02fa60a2aeb1adc745e1a because it's image matches 'minituff/nautical-backup'.
nautical-backup    | TRACE: Skipping nautical-backup c1f8057178d6b4fa25b84c8c17b06ee7ac5316c7dfc02fa60a2aeb1adc745e1a because it's image matches 'nautical-backup'.
nautical-backup    | DEBUG: Skipping nautical-backup based on label

The last log, "Shutting Down", was this caused by you shutting down the container?


I think these logs are the most relevant to your issue.

nautical-backup    | DEBUG: Containers: nautical-backup, diun-diun-1, uptime-kuma, komodo_core_1, komodo_ferretdb_1, komodo_periphery_1
nautical-backup    | DEBUG: komodo_core_1 - Source directory '/app/source/komodo_core_1' does not exist. Skipping
nautical-backup    | DEBUG: komodo_ferretdb_1 - Source directory '/app/source/komodo_ferretdb_1' does not exist. Skipping
nautical-backup    | DEBUG: komodo_periphery_1 - Source directory '/app/source/komodo_periphery_1' does not exist. Skipping

Nautical is looking for a source folder that matches the container name. Since all your containers end in _1, this is likely the reason they are getting skipped.

You have a few options to remedy this (You only need to choose 1).

  1. Use the OVERRIDE_SOURCE_DIR enviornment variable on the Nautical config.
    # Nautical compose
    OVERRIDE_SOURCE_DIR=komodo_core_1:komodo_core,komodo_ferretdb_1:komodo_ferretdb,komodo_periphery_1:komodo_periphery
  2. Update the container_name property on each of the containers

Example:

services:
  komodo_core:
    container_name: komodo_core
  1. Use the nautical-backup.override-source-dir label on each of your containers
    services:
    komodo_core:
    container_name: komodo_core
    labels:
      - nautical-backup.override-source-dir=komodo_core
tetra-archos commented 1 month ago

So that was after I put the tags in you suggested to keep it from reading nautical, and I'm unsure why my it's reading a _1 on my container names, that isn't in my directory structure or docker-compose.yml files

Minituff commented 1 week ago

It looks like the -1 is coming from the project name of the Docker compose project? Source; https://stackoverflow.com/questions/33045358/docker-compose-image-named-prefix-s-1-instead-of-s

I haven't encountered this before myself, but you may need to do some tinkering to either remove the -1 or add that to the nautical config so it can be recognized.