mirror of
https://github.com/haugene/docker-transmission-openvpn.git
synced 2025-08-06 22:37:18 +02:00
Update main to dev (#2689)
* Add Transmissionic Web UI & New Documentation (#2589) * Added step to build a .deb file to install and reduce image size (#2590) * Added step to build a .deb file to install and reduce image size * Fixed deb install incorrectly done * Check for update-port script existing instead of being executable (#2593) #2459 * Fixed TWC paths (#2600) * add docker build caching to workflow (#2609) * Privoxy eth0 fixes, healthcheck comparison tweak and start.sh update (#2610) * by checking for existence of default 127 address,healthcheck will never effectively run, as the non-default eth0 ip will never be matched * the comparison was not trimming off the port, thus healthcheck was always going to fail or denote a change when there may have been none * simplified the comparison (thanks @edgd1er ) * Strip double quotes from umask check (#2601) * Fix problem with enabled UFW with Random Ports (#2603) Fixing #2255 * move vpn config download to /config (#2592) * move vpn config download to /config * fix git safe dir permissions * cleanup vpn config clone * re-add zip dl, set git to default * use alpine:latest for TransmissionUIs build stage (#2573) * Update fetch-external-configs.sh removed duplicate bracket * Update to transmission 4.0.4 * Update configure-openvpn.sh --------- Co-authored-by: Anastasiya Polina Soyka <apsoyka@protonmail.com> Co-authored-by: Geoff <geoff@gapple.ca> Co-authored-by: ksurl <ksurl@users.noreply.github.com> Co-authored-by: HeavyGee <133152184+heavygee@users.noreply.github.com> Co-authored-by: WitchRecipe <77073792+WitchRecipe@users.noreply.github.com> Co-authored-by: Florian Kretschmer <19738301+Entepotenz@users.noreply.github.com>
This commit is contained in:
parent
445261aa4c
commit
48299204d1
@ -58,3 +58,5 @@ jobs:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha, scope=${{ github.workflow }}
|
||||
cache-to: type=gha, scope=${{ github.workflow}}
|
||||
|
43
Dockerfile
43
Dockerfile
@ -1,4 +1,4 @@
|
||||
FROM alpine:3.13 as TransmissionUIs
|
||||
FROM alpine:latest as TransmissionUIs
|
||||
|
||||
RUN apk --no-cache add curl jq \
|
||||
&& mkdir -p /opt/transmission-ui \
|
||||
@ -14,7 +14,10 @@ RUN apk --no-cache add curl jq \
|
||||
&& mv /opt/transmission-ui/kettu-master /opt/transmission-ui/kettu \
|
||||
&& echo "Install Transmission-Web-Control" \
|
||||
&& mkdir /opt/transmission-ui/transmission-web-control \
|
||||
&& curl -sL $(curl -s https://api.github.com/repos/ronggang/transmission-web-control/releases/latest | jq --raw-output '.tarball_url') | tar -C /opt/transmission-ui/transmission-web-control/ --strip-components=2 -xz
|
||||
&& curl -sL $(curl -s https://api.github.com/repos/ronggang/transmission-web-control/releases/latest | jq --raw-output '.tarball_url') | tar -C /opt/transmission-ui/transmission-web-control/ --strip-components=2 -xz \
|
||||
&& echo "Install Transmissionic" \
|
||||
&& wget -qO- https://github.com/6c65726f79/Transmissionic/releases/download/v1.8.0/Transmissionic-webui-v1.8.0.zip | unzip -q - \
|
||||
&& mv web /opt/transmission-ui/transmissionic
|
||||
|
||||
|
||||
FROM ubuntu:22.04 AS base
|
||||
@ -38,19 +41,22 @@ RUN set -ex; \
|
||||
libpsl-dev \
|
||||
libssl-dev
|
||||
|
||||
|
||||
FROM base as TransmissionBuilder
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG TBT_VERSION=4.0.4
|
||||
|
||||
RUN apt-get update && apt-get install -y curl \
|
||||
build-essential automake autoconf libtool pkg-config intltool libcurl4-openssl-dev \
|
||||
libglib2.0-dev libevent-dev libminiupnpc-dev libgtk-3-dev libappindicator3-dev libssl-dev cmake xz-utils
|
||||
libglib2.0-dev libevent-dev libminiupnpc-dev libgtk-3-dev libappindicator3-dev libssl-dev cmake xz-utils checkinstall
|
||||
|
||||
|
||||
RUN mkdir -p /home/transmission4/ && cd /home/transmission4/ \
|
||||
&& curl -L -o transmission4.tar.xz "https://github.com/transmission/transmission/releases/download/4.0.3/transmission-4.0.3.tar.xz" \
|
||||
&& tar -xf transmission4.tar.xz && cd transmission-4.0.3* && mkdir build && cd build \
|
||||
&& cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. && make && make install
|
||||
&& curl -L -o transmission4.tar.xz "https://github.com/transmission/transmission/releases/download/4.0.4/transmission-4.0.4.tar.xz" \
|
||||
&& tar -xf transmission4.tar.xz && cd transmission-4.0.4* && mkdir build && cd build \
|
||||
&& cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. && make && make install \
|
||||
&& checkinstall -y -D --pkgname transmission --pakdir /var/tmp --pkgversion=${TBT_VERSION}
|
||||
|
||||
|
||||
FROM base
|
||||
@ -59,17 +65,30 @@ VOLUME /data
|
||||
VOLUME /config
|
||||
|
||||
COPY --from=TransmissionUIs /opt/transmission-ui /opt/transmission-ui
|
||||
COPY --from=TransmissionBuilder /usr/local/bin /usr/local/bin
|
||||
COPY --from=TransmissionBuilder /usr/local/share /usr/local/share
|
||||
COPY --from=TransmissionBuilder /var/tmp/*.deb /var/tmp/
|
||||
|
||||
ARG TBT_VERSION=4.0.4
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
RUN echo "installing Transmission" && set -x \
|
||||
&& if [[ ${TBT_VERSION} =~ ^4 ]]; then \
|
||||
ls -alh /var/tmp/*.deb ;\
|
||||
debfile=$(compgen -G /var/tmp/transmission_*_$(dpkg --print-architecture).deb); \
|
||||
if [[ -n ${debfile} ]]; then \
|
||||
echo "Installing transmission ${TBT_VERSION}" && dpkg -i ${debfile} ;\
|
||||
else echo "No /var/tmp/transmission_*_$(dpkg --print-architecture).deb found. Exiting" \
|
||||
; exit ; fi ; \
|
||||
else echo "Installing transmission from repository" \
|
||||
&& export TBT_VERSION=3.00 \
|
||||
&& apt-get install -y --no-install-recommends transmission-daemon transmission-cli; fi
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
dumb-init openvpn privoxy \
|
||||
tzdata dnsutils iputils-ping ufw openssh-client git jq curl wget unrar unzip bc \
|
||||
&& ln -s /usr/share/transmission/web/style /opt/transmission-ui/transmission-web-control \
|
||||
&& ln -s /usr/share/transmission/web/images /opt/transmission-ui/transmission-web-control \
|
||||
&& ln -s /usr/share/transmission/web/javascript /opt/transmission-ui/transmission-web-control \
|
||||
&& ln -s /usr/share/transmission/web/index.html /opt/transmission-ui/transmission-web-control/index.original.html \
|
||||
&& ln -s /usr/local/share/transmission/public_html/images /opt/transmission-ui/transmission-web-control \
|
||||
&& ln -s /usr/local/share/transmission/public_html/transmission-app.js /opt/transmission-ui/transmission-web-control/transmission-app.js \
|
||||
&& ln -s /usr/local/share/transmission/public_html/index.html /opt/transmission-ui/transmission-web-control/index.original.html \
|
||||
&& rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* \
|
||||
&& groupmod -g 1000 users \
|
||||
&& useradd -u 911 -U -d /config -s /bin/false abc \
|
||||
|
@ -82,13 +82,14 @@ This container comes bundled with some alternative Web UIs:
|
||||
* [Transmission-Web-Control](https://github.com/ronggang/transmission-web-control/)
|
||||
* [Flood for Transmission](https://github.com/johman10/flood-for-transmission)
|
||||
* [Shift](https://github.com/killemov/Shift)
|
||||
* [Transmissionic](https://github.com/6c65726f79/Transmissionic)
|
||||
|
||||
To use one of them instead of the default Transmission UI you can set `TRANSMISSION_WEB_UI`
|
||||
to either `combustion`, `kettu`, `transmission-web-control`, `flood-for-transmission` or `shift` respectively.
|
||||
to either `combustion`, `kettu`, `transmission-web-control`, `flood-for-transmission`, `shift` or `transmissionic` respectively.
|
||||
|
||||
| Variable | Function | Example |
|
||||
| ----------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `TRANSMISSION_WEB_UI` | Use the specified bundled web UI | `TRANSMISSION_WEB_UI=combustion` <br>`TRANSMISSION_WEB_UI=kettu` <br>`TRANSMISSION_WEB_UI=transmission-web-control` <br>`TRANSMISSION_WEB_UI=flood-for-transmission` <br>`TRANSMISSION_WEB_UI=shift` |
|
||||
| `TRANSMISSION_WEB_UI` | Use the specified bundled web UI | `TRANSMISSION_WEB_UI=combustion` <br>`TRANSMISSION_WEB_UI=kettu` <br>`TRANSMISSION_WEB_UI=transmission-web-control` <br>`TRANSMISSION_WEB_UI=flood-for-transmission` <br>`TRANSMISSION_WEB_UI=shift` <br>`TRANSMISSION_WEB_UI=transmissionic` |
|
||||
|
||||
### User configuration options
|
||||
|
||||
|
@ -6,7 +6,7 @@ set -o pipefail
|
||||
|
||||
source /etc/openvpn/utils.sh
|
||||
|
||||
VPN_CONFIG_SOURCE_TYPE="${VPN_CONFIG_SOURCE_TYPE:-github_zip}"
|
||||
VPN_CONFIG_SOURCE_TYPE="${VPN_CONFIG_SOURCE_TYPE:-github_clone}"
|
||||
|
||||
# Set default GitHub config repo
|
||||
GITHUB_CONFIG_SOURCE_REPO="${GITHUB_CONFIG_SOURCE_REPO:-haugene/vpn-configs-contrib}"
|
||||
@ -18,19 +18,18 @@ if [[ "${VPN_CONFIG_SOURCE_TYPE}" == "github_zip" ]]; then
|
||||
echo "Cleanup: deleting ${config_repo_temp_zip_file} and ${config_repo_temp_dir}"
|
||||
rm -rf "${config_repo_temp_zip_file}" "${config_repo_temp_dir}"
|
||||
}
|
||||
|
||||
config_repo_temp_zip_file=$(mktemp)
|
||||
config_repo_temp_dir=$(mktemp -d)
|
||||
trap cleanup EXIT
|
||||
|
||||
# Concatenate URL for config bundle from the given GitHub repo
|
||||
GITHUB_CONFIG_BUNDLE_URL="https://github.com/${GITHUB_CONFIG_SOURCE_REPO}/archive/${GITHUB_CONFIG_SOURCE_REVISION}.zip"
|
||||
|
||||
# Create a temporary file and download bundle to it
|
||||
config_repo_temp_zip_file=$(mktemp)
|
||||
echo "Downloading configs from ${GITHUB_CONFIG_BUNDLE_URL} into ${config_repo_temp_zip_file}"
|
||||
curl -sSL --fail -o "${config_repo_temp_zip_file}" "${GITHUB_CONFIG_BUNDLE_URL}"
|
||||
|
||||
# Create a temporary folder and extract configs there
|
||||
config_repo_temp_dir=$(mktemp -d)
|
||||
echo "Extracting configs to ${config_repo_temp_dir}"
|
||||
unzip -q "${config_repo_temp_zip_file}" -d "${config_repo_temp_dir}"
|
||||
|
||||
@ -50,20 +49,28 @@ if [[ "${VPN_CONFIG_SOURCE_TYPE}" == "github_zip" ]]; then
|
||||
|
||||
elif [[ "${VPN_CONFIG_SOURCE_TYPE}" == "github_clone" ]]; then
|
||||
GITHUB_CONFIG_REPO_URL="https://github.com/${GITHUB_CONFIG_SOURCE_REPO}.git"
|
||||
config_repo=/tmp/config-repo
|
||||
config_repo=/config/vpn-configs-contrib
|
||||
|
||||
# Add safe directory for repo folder
|
||||
git config --global --add safe.directory "${config_repo}"
|
||||
|
||||
echo "Will get configs from ${GITHUB_CONFIG_REPO_URL}"
|
||||
# Check if git repo exists and clone or pull based on that
|
||||
if [[ -d ${config_repo} ]]; then
|
||||
GITHUB_CONFIG_SOURCE_LOCAL=$(git -C "${config_repo}" remote -v | head -1 | awk '{print $2}' | sed -e 's/https:\/\/github.com\///' -e 's/.git//')
|
||||
if [ "$GITHUB_CONFIG_SOURCE_LOCAL" == "$GITHUB_CONFIG_SOURCE_REPO" ]; then
|
||||
echo "Repository is already cloned, checking for update"
|
||||
cd ${config_repo}
|
||||
git pull
|
||||
git checkout "${GITHUB_CONFIG_SOURCE_REVISION}"
|
||||
git -C "${config_repo}" pull
|
||||
git -C "${config_repo}" checkout "${GITHUB_CONFIG_SOURCE_REVISION}"
|
||||
else
|
||||
echo "Cloning ${GITHUB_CONFIG_REPO_URL} into ${config_repo}"
|
||||
git clone "${GITHUB_CONFIG_REPO_URL}" ${config_repo}
|
||||
cd ${config_repo}
|
||||
git checkout "${GITHUB_CONFIG_SOURCE_REVISION}"
|
||||
config_repo_old="${config_repo}" + "_old"
|
||||
mv "${config_repo}" "${config_repo_old}"
|
||||
git clone -b "${GITHUB_CONFIG_SOURCE_REVISION}" "${GITHUB_CONFIG_REPO_URL}" "${config_repo}"
|
||||
fi
|
||||
else
|
||||
echo "Cloning ${GITHUB_CONFIG_REPO_URL} into ${config_repo}"
|
||||
git clone -b "${GITHUB_CONFIG_SOURCE_REVISION}" "${GITHUB_CONFIG_REPO_URL}" "${config_repo}"
|
||||
fi
|
||||
|
||||
# Find the specified provider folder. Should be under <tmpDir>/<some-root-folder>/openvpn/<provider>
|
||||
@ -79,7 +86,6 @@ elif [[ "${VPN_CONFIG_SOURCE_TYPE}" == "github_clone" ]]; then
|
||||
cp -r "${provider_configs}" "${VPN_PROVIDER_HOME}"
|
||||
|
||||
exit 0
|
||||
|
||||
else
|
||||
"ERROR: VPN config source type ${VPN_CONFIG_SOURCE_TYPE} does not exist..."
|
||||
exit 1
|
||||
|
@ -42,6 +42,7 @@ echo "creating temp folder"
|
||||
mkdir /tmp/ovpnxtract/
|
||||
echo "entering temp folder"
|
||||
cd /tmp/ovpnxtract/
|
||||
echo "cloning contrib git"
|
||||
git clone https://github.com/haugene/vpn-configs-contrib.git
|
||||
echo "moving content"
|
||||
mv /tmp/ovpnxtract/vpn-configs-contrib/openvpn/ovpn/* /etc/openvpn/ovpn
|
||||
|
@ -245,8 +245,14 @@ function ufwAllowPort {
|
||||
portNum=${1}
|
||||
if [[ "${ENABLE_UFW,,}" == "true" ]] && [[ -n "${portNum-}" ]]; then
|
||||
echo "allowing ${portNum} through the firewall"
|
||||
if [[ $portNum == *":"* ]];
|
||||
then
|
||||
ufw allow ${portNum}/tcp
|
||||
ufw allow ${portNum}/udp
|
||||
else
|
||||
ufw allow ${portNum}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
## Open port to specific address.
|
||||
|
@ -27,7 +27,7 @@ set_port()
|
||||
# Set the port for the IPv4 interface
|
||||
adr=$(ip -4 a show eth0| grep -oP "(?<=inet )([^/]+)")
|
||||
adr=${adr:-"0.0.0.0"}
|
||||
sed -i -E "s/^listen-address\s+127.*/listen-address ${adr}:$1/" "$2"
|
||||
sed -i -E "s/^listen-address\s+.*/listen-address ${adr}:$1/" "$2"
|
||||
|
||||
# Remove the listen-address for IPv6 for now. IPv6 compatibility should come later
|
||||
sed -i -E "s/^listen-address\s+\[\:\:1.*//" "$2"
|
||||
|
@ -59,7 +59,7 @@ if [[ ${WEBPROXY_ENABLED} =~ [yY][eE]?[Ss]?|[tT][Rr][Uu][eE] ]]; then
|
||||
if [[ ${PROXY} -eq 0 ]]; then
|
||||
echo "Privoxy warning: process was stopped, restarting."
|
||||
fi
|
||||
proxy_ip=$(grep -oP "(?<=^listen-address).*$" /etc/privoxy/config | sed 's/ //g')
|
||||
proxy_ip=$(grep -oP "(?<=^listen-address )[0-9\.]+" /etc/privoxy/config)
|
||||
cont_ip=$(ip -j a show dev eth0 | jq -r .[].addr_info[].local)
|
||||
if [[ ${proxy_ip} != ${cont_ip} ]]; then
|
||||
echo "Privoxy error: container ip (${cont_ip} has changed: privoxy listening to ${proxy_ip}, restarting privoxy."
|
||||
|
@ -56,6 +56,11 @@ if [[ "shift" = "$TRANSMISSION_WEB_UI" ]]; then
|
||||
export TRANSMISSION_WEB_HOME=/opt/transmission-ui/shift
|
||||
fi
|
||||
|
||||
if [[ "transmissionic" = "$TRANSMISSION_WEB_UI" ]]; then
|
||||
echo "Using Transmissionic UI, overriding TRANSMISSION_WEB_HOME"
|
||||
export TRANSMISSION_WEB_HOME=/opt/transmission-ui/transmissionic
|
||||
fi
|
||||
|
||||
case ${TRANSMISSION_LOG_LEVEL,,} in
|
||||
"trace" | "debug" | "info" | "warn" | "error" | "critical")
|
||||
echo "Will exec Transmission with '--log-level=${TRANSMISSION_LOG_LEVEL,,}' argument"
|
||||
@ -100,7 +105,7 @@ exec su --preserve-environment ${RUN_AS} -s /bin/bash -c "/usr/local/bin/transmi
|
||||
|
||||
|
||||
# Configure port forwarding if applicable
|
||||
if [[ -x /etc/openvpn/${OPENVPN_PROVIDER,,}/update-port.sh && (-z $DISABLE_PORT_UPDATER || "false" = "$DISABLE_PORT_UPDATER") ]]; then
|
||||
if [[ -f /etc/openvpn/${OPENVPN_PROVIDER,,}/update-port.sh && (-z $DISABLE_PORT_UPDATER || "false" = "$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 &
|
||||
|
Loading…
Reference in New Issue
Block a user