From 86eb6a87278a1758d87f475394d43c96c96026fc Mon Sep 17 00:00:00 2001 From: Patrick Kishino Date: Thu, 21 Oct 2021 15:46:30 +0900 Subject: [PATCH] Added fallback and more explicit warning message (#2020) * Added fallback and more explicit warning message --- docker-compose.yml | 37 +++++++++++++++++-------------------- docs/config-options.md | 4 +++- docs/run-container.md | 1 + transmission/userSetup.sh | 22 +++++++++------------- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f1adbc7c3..7c384fec2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,31 +9,28 @@ services: restart: always ports: - "9091:9091" - - "8888:8888" - dns: - - 8.8.8.8 - - 8.8.4.4 + # - "8888:8888" # proxy support volumes: - - /etc/localtime:/etc/localtime:ro - - /your/storage/path/:/data + - /your/storage/path/:/data # where transmission will store the data + - /your/config/path/:/config # where transmission-home is stored environment: - OPENVPN_PROVIDER=PIA - OPENVPN_USERNAME=username - OPENVPN_PASSWORD=password - OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60 - LOCAL_NETWORK=192.168.0.0/24 - proxy: - image: haugene/transmission-openvpn-proxy - links: - - transmission - ports: - - 8080:8080 - volumes: - - /etc/localtime:/etc/localtime:ro + # proxy: + # image: haugene/transmission-openvpn-proxy + # links: + # - transmission + # ports: + # - 8080:8080 + # volumes: + # - /etc/localtime:/etc/localtime:ro - rss: - image: haugene/transmission-rss - links: - - transmission - environment: - - RSS_URL=http://.../xxxxx.rss + # rss: + # image: haugene/transmission-rss + # links: + # - transmission + # environment: + # - RSS_URL=http://.../xxxxx.rss diff --git a/docs/config-options.md b/docs/config-options.md index 6c0ee5bf4..c5a24e9a7 100755 --- a/docs/config-options.md +++ b/docs/config-options.md @@ -87,8 +87,10 @@ In previous versions of this container the settings were not persistent but was This had the benefit of being very explicit and reproducable but you had to provide Transmission config as environment variables if you wanted them to stay that way between container restarts. This felt cumbersome to many. -As of version 3.0 this is no longer true. Settings are now persisted in the `/config/transmission-home` folder in the container and as +As of version 5.0 this is no longer true. Settings are now persisted in the `/config/transmission-home` folder in the container and as long as you mount `/config` you should be able to configure Transmission using the UI as you normally would. +if you are using the container from earlier versions and have not changed the location of transmission-home to /config, you will see a warning message that the default has changed. +You can manually move the folder to your /config volume directory after stopping the container and adding the /config mount to your container setup (compose/run etc). You may still override Transmission options by setting environment variables if that's your thing. The variables are named after the transmission config they target but are prefixed with `TRANSMISSION_`, capitalized, and `-` is converted to `_`. diff --git a/docs/run-container.md b/docs/run-container.md index b9c0061eb..7a2f734d6 100755 --- a/docs/run-container.md +++ b/docs/run-container.md @@ -42,6 +42,7 @@ services: - NET_ADMIN volumes: - '/your/storage/path/:/data' + - '/your/config/path/:/config' environment: - OPENVPN_PROVIDER=PIA - OPENVPN_CONFIG=france diff --git a/transmission/userSetup.sh b/transmission/userSetup.sh index 607c88c40..1af215c39 100644 --- a/transmission/userSetup.sh +++ b/transmission/userSetup.sh @@ -17,21 +17,17 @@ if [ -n "$PUID" ] && [ ! "$(id -u root)" -eq "$PUID" ]; then chown ${RUN_AS}:${RUN_AS} /dev/stdout fi + echo "TRANSMISSION_HOME is set to: ${TRANSMISSION_HOME}" if [[ "${TRANSMISSION_HOME%/*}" != "/config" ]]; then - echo "WARNING: TRANSMISSION_HOME mountpoint is not on default /config, this is not recommended." + echo "WARNING: TRANSMISSION_HOME mountpoint is not on default /config, this is not recommended." + echo "This warning will be displayed as long as TRANSMISSION_HOME is not set to /config mount." + echo "If you would like to migrate your existing TRANSMISSION_HOME, please stop the container, add volume /config and move the transmission-home directory there." fi - - #If migration is enabled, attempt to move transmission-home - if [[ "$TRANSMISSION_HOME_MIGRATE" = true ]]; then - TRANSMISSION_HOME_SUBNAME=${TRANSMISSION_HOME##*/} - echo "Attempting to migrate old TRANSMISSION_HOME from /data/$TRANSMISSION_HOME_SUBNAME to /config/$TRANSMISSION_HOME_SUBNAME " - if [ -d "/data/$TRANSMISSION_HOME_SUBNAME" ] && [ ! -d "/config/$TRANSMISSION_HOME_SUBNAME" ]; then - mv "/data/$TRANSMISSION_HOME_SUBNAME" "/config/$TRANSMISSION_HOME_SUBNAME" - TRANSMISSION_HOME="/config/$TRANSMISSION_HOME_SUBNAME" - TRANSMISSION_HOME_MIGRATE=false - else - echo "Could not migrate, please check for existing folder in /config or missing folder in /data" - fi + #Old default transmission-home exists, use as fallback + if [ -d "/data/transmission-home" ]; then + TRANSMISSION_HOME="/data/transmission-home" + echo "WARNING: Deprecated. Found old default transmission-home folder in the /data mount, setting this as TRANSMISSION_HOME. This might break in future versions." + echo "We will fallback to this directory as long as the folder exists. Please consider moving it to /config" fi # Make sure directories exist before chown and chmod