-
Notifications
You must be signed in to change notification settings - Fork 1
Synology NAS Hosting Instructions
Jared Johnson edited this page Nov 23, 2021
·
2 revisions
- Install the Docker package, then download the
cmeury/bread-bucket
image. - Setup a container with the buckets file mounted to
/app/db.buckets
and a port-forward from 5000 to 5000. - Expose the server using dynamic DNS, port-forward in your home router and a reverse proxy
New images are not automatically used by containers on Synology. We need to manually force it:
- Docker - Image - Add From URL: Enter
cmeury/bread-bucket
. A little blue bubble should appear next to 'Image' on the left. - Wait until image is refreshed (bubble is gone)
- Duplicate configuration of container (Settings - Duplicate Settings)
- Delete the old one
- Set again the port of the new one to a static one
- Run the new containe configuration
The inotify setup is not working properly in the host when a mounted file is modified inside a Docker container. So, we need to 'touch' it after committing a new transaction to the SQLite file.
Create a file called check_buckets.sh
in /volume1/Drive
and make it executable: chmod +x check_buckets.sh
.
#!/bin/bash -eu
# script that maintains a hash of a file and touches the file if it has
# changed. this is a workaround of a docker mounted volume shortcoming.
file="bun-bun-test.buckets"
md5_file="${file}.md5"
current_md5sum=$(md5sum "${file}")
stored_md5sum=$(cat "${md5_file}")
if [[ "${current_md5sum}" != "${stored_md5sum}" ]]; then
echo "File hash changed, updating file (${md5_file}): ${stored_md5sum} -> ${current_md5sum}"
echo "${current_md5sum}" > "${md5_file}"
echo "Touching file to trigger Synology Drive update.."
touch "${file}"
else
echo "File hash unchanged: ${current_md5sum}"
fi
Set up a regular script (every minute or less) in Control Panel - Task Scheduler of type 'User-defined script' with the following settings:
And this script:
cd /volume1/Drive
./check_buckets.sh