diff --git a/.github/workflows/image-build-template-workflow.yml b/.github/workflows/image-build-template-workflow.yml index 785eacff3c..76b17afa05 100644 --- a/.github/workflows/image-build-template-workflow.yml +++ b/.github/workflows/image-build-template-workflow.yml @@ -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}} diff --git a/Dockerfile b/Dockerfile index e792f9989e..bb5e917a0b 100644 --- a/Dockerfile +++ b/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 \ diff --git a/docs/config-options.md b/docs/config-options.md index 56af1a5b62..66a0d5e663 100755 --- a/docs/config-options.md +++ b/docs/config-options.md @@ -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`
`TRANSMISSION_WEB_UI=kettu`
`TRANSMISSION_WEB_UI=transmission-web-control`
`TRANSMISSION_WEB_UI=flood-for-transmission`
`TRANSMISSION_WEB_UI=shift` | +| `TRANSMISSION_WEB_UI` | Use the specified bundled web UI | `TRANSMISSION_WEB_UI=combustion`
`TRANSMISSION_WEB_UI=kettu`
`TRANSMISSION_WEB_UI=transmission-web-control`
`TRANSMISSION_WEB_UI=flood-for-transmission`
`TRANSMISSION_WEB_UI=shift`
`TRANSMISSION_WEB_UI=transmissionic` | ### User configuration options diff --git a/openvpn/fetch-external-configs.sh b/openvpn/fetch-external-configs.sh index 26f65e1e01..82192f6ff2 100755 --- a/openvpn/fetch-external-configs.sh +++ b/openvpn/fetch-external-configs.sh @@ -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 - echo "Repository is already cloned, checking for update" - cd ${config_repo} - git pull - git checkout "${GITHUB_CONFIG_SOURCE_REVISION}" + 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" + git -C "${config_repo}" pull + git -C "${config_repo}" checkout "${GITHUB_CONFIG_SOURCE_REVISION}" + else + echo "Cloning ${GITHUB_CONFIG_REPO_URL} into ${config_repo}" + 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 "${GITHUB_CONFIG_REPO_URL}" ${config_repo} - cd ${config_repo} - git checkout "${GITHUB_CONFIG_SOURCE_REVISION}" + git clone -b "${GITHUB_CONFIG_SOURCE_REVISION}" "${GITHUB_CONFIG_REPO_URL}" "${config_repo}" fi # Find the specified provider folder. Should be under //openvpn/ @@ -79,8 +86,7 @@ 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 + "ERROR: VPN config source type ${VPN_CONFIG_SOURCE_TYPE} does not exist..." + exit 1 fi diff --git a/openvpn/ovpn/configure-openvpn.sh b/openvpn/ovpn/configure-openvpn.sh index d357c6df3e..7231c7e50c 100755 --- a/openvpn/ovpn/configure-openvpn.sh +++ b/openvpn/ovpn/configure-openvpn.sh @@ -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 diff --git a/openvpn/start.sh b/openvpn/start.sh index bcd228bedb..6de5b577b4 100755 --- a/openvpn/start.sh +++ b/openvpn/start.sh @@ -245,7 +245,13 @@ function ufwAllowPort { portNum=${1} if [[ "${ENABLE_UFW,,}" == "true" ]] && [[ -n "${portNum-}" ]]; then echo "allowing ${portNum} through the firewall" - ufw allow ${portNum} + if [[ $portNum == *":"* ]]; + then + ufw allow ${portNum}/tcp + ufw allow ${portNum}/udp + else + ufw allow ${portNum} + fi fi } diff --git a/privoxy/scripts/start.sh b/privoxy/scripts/start.sh index 8201d6dd38..892c09a4dc 100755 --- a/privoxy/scripts/start.sh +++ b/privoxy/scripts/start.sh @@ -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" diff --git a/scripts/healthcheck.sh b/scripts/healthcheck.sh index 8c5646c50f..bb431e8645 100755 --- a/scripts/healthcheck.sh +++ b/scripts/healthcheck.sh @@ -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." diff --git a/transmission/start.sh b/transmission/start.sh index f6d45f92dd..94775afceb 100755 --- a/transmission/start.sh +++ b/transmission/start.sh @@ -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 &