* Bundle Flood WebUI

Add the Flood WebUI to the default installation of the container.

The Flood UI offers no pre-built tarball for installation, so the source
is cloned and compiled in a separate stage container. Then the resulting
build files are copied to the final image. Build size only increases by
~1MB, but build times are slightly longer due to the added complexity.

Resolves #1661

* Update docs to include new supported WebUI
This commit is contained in:
Joshua Arulsamy 2021-01-18 18:41:13 -07:00 committed by GitHub
parent 75d0b53642
commit ab91d6735a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 31 deletions

View File

@ -1,3 +1,13 @@
# Build Flood UI seperately to keep image size small
FROM node:15.5.1-alpine3.10 AS FloodUIBuilder
WORKDIR /tmp/flood
RUN echo "Build Flood UI" \
&& apk add --no-cache git \
&& git clone --depth=1 https://github.com/johman10/flood-for-transmission.git . \
&& npm install \
&& npm run build
FROM alpine:3.12
VOLUME /data
@ -24,6 +34,9 @@ RUN echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /et
&& useradd -u 911 -U -d /config -s /bin/false abc \
&& usermod -G users abc
# Bring over flood UI from previous build stage
COPY --from=FloodUIBuilder /tmp/flood/public /opt/transmission-ui/flood
# Add configuration and scripts
ADD openvpn/ /etc/openvpn/
ADD transmission/ /etc/transmission/

View File

@ -1,4 +1,5 @@
### Required environment options
| Variable | Function | Example |
| ------------------ | --------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `OPENVPN_PROVIDER` | Sets the OpenVPN provider to use. | `OPENVPN_PROVIDER=provider`. Supported providers and their config values are listed in the table above. |
@ -6,6 +7,7 @@
| `OPENVPN_PASSWORD` | Your OpenVPN password | `OPENVPN_PASSWORD=asdf` |
### Network configuration options
| Variable | Function | Example |
| ------------------- | --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `OPENVPN_CONFIG` | Sets the OpenVPN endpoint to connect to. | `OPENVPN_CONFIG=UK Southampton` |
@ -17,12 +19,12 @@
Set a custom timezone in tz database format. Look [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for a list of valid timezones. Defaults to UTC.
| Variable | Function | Example |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| `TZ` | Set Timezone | `TZ=UTC` |
| Variable | Function | Example |
| -------- | ------------ | -------- |
| `TZ` | Set Timezone | `TZ=UTC` |
### Firewall configuration options
When enabled, the firewall blocks everything except traffic to the peer port and traffic to the rpc port from the LOCAL_NETWORK and the internal docker gateway.
If TRANSMISSION_PEER_PORT_RANDOM_ON_START is enabled then it allows traffic to the range of peer ports defined by TRANSMISSION_PEER_PORT_RANDOM_HIGH and TRANSMISSION_PEER_PORT_RANDOM_LOW.
@ -43,6 +45,7 @@ Because your VPN connection can sometimes fail, Docker will run a health check o
| `HEALTH_CHECK_HOST` | this host is pinged to check if the network connection still works | `google.com` |
### Permission configuration options
By default the startup script applies a default set of permissions and ownership on the transmission download, watch and incomplete directories. The GLOBAL_APPLY_PERMISSIONS directive can be used to disable this functionality.
| Variable | Function | Example |
@ -50,14 +53,15 @@ By default the startup script applies a default set of permissions and ownership
| `GLOBAL_APPLY_PERMISSIONS` | Disable setting of default permissions | `GLOBAL_APPLY_PERMISSIONS=false` |
### Alternative web UIs
You can override the default web UI by setting the ```TRANSMISSION_WEB_HOME``` environment variable. If set, Transmission will look there for the Web Interface files, such as the javascript, html, and graphics files.
[Combustion UI](https://github.com/Secretmapper/combustion), [Kettu](https://github.com/endor/kettu) and [Transmission-Web-Control](https://github.com/ronggang/transmission-web-control/) come bundled with the container. You can enable either of them by setting```TRANSMISSION_WEB_UI=combustion```, ```TRANSMISSION_WEB_UI=kettu``` or ```TRANSMISSION_WEB_UI=transmission-web-control```, respectively. Note that this will override the ```TRANSMISSION_WEB_HOME``` variable if set.
You can override the default web UI by setting the `TRANSMISSION_WEB_HOME` environment variable. If set, Transmission will look there for the Web Interface files, such as the javascript, html, and graphics files.
| Variable | Function | Example |
| ----------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `TRANSMISSION_WEB_HOME` | Set Transmission web home | `TRANSMISSION_WEB_HOME=/path/to/web/ui` |
| `TRANSMISSION_WEB_UI` | Use the specified bundled web UI | `TRANSMISSION_WEB_UI=combustion`, `TRANSMISSION_WEB_UI=kettu` or `TRANSMISSION_WEB_UI=transmission-web-control` |
[Combustion UI](https://github.com/Secretmapper/combustion), [Kettu](https://github.com/endor/kettu), [Transmission-Web-Control](https://github.com/ronggang/transmission-web-control/), and [Flood](https://github.comjesec/flood) come bundled with the container. You can enable either of them by setting`TRANSMISSION_WEB_UI=combustion`, `TRANSMISSION_WEB_UI=kettu` or `TRANSMISSION_WEB_UI=transmission-web-control`, respectively. Note that this will override the `TRANSMISSION_WEB_HOME` variable if set.
| Variable | Function | Example |
| ----------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `TRANSMISSION_WEB_HOME` | Set Transmission web home | `TRANSMISSION_WEB_HOME=/path/to/web/ui` |
| `TRANSMISSION_WEB_UI` | Use the specified bundled web UI | `TRANSMISSION_WEB_UI=combustion`, `TRANSMISSION_WEB_UI=kettu`, `TRANSMISSION_WEB_UI=transmission-web-control`, or `TRANSMISSION_WEB_UI=flood` |
### Transmission configuration options
@ -96,15 +100,15 @@ This might lead to the default route (your untunneled connection) to be used.
To drop the default route set the environment variable `DROP_DEFAULT_ROUTE` to `true`.
*Note*: This is not compatible with all VPNs. You can check your iptables routing with the `ip r` command in a running container.
_Note_: This is not compatible with all VPNs. You can check your iptables routing with the `ip r` command in a running container.
### Changing logging locations
By default Transmission will log to a file in `TRANSMISSION_HOME/transmission.log`.
By default Transmission will log to a file in `TRANSMISSION_HOME/transmission.log`.
To log to stdout instead set the environment variable `LOG_TO_STDOUT` to `true`.
*Note*: By default stdout is what container engines read logs from. Set this to true to have Tranmission logs in commands like `docker logs` and `kubectl logs`. OpenVPN currently only logs to stdout.
_Note_: By default stdout is what container engines read logs from. Set this to true to have Tranmission logs in commands like `docker logs` and `kubectl logs`. OpenVPN currently only logs to stdout.
### Custom scripts

View File

@ -7,25 +7,24 @@
# See https://openvpn.net/index.php/open-source/documentation/manuals/65-openvpn-20x-manpage.html (--up cmd)
echo "Up script executed with $*"
if [[ "$4" = "" ]]; then
echo "ERROR, unable to obtain tunnel address"
echo "killing $PPID"
kill -9 $PPID
exit 1
echo "ERROR, unable to obtain tunnel address"
echo "killing $PPID"
kill -9 $PPID
exit 1
fi
# If transmission-pre-start.sh exists, run it
if [[ -x /scripts/transmission-pre-start.sh ]]
then
echo "Executing /scripts/transmission-pre-start.sh"
/scripts/transmission-pre-start.sh "$@"
echo "/scripts/transmission-pre-start.sh returned $?"
if [[ -x /scripts/transmission-pre-start.sh ]]; then
echo "Executing /scripts/transmission-pre-start.sh"
/scripts/transmission-pre-start.sh "$@"
echo "/scripts/transmission-pre-start.sh returned $?"
fi
echo "Updating TRANSMISSION_BIND_ADDRESS_IPV4 to the ip of $1 : $4"
export TRANSMISSION_BIND_ADDRESS_IPV4=$4
# Also update the persisted settings in case it is already set. First remove any old value, then add new.
sed -i '/TRANSMISSION_BIND_ADDRESS_IPV4/d' /etc/transmission/environment-variables.sh
echo "export TRANSMISSION_BIND_ADDRESS_IPV4=$4" >> /etc/transmission/environment-variables.sh
echo "export TRANSMISSION_BIND_ADDRESS_IPV4=$4" >>/etc/transmission/environment-variables.sh
if [[ "combustion" = "$TRANSMISSION_WEB_UI" ]]; then
echo "Using Combustion UI, overriding TRANSMISSION_WEB_HOME"
@ -42,6 +41,11 @@ if [[ "transmission-web-control" = "$TRANSMISSION_WEB_UI" ]]; then
export TRANSMISSION_WEB_HOME=/opt/transmission-ui/transmission-web-control
fi
if [[ "flood" = "$TRANSMISSION_WEB_UI" ]]; then
echo "Using Transmission Web Control UI, overriding TRANSMISSION_WEB_HOME"
export TRANSMISSION_WEB_HOME=/opt/transmission-ui/flood
fi
echo "Updating Transmission settings.json with values from env variables"
# Ensure TRANSMISSION_HOME is created
mkdir -p ${TRANSMISSION_HOME}
@ -74,17 +78,16 @@ exec su --preserve-environment ${RUN_AS} -s /bin/bash -c "/usr/bin/transmission-
# Configure port forwarding if applicable
if [[ -x /etc/openvpn/${OPENVPN_PROVIDER,,}/update-port.sh && -z $DISABLE_PORT_UPDATER ]]; then
echo "Provider ${OPENVPN_PROVIDER^^} has a script for automatic port forwarding. Will run it now."
echo "If you want to disable this, set environment variable DISABLE_PORT_UPDATER=true"
exec /etc/openvpn/${OPENVPN_PROVIDER,,}/update-port.sh &
echo "Provider ${OPENVPN_PROVIDER^^} has a script for automatic port forwarding. Will run it now."
echo "If you want to disable this, set environment variable DISABLE_PORT_UPDATER=true"
exec /etc/openvpn/${OPENVPN_PROVIDER,,}/update-port.sh &
fi
# If transmission-post-start.sh exists, run it
if [[ -x /scripts/transmission-post-start.sh ]]
then
echo "Executing /scripts/transmission-post-start.sh"
/scripts/transmission-post-start.sh "$@"
echo "/scripts/transmission-post-start.sh returned $?"
if [[ -x /scripts/transmission-post-start.sh ]]; then
echo "Executing /scripts/transmission-post-start.sh"
/scripts/transmission-post-start.sh "$@"
echo "/scripts/transmission-post-start.sh returned $?"
fi
echo "Transmission startup script complete."