Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
derekcentrico committed Oct 24, 2023
2 parents 158fd3e + 7a11219 commit 153b205
Show file tree
Hide file tree
Showing 19 changed files with 298 additions and 98 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/check-transmission-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Transmission Version Check

on:
schedule:
- cron: 0 * * * *
workflow_dispatch: {}

jobs:
get-transmission-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: dev

- name: Check for new version of Transmission
run: |
LATEST_VERSION=$(curl -L https://api.github.com/repos/transmission/transmission/releases/latest | grep tag_name | awk '{print $2}' | sed -e 's/"//g' -e 's/,//')
CURRENT_VERSION=$(cat upstream/transmission-version.txt)
if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then
echo "$LATEST_VERSION" > upstream/transmission-version.txt
git add upstream/transmission-version.txt
git commit -m "update transmission build version to ${LATEST_VERSION}"
git push origin dev
fi
78 changes: 60 additions & 18 deletions .github/workflows/docker-image-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,65 @@ on:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
build-main-images:
uses: ./.github/workflows/image-build-template-workflow.yml
with:
image-name: haugene/transmission-openvpn
build-context: '.'
secrets: inherit
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image-name:
- haugene/transmission-openvpn
- haugene/transmission-openvpn-proxy
- haugene/transmission-rss
include:
- image-name: haugene/transmission-openvpn
context: ./
- image-name: haugene/transmission-openvpn-proxy
context: ./proxy
- image-name: haugene/transmission-rss
context: ./plugins/rss
steps:
- name: Checkout code
uses: actions/checkout@v4

build-proxy-images:
uses: ./.github/workflows/image-build-template-workflow.yml
with:
image-name: haugene/transmission-openvpn-proxy
build-context: 'proxy'
secrets: inherit
# QEMU emulator to build for other platforms
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

build-rss-plugin-images:
uses: ./.github/workflows/image-build-template-workflow.yml
with:
image-name: haugene/transmission-rss
build-context: 'plugins/rss'
secrets: inherit
# Buildx automates creating the multi-arch manifest build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# Authenticate so that we can push to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Generate image tags and labels
- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ matrix.image-name }}
tags: |
type=edge
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# Finally, build and push the images
- name: Build image
uses: docker/build-push-action@v4
with:
context: ${{ matrix.context }}
platforms: linux/amd64,linux/arm,linux/arm64
build-args: |
REVISION=${{ github.sha }}
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}}
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
name: Reusable workflow for building multi-arch images
name: Transmission Builds

on:
workflow_call:
inputs:
image-name:
required: true
type: string

build-context:
required: true
type: string
workflow_dispatch: {}
push:
branches:
- dev
paths:
- upstream/transmission-version.txt

jobs:
setup-build-push:
build-transmission:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

# Get latest version of Transmission
- name: Get Transmission version
run: |
LATEST_VERSION=$(cat upstream/transmission-version.txt)
echo "TBT_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
# QEMU emulator to build for other platforms
- name: Set up QEMU
Expand All @@ -33,28 +36,25 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Generate image tags and labels
# Generate image tag and labels
- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ inputs.image-name }}
tags: |
type=edge
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# Finally, build and push the images
images: haugene/transmission-builder
tags: type=match,pattern=(\d+.\d+.\d+),group=1,value=${{ env.TBT_VERSION }}

# Finally, build and push the image
- name: Build image
uses: docker/build-push-action@v4
with:
context: ${{ inputs.build-context }}
platforms: linux/arm,linux/arm64,linux/amd64
context: upstream
platforms: linux/amd64,linux/arm,linux/arm64
build-args: |
REVISION=${{ github.sha }}
push: ${{ github.event_name != 'pull_request' }}
TBT_VERSION=${{ env.TBT_VERSION }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow}}
2 changes: 1 addition & 1 deletion .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
Expand Down
47 changes: 25 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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
Expand All @@ -38,38 +41,38 @@ RUN set -ex; \
libpsl-dev \
libssl-dev

FROM base as TransmissionBuilder

ARG DEBIAN_FRONTEND=noninteractive

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


RUN mkdir -p /home/transmission4/ && cd /home/transmission4/ \
&& 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

FROM haugene/transmission-builder:4.0.4 as TransmissionBuilder

FROM base

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 \
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OpenVPN and Transmission with WebUI

[![Docker Build](https://img.shields.io/github/actions/workflow/status/haugene/docker-transmission-openvpn/docker-image-builds.yml
)](https://hub.docker.com/r/haugene/transmission-openvpn/)
[![Docker Pulls](https://img.shields.io/docker/pulls/haugene/transmission-openvpn.svg)](https://hub.docker.com/r/haugene/transmission-openvpn/)

This container contains OpenVPN and Transmission with a configuration
Expand Down
5 changes: 3 additions & 2 deletions docs/config-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
53 changes: 51 additions & 2 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,14 @@ if basic network connectivity is broken. You can write your own script and add i

This container has the `autoheal` label by default so it is compatible with the [willfarrell/autoheal image](https://hub.docker.com/r/willfarrell/autoheal/)


## Send Username and Password via a file

Depending on your setup, you may not want to send your VPN user/pass via environment variables (the main reason being, it is accessible via docker inspect). If you prefer, there is a way to configure the container to use a file instead.
Depending on your setup, you may not want to send your VPN user/pass via environment variables (the main reason being, it is accessible via docker inspect). If you prefer, there are two methods of avoiding credentials to be set via environment variables:
- Option 1: Configure the container to use a file.
- Option 2: Configure the container to use a `secret`. (Only available for Docker Swarm)

*Procedure*
*Procedure for Option 1: Configuring the container to use a file*
1. Create a text file with a username and password in it, each on a separate line.
For this example, we will assume it is located at `./openvpn-credentials.txt`
```
Expand Down Expand Up @@ -226,6 +229,52 @@ services:
image: haugene/transmission-openvpn
```

*Procedure for Option 2: Configure the container to use a `secret`*

Note: [Docker Secrets](https://docs.docker.com/engine/swarm/secrets/) are only available for Docker Swarm (`docker-compose`). If you run the container standalone, refer to Option 1.

1. Create a text file with a username and password in it, each on a separate line.
For this example, we will assume it is located at `./openvpn-credentials.txt`
```
this_is_my_username
this_is_my_password
```

1. Mount the file as a secret like below. *The name of the secret must be exactly `openvpn_creds`, which will be exposed to the container at `/run/secrets/openvpn_creds`.

The example docker-compose.yml looks like this:

```
version: '3.3'
secrets:
openvpn_creds:
file: './openvpn-credentials.txt'
services:
transmission-openvpn:
cap_add:
- NET_ADMIN
volumes:
- '/your/storage/path/:/data'
environment:
- OPENVPN_PROVIDER=PIA
- OPENVPN_CONFIG=france
- OPENVPN_USERNAME=**None**
- OPENVPN_PASSWORD=**None**
- LOCAL_NETWORK=192.168.0.0/16
logging:
driver: json-file
options:
max-size: 10m
secrets:
- openvpn_creds
ports:
- '9091:9091'
image: haugene/transmission-openvpn
```

Bonus tip: The same steps can be followed for `rpc_creds`, as shown in [[How do I enable authentication in the web ui](#how_do_i_enable_authentication_in_the_web_UI)].


## AUTH: Received control message: AUTH_FAILED

If your logs end like this, the wrong username/password was sent to your VPN provider.
Expand Down
2 changes: 2 additions & 0 deletions docs/provider-specific.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ I'm [on it (#1558)](https://github.com/haugene/docker-transmission-openvpn/issue

The update script is based on the NordVPN API. The API sends back the best recommended OpenVPN configuration file based on the filters given.

You have to use your service credentials instead of your regular email and password. They can be found [here](https://my.nordaccount.com/dashboard/nordvpn/manual-configuration/).

Available ENV variables in the container to define via the NordVPN API the file to use are:

| Variable | Function | Example |
Expand Down
Loading

0 comments on commit 153b205

Please sign in to comment.