Web UI updates settings by deleting/recreating duplicacy.json

I’m running d-web in ehough’s docker container. The way it brings in and persists settings is by bind mounting /etc/duplicacy into the container and placing a duplicacy.json file in there. Then, it symlinks the ~/.duplicacy-web/duplicacy.json file into that /etc/duplicacy/duplicacy.json file with
ln -s /etc/duplicacy/duplicacy.json ~/.duplicacy-web/duplicacy.json

This works great when the web-ui starts. Unfortunately, whenever I update the web-ui by changing a scheulde, the symlink is lost. I suspect this is because d-web is deleting and recreating the ~/.duplicacy-web/duplicacy.json file when it’s changed, rather than just modifying it.

Would be awesome if d-web could instead zero the file instead of deleting it to preserve the symlink.

Added an issue to the ehough docker repo here: duplicacy settings don't stick · Issue #6 · ehough/docker-duplicacy · GitHub

Also, since there are a very specific set of people who will care about this, tagging @k2eric and @gchen. Also tagging @saspus in case this also affects your docker setup.

2 Likes

Good catch.

My container links entire config folder

if [ ! -d ~/.duplicacy-web ]; then
    ln -s /config/  ~/.duplicacy-web
fi

So it is not affected.

However i don’t think it’s a good idea to nuke and recreate a file regardless: the simple fix could be to open existing file for writing and overwrite contents. Even better would be read the file, modify contents and then open it for writing and write out, not to lose changes made outside of the UI.

@saspus I tried to switch to your container, but found a showstopper there, too.
When I run a check command, I get:

Running check command from /var/cache/duplicacy/repositories/localhost/all
Options: [-log check -storage gdrive -a -tabular]
2020-01-26 09:50:19.738 INFO STORAGE_SET Storage set to gcd://backup
2020-01-26 09:50:19.738 ERROR STORAGE_CREATE Failed to load the Google Drive storage at gcd://backup: open /etc/duplicacy/gcd-token-1.json: no such file or directory
Failed to load the Google Drive storage at gcd://backup: open /etc/duplicacy/gcd-token-1.json: no such file or directory

The /etc/duplicacy directory doesn’t exist in your image. I created it and moved my gcd token into that directory and everything works, but that obviously won’t survive a reboot.

I suspect this is because the file locations that the web interface uses aren’t well documented or keep changing. @gchen it would be great to get an official docker image for this.

@saspus I went ahead and created another host folder for etc/duplicacy and bind mounted it into the container. Seems to be working, so this might just be a documentation update for you in your README.md

That’s annoying. The easy fix would be to mount /etc/duplicacy at /config/etc… but indeed, it would be great to get a list of all locations and files web_ui is touching, or expects.

I’ll try to reproduce it later today and patch the container. Thank you for catching this.

This is correct. When updating this file, the new configuration is written to a temporary file first, and then renamed to replace the original copy.

Nope. Can’t reproduce.

I’ve downloaded google token to /config folder (to make it accessible to the container), created storage, picked that file, selected folder (by the way it would be great if it was possible to create a new folder there and not enforce any password policies there) and it works correctly. no /etc/duplicacy in sight.

@gotcode, Please elaborate step by step how are you reproducing.