Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2d63e8e4fd | ||
|
db03b8cd0a |
30
Dockerfile
30
Dockerfile
@ -133,15 +133,21 @@ RUN apt update \
|
|||||||
jq \
|
jq \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
qtbase5-dev \
|
|
||||||
qttools5-dev \
|
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
&& QBITTORRENT_RELEASE=$(curl -sX GET "https://api.github.com/repos/qBittorrent/qBittorrent/tags" | jq '.[] | select(.name | index ("alpha") | not) | select(.name | index ("beta") | not) | select(.name | index ("rc") | not) | .name' | head -n 1 | tr -d '"') \
|
&& echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable.list \
|
||||||
|
&& printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable \
|
||||||
|
&& apt update \
|
||||||
|
&& apt install -y --no-install-recommends -t unstable \
|
||||||
|
qt6-base-dev \
|
||||||
|
qt6-tools-dev \
|
||||||
|
qt6-l10n-tools \
|
||||||
|
qt6-tools-dev-tools \
|
||||||
|
&& QBITTORRENT_RELEASE=$(curl -sX GET "https://api.github.com/repos/qBittorrent/qBittorrent/tags" | jq '.[] | select(.name | index ("beta") | not) | select(.name | index ("rc") | not) | .name' | head -n 1 | tr -d '"') \
|
||||||
&& curl -o /opt/qBittorrent-${QBITTORRENT_RELEASE}.tar.gz -L "https://github.com/qbittorrent/qBittorrent/archive/${QBITTORRENT_RELEASE}.tar.gz" \
|
&& curl -o /opt/qBittorrent-${QBITTORRENT_RELEASE}.tar.gz -L "https://github.com/qbittorrent/qBittorrent/archive/${QBITTORRENT_RELEASE}.tar.gz" \
|
||||||
&& tar -xzf /opt/qBittorrent-${QBITTORRENT_RELEASE}.tar.gz \
|
&& tar -xzf /opt/qBittorrent-${QBITTORRENT_RELEASE}.tar.gz \
|
||||||
&& rm /opt/qBittorrent-${QBITTORRENT_RELEASE}.tar.gz \
|
&& rm /opt/qBittorrent-${QBITTORRENT_RELEASE}.tar.gz \
|
||||||
&& cd /opt/qBittorrent-${QBITTORRENT_RELEASE} \
|
&& cd /opt/qBittorrent-${QBITTORRENT_RELEASE} \
|
||||||
&& cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DGUI=OFF -DCMAKE_CXX_STANDARD=17 \
|
&& cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DGUI=OFF -DCMAKE_CXX_STANDARD=17 -DQT6=ON \
|
||||||
&& cmake --build build --parallel $(nproc) \
|
&& cmake --build build --parallel $(nproc) \
|
||||||
&& cmake --install build \
|
&& cmake --install build \
|
||||||
&& cd /opt \
|
&& cd /opt \
|
||||||
@ -154,8 +160,10 @@ RUN apt update \
|
|||||||
jq \
|
jq \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
qtbase5-dev \
|
qt6-base-dev \
|
||||||
qttools5-dev \
|
qt6-tools-dev \
|
||||||
|
qt6-l10n-tools \
|
||||||
|
qt6-tools-dev-tools \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& apt --purge autoremove -y \
|
&& apt --purge autoremove -y \
|
||||||
@ -165,9 +173,7 @@ RUN apt update \
|
|||||||
/var/tmp/*
|
/var/tmp/*
|
||||||
|
|
||||||
# Install WireGuard and some other dependencies some of the scripts in the container rely on.
|
# Install WireGuard and some other dependencies some of the scripts in the container rely on.
|
||||||
RUN echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list \
|
RUN apt update \
|
||||||
&& printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable \
|
|
||||||
&& apt update \
|
|
||||||
&& apt install -y --no-install-recommends \
|
&& apt install -y --no-install-recommends \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
dos2unix \
|
dos2unix \
|
||||||
@ -175,9 +181,9 @@ RUN echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.li
|
|||||||
ipcalc \
|
ipcalc \
|
||||||
iptables \
|
iptables \
|
||||||
kmod \
|
kmod \
|
||||||
libqt5network5 \
|
libqt6network6 \
|
||||||
libqt5xml5 \
|
libqt6xml6 \
|
||||||
libqt5sql5 \
|
libqt6sql6 \
|
||||||
libssl1.1 \
|
libssl1.1 \
|
||||||
moreutils \
|
moreutils \
|
||||||
net-tools \
|
net-tools \
|
||||||
|
@ -65,8 +65,6 @@ $ docker run -d \
|
|||||||
|`HEALTH_CHECK_HOST`| No |This is the host or IP that the healthcheck script will use to check an active connection|`HEALTH_CHECK_HOST=one.one.one.one`|`one.one.one.one`|
|
|`HEALTH_CHECK_HOST`| No |This is the host or IP that the healthcheck script will use to check an active connection|`HEALTH_CHECK_HOST=one.one.one.one`|`one.one.one.one`|
|
||||||
|`HEALTH_CHECK_INTERVAL`| No |This is the time in seconds that the container waits to see if the internet connection still works (check if VPN died)|`HEALTH_CHECK_INTERVAL=300`|`300`|
|
|`HEALTH_CHECK_INTERVAL`| No |This is the time in seconds that the container waits to see if the internet connection still works (check if VPN died)|`HEALTH_CHECK_INTERVAL=300`|`300`|
|
||||||
|`HEALTH_CHECK_SILENT`| No |Set to `1` to supress the 'Network is up' message. Defaults to `1` if unset.|`HEALTH_CHECK_SILENT=1`|`1`|
|
|`HEALTH_CHECK_SILENT`| No |Set to `1` to supress the 'Network is up' message. Defaults to `1` if unset.|`HEALTH_CHECK_SILENT=1`|`1`|
|
||||||
|`HEALTH_CHECK_AMOUNT`| No |The amount of pings that get send when checking for connection.|`HEALTH_CHECK_AMOUNT=10`|`1`|
|
|
||||||
|`RESTART_CONTAINER`| No |Set to `no` to **disable** the automatic restart when the network is possibly down.|`RESTART_CONTAINER=yes`|`yes`|
|
|
||||||
|`INSTALL_PYTHON3`| No |Set this to `yes` to let the container install Python3.|`INSTALL_PYTHON3=yes`|`no`|
|
|`INSTALL_PYTHON3`| No |Set this to `yes` to let the container install Python3.|`INSTALL_PYTHON3=yes`|`no`|
|
||||||
|`ADDITIONAL_PORTS`| No |Adding a comma delimited list of ports will allow these ports via the iptables script.|`ADDITIONAL_PORTS=1234,8112`||
|
|`ADDITIONAL_PORTS`| No |Adding a comma delimited list of ports will allow these ports via the iptables script.|`ADDITIONAL_PORTS=1234,8112`||
|
||||||
|
|
||||||
@ -133,4 +131,4 @@ If possible, always use the most up to date version of Docker, you operating sys
|
|||||||
### Credits:
|
### Credits:
|
||||||
[MarkusMcNugen/docker-qBittorrentvpn](https://github.com/MarkusMcNugen/docker-qBittorrentvpn)
|
[MarkusMcNugen/docker-qBittorrentvpn](https://github.com/MarkusMcNugen/docker-qBittorrentvpn)
|
||||||
[DyonR/jackettvpn](https://github.com/DyonR/jackettvpn)
|
[DyonR/jackettvpn](https://github.com/DyonR/jackettvpn)
|
||||||
This projects originates from MarkusMcNugen/docker-qBittorrentvpn, but forking was not possible since DyonR/jackettvpn uses the fork already.
|
This projects originates from MarkusMcNugen/docker-qBittorrentvpn, but forking was not possible since DyonR/jackettvpn uses the fork already.
|
@ -256,7 +256,7 @@ if [[ -z "${PGID}" ]]; then
|
|||||||
export PGID="root"
|
export PGID="root"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $VPN_ENABLED == "1" || $VPN_ENABLED == "true" || $VPN_ENABLED == "yes" ]]; then
|
if [[ $VPN_ENABLED == "yes" ]]; then
|
||||||
if [[ "${VPN_TYPE}" == "openvpn" ]]; then
|
if [[ "${VPN_TYPE}" == "openvpn" ]]; then
|
||||||
echo "[INFO] Starting OpenVPN..." | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[INFO] Starting OpenVPN..." | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
cd /config/openvpn
|
cd /config/openvpn
|
||||||
@ -274,10 +274,5 @@ if [[ $VPN_ENABLED == "1" || $VPN_ENABLED == "true" || $VPN_ENABLED == "yes" ]];
|
|||||||
fi
|
fi
|
||||||
exec /bin/bash /etc/qbittorrent/iptables.sh
|
exec /bin/bash /etc/qbittorrent/iptables.sh
|
||||||
else
|
else
|
||||||
echo "[WARNIG] @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" | ts '%Y-%m-%d %H:%M:%.S'
|
|
||||||
echo "[WARNIG] THE CONTAINER IS RUNNING WITH VPN DISABLED" | ts '%Y-%m-%d %H:%M:%.S'
|
|
||||||
echo "[WARNIG] PLEASE MAKE SURE VPN_ENABLED IS SET TO 'yes'" | ts '%Y-%m-%d %H:%M:%.S'
|
|
||||||
echo "[WARNIG] IF THIS IS INTENTIONAL, YOU CAN IGNORE THIS" | ts '%Y-%m-%d %H:%M:%.S'
|
|
||||||
echo "[WARNIG] @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" | ts '%Y-%m-%d %H:%M:%.S'
|
|
||||||
exec /bin/bash /etc/qbittorrent/start.sh
|
exec /bin/bash /etc/qbittorrent/start.sh
|
||||||
fi
|
fi
|
||||||
|
@ -72,18 +72,18 @@ fi
|
|||||||
# Check if the PGID exists, if not create the group with the name 'qbittorrent'
|
# Check if the PGID exists, if not create the group with the name 'qbittorrent'
|
||||||
grep $"${PGID}:" /etc/group > /dev/null 2>&1
|
grep $"${PGID}:" /etc/group > /dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "[INFO] A group with PGID $PGID already exists in /etc/group within this container, nothing to do." | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[INFO] A group with PGID $PGID already exists in /etc/group, nothing to do." | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
else
|
else
|
||||||
echo "[INFO] A group with PGID $PGID does not exist within this container, adding a group called 'qbittorrent' with PGID $PGID" | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[INFO] A group with PGID $PGID does not exist, adding a group called 'qbittorrent' with PGID $PGID" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
groupadd -g $PGID qbittorrent
|
groupadd -g $PGID qbittorrent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the PUID exists, if not create the user with the name 'qbittorrent', with the correct group
|
# Check if the PUID exists, if not create the user with the name 'qbittorrent', with the correct group
|
||||||
id ${PUID} > /dev/null 2>&1
|
id ${PUID} > /dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "[INFO] An user with PUID $PUID already exists within this container, nothing to do." | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[INFO] An user with PUID $PUID already exists in /etc/passwd, nothing to do." | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
else
|
else
|
||||||
echo "[INFO] An user with PUID $PUID does not exist within this container, adding an user called 'qbittorrent user' with PUID $PUID" | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[INFO] An user with PUID $PUID does not exist, adding an user called 'qbittorrent user' with PUID $PUID" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
useradd -c "qbittorrent user" -g $PGID -u $PUID qbittorrent
|
useradd -c "qbittorrent user" -g $PGID -u $PUID qbittorrent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ qbittorrentpid=$(cat /var/run/qbittorrent.pid)
|
|||||||
# If the process exists, make sure that the log file has the proper rights and start the health check
|
# If the process exists, make sure that the log file has the proper rights and start the health check
|
||||||
if [ -e /proc/$qbittorrentpid ]; then
|
if [ -e /proc/$qbittorrentpid ]; then
|
||||||
echo "[INFO] qBittorrent PID: $qbittorrentpid" | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[INFO] qBittorrent PID: $qbittorrentpid" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
|
|
||||||
# trap the TERM signal for propagation and graceful shutdowns
|
# trap the TERM signal for propagation and graceful shutdowns
|
||||||
handle_term() {
|
handle_term() {
|
||||||
echo "[INFO] Received SIGTERM, stopping..." | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[INFO] Received SIGTERM, stopping..." | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
@ -120,14 +120,13 @@ if [ -e /proc/$qbittorrentpid ]; then
|
|||||||
if [[ -e /config/qBittorrent/data/logs/qbittorrent.log ]]; then
|
if [[ -e /config/qBittorrent/data/logs/qbittorrent.log ]]; then
|
||||||
chmod 775 /config/qBittorrent/data/logs/qbittorrent.log
|
chmod 775 /config/qBittorrent/data/logs/qbittorrent.log
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set some variables that are used
|
# Set some variables that are used
|
||||||
HOST=${HEALTH_CHECK_HOST}
|
HOST=${HEALTH_CHECK_HOST}
|
||||||
DEFAULT_HOST="one.one.one.one"
|
DEFAULT_HOST="one.one.one.one"
|
||||||
INTERVAL=${HEALTH_CHECK_INTERVAL}
|
INTERVAL=${HEALTH_CHECK_INTERVAL}
|
||||||
DEFAULT_INTERVAL=300
|
DEFAULT_INTERVAL=300
|
||||||
DEFAULT_HEALTH_CHECK_AMOUNT=1
|
|
||||||
|
|
||||||
# If host is zero (not set) default it to the DEFAULT_HOST variable
|
# If host is zero (not set) default it to the DEFAULT_HOST variable
|
||||||
if [[ -z "${HOST}" ]]; then
|
if [[ -z "${HOST}" ]]; then
|
||||||
echo "[INFO] HEALTH_CHECK_HOST is not set. For now using default host ${DEFAULT_HOST}" | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[INFO] HEALTH_CHECK_HOST is not set. For now using default host ${DEFAULT_HOST}" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
@ -139,40 +138,22 @@ if [ -e /proc/$qbittorrentpid ]; then
|
|||||||
echo "[INFO] HEALTH_CHECK_INTERVAL is not set. For now using default interval of ${DEFAULT_INTERVAL}" | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[INFO] HEALTH_CHECK_INTERVAL is not set. For now using default interval of ${DEFAULT_INTERVAL}" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
INTERVAL=${DEFAULT_INTERVAL}
|
INTERVAL=${DEFAULT_INTERVAL}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If HEALTH_CHECK_SILENT is zero (not set) default it to supression
|
# If HEALTH_CHECK_SILENT is zero (not set) default it to supression
|
||||||
if [[ -z "${HEALTH_CHECK_SILENT}" ]]; then
|
if [[ -z "${HEALTH_CHECK_SILENT}" ]]; then
|
||||||
echo "[INFO] HEALTH_CHECK_SILENT is not set. Because this variable is not set, it will be supressed by default" | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[INFO] HEALTH_CHECK_SILENT is not set. Because this variable is not set, it will be supressed by default" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
HEALTH_CHECK_SILENT=1
|
HEALTH_CHECK_SILENT=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z ${RESTART_CONTAINER} ]; then
|
|
||||||
echo "[INFO] RESTART_CONTAINER defined as '${RESTART_CONTAINER}'" | ts '%Y-%m-%d %H:%M:%.S'
|
|
||||||
else
|
|
||||||
echo "[WARNING] RESTART_CONTAINER not defined,(via -e RESTART_CONTAINER), defaulting to 'yes'" | ts '%Y-%m-%d %H:%M:%.S'
|
|
||||||
export RESTART_CONTAINER="yes"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If HEALTH_CHECK_AMOUNT is zero (not set) default it to DEFAULT_HEALTH_CHECK_AMOUNT
|
|
||||||
if [[ -z ${HEALTH_CHECK_AMOUNT} ]]; then
|
|
||||||
echo "[INFO] HEALTH_CHECK_AMOUNT is not set. For now using default interval of ${DEFAULT_HEALTH_CHECK_AMOUNT}" | ts '%Y-%m-%d %H:%M:%.S'
|
|
||||||
HEALTH_CHECK_AMOUNT=${DEFAULT_HEALTH_CHECK_AMOUNT}
|
|
||||||
fi
|
|
||||||
echo "[INFO] HEALTH_CHECK_AMOUNT is set to ${HEALTH_CHECK_AMOUNT}" | ts '%Y-%m-%d %H:%M:%.S'
|
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
# Ping uses both exit codes 1 and 2. Exit code 2 cannot be used for docker health checks, therefore we use this script to catch error code 2
|
# Ping uses both exit codes 1 and 2. Exit code 2 cannot be used for docker health checks, therefore we use this script to catch error code 2
|
||||||
ping -c ${HEALTH_CHECK_AMOUNT} $HOST > /dev/null 2>&1
|
ping -c 1 $HOST > /dev/null 2>&1
|
||||||
STATUS=$?
|
STATUS=$?
|
||||||
if [[ "${STATUS}" -ne 0 ]]; then
|
if [[ "${STATUS}" -ne 0 ]]; then
|
||||||
echo "[ERROR] Network is possibly down." | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[ERROR] Network is down, exiting this Docker" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
sleep 1
|
exit 1
|
||||||
if [[ ${RESTART_CONTAINER,,} == "1" || ${RESTART_CONTAINER,,} == "true" || ${RESTART_CONTAINER,,} == "yes" ]]; then
|
|
||||||
echo "[INFO] Restarting container." | ts '%Y-%m-%d %H:%M:%.S'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
if [[ ${HEALTH_CHECK_SILENT,,} == "0" || ${HEALTH_CHECK_SILENT,,} == "false" || ${HEALTH_CHECK_SILENT,,} == "no" ]]; then
|
if [ "${HEALTH_CHECK_SILENT}" == "0" ] || [ "${HEALTH_CHECK_SILENT}" == "false" ] || [ "${HEALTH_CHECK_SILENT}" == "no" ]; then
|
||||||
echo "[INFO] Network is up" | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[INFO] Network is up" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
fi
|
fi
|
||||||
sleep ${INTERVAL} &
|
sleep ${INTERVAL} &
|
||||||
|
Loading…
x
Reference in New Issue
Block a user