-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is BACKUP_FILENAME_EXPAND
still working for multiple conf files in /etc/dockervolumebackup/conf.d
#367
Comments
BACKUP_FILENAME_EXPAND
still working in for multiple conf files in /etc/dockervolumebackup/conf.d
BACKUP_FILENAME_EXPAND
still working for multiple conf files in /etc/dockervolumebackup/conf.d
Could you put the contents of the zip file in the issue body? As for your issue the behavior should be supported by |
I updated the issue with contents from the zip file. Let me know if there is any more to do |
This is pretty tricky. The situation you describe does not work as expected in v2.36.x versions already: each What happens in An easy fix for your setup would be to not replace empty values, but this is still not the exact same behavior as before. I'll need to think about this for a bit, |
Each file in for file in /etc/dockervolumebackup/conf.d/*; do
source $file
BACKUP_CRON_EXPRESSION="${BACKUP_CRON_EXPRESSION:-@daily}"
echo "Appending cron.d entry with expression $BACKUP_CRON_EXPRESSION and configuration file $file"
(crontab -l; echo "$BACKUP_CRON_EXPRESSION /bin/sh -c 'set -a; source $file; set +a && backup' 2>&1") | crontab -
done This behavior is also kept intact in |
I start believing there is no real way of emulating the established behavor without:
I'll try to use the latter and see where it takes me. |
Yes, I saw your PR and I agree that reinventing the wheel is generally not a good idea. However, if the situation is becoming more complex, I am perfectly fine with just adding an option such as |
I feel that :) but I would think as long as this tool is expected to be continued as a If a You're not the only person with this requirement btw: #321 |
Hi, I'm back with an update on the workaround for this issue. For anyone seeing this issue, the idea of the workaround is quite straightforward: prefer to use environment variable substitution at the OS level. In this case, the OS level refers to the Linux OS within the Docker container/image. More specifically, you should create an additional environment file like # default.env
# volume names
RSSHUB_REDIS_DATA_NAME=rsshub-redis-data
# cron expression
DAILY_CRON_EXPRESSION="0 9 * * *"
# backup filename prefix
RSSHUB_REDIS_DATA_BACKUP_FILENAME_DAILY_PREFIX=${RSSHUB_REDIS_DATA_NAME}-daily-backup
# backup retention
DAILY_BACKUP_RETENTION_IN_DAYS=7 Next, you'll need to update the Docker Compose file to include this new services:
volume-backup:
image: offen/docker-volume-backup
container_name: docker-volume-backup
env_file:
- default.env # it's recommended to place this file first in the env_file list
- .env
# ... more Then, within any BACKUP_CRON_EXPRESSION=${DAILY_CRON_EXPRESSION}
BACKUP_SOURCES=/backup/${RSSHUB_REDIS_DATA_NAME}
BACKUP_PRUNING_PREFIX=${RSSHUB_REDIS_DATA_BACKUP_FILENAME_DAILY_PREFIX}
BACKUP_FILENAME="${RSSHUB_REDIS_DATA_BACKUP_FILENAME_DAILY_PREFIX}-%Y-%m-%dT%H-%M-%S.{{ .Extension }}"
BACKUP_LATEST_SYMLINK="${RSSHUB_REDIS_DATA_BACKUP_FILENAME_DAILY_PREFIX}-latest.tar.gz"
BACKUP_RETENTION_DAYS=${DAILY_BACKUP_RETENTION_IN_DAYS}
BACKUP_STOP_DURING_BACKUP_LABEL=${RSSHUB_REDIS_DATA_NAME} I have verified that this method works for both Now, @m90, do you believe it's still necessary to address this issue or to add a "How To" guide with the content mentioned here in the documentation? |
Thanks for sharing your workaround. I do agree just using godotenv might be the better option in theory, but I made the mistake of using |
This should now be working as before in |
Although I already switched to use the workaround, still I am really appreciated for your efforts on fixing it. I may consider reuse |
Describe the bug
I have 4 different daily backups, each with a name like
BACKUP_FILENAME="$BACKUP_PRUNING_PREFIX-%Y-%m-%dT%H-%M-%S.{{ .Extension }}"
Previously this works fine as long as I have
BACKUP_FILENAME_EXPAND
set to true.Starting in recent, it no longer works, even with
v2.37.3
. The backup filename is like-2024-02-16T09-00-00.tar.gz
To Reproduce
First create a
compose.redis.yml
file like the following:Then launch that Redis with
docker compose -f redis.compose.yml up -d
Then create another
compose.yml
file in another directory for this docker-voume-backup containerIn the same folder, create an
.env
file as following:In the
config
directory shown in thecompose.yml
file, create a newrsshub-redis-data.daily.env
confi file with the following content:You can also modify
BACKUP_CRON_EXPRESSION
to be one or two minutes away from nowLaunch the docker-voume-backup container by running
docker compose up -d
Then you should see a wired filename like
-2024-....tar.gz
in the ./backup-files` folderExpected behavior
the env var
BACKUP_PRUNING_PREFIX
from conf files in/etc/dockervolumebackup/conf.d
should be properly propagated into the same conf file.Version (please complete the following information):
Additional context
v2.36.x
works well, so this issue is probably another part of the unfix regression fromv2.37.x
The text was updated successfully, but these errors were encountered: