From 269cba4397a6ee67da8d0950aa401724c36c73bb Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Tue, 11 Nov 2014 22:07:13 +0100 Subject: [PATCH] removed supervisord, using baseimage-docker init system. added automatic port updates. --- Dockerfile | 26 ++++++++++++------- piaconfig/config.ovpn | 6 ++--- runOpenVpn.sh | 3 +++ startOpenVPN.sh | 4 --- transmission/periodicUpdates.sh | 8 ++++++ transmission/run.sh | 2 ++ transmission/runUpdates.sh | 3 +++ .../transmissionSettings.json | 0 .../updateTransmissionPort.sh | 0 9 files changed, 36 insertions(+), 16 deletions(-) create mode 100755 runOpenVpn.sh delete mode 100755 startOpenVPN.sh create mode 100755 transmission/periodicUpdates.sh create mode 100755 transmission/run.sh create mode 100755 transmission/runUpdates.sh rename transmissionSettings.json => transmission/transmissionSettings.json (100%) rename updateTransmissionPort.sh => transmission/updateTransmissionPort.sh (100%) diff --git a/Dockerfile b/Dockerfile index 7b94791..ef23086 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,24 +19,32 @@ RUN apt-get update RUN apt-get install -y transmission-cli RUN apt-get install -y transmission-common RUN apt-get install -y transmission-daemon -RUN apt-get install -y supervisor RUN apt-get install -y openvpn RUN apt-get install -y curl RUN apt-get install -y screen -# Create directories -RUN mkdir -p /var/log/supervisor +# Transmission service +RUN mkdir -p /etc/service/transmission/ +ADD transmission/run.sh /etc/service/transmission/run + +# Transmission port updater +RUN mkdir -p /etc/service/portupdater/ +ADD transmission/runUpdates.sh /etc/service/portupdater/run + +# OpenVPN service +RUN mkdir -p /etc/service/openvpn/ +ADD runOpenVpn.sh /etc/service/openvpn/run # Add configuration and scripts ADD piaconfig/config.ovpn /etc/openvpn/config.ovpn ADD piaconfig/credentials.txt /etc/openvpn/credentials.txt ADD piaconfig/ca.crt /etc/openvpn/ca.crt ADD piaconfig/crl.pem /etc/openvpn/crl.pem -ADD startOpenVPN.sh /etc/openvpn/start.sh -ADD transmissionSettings.json /etc/transmission-daemon/settings.json -ADD updateTransmissionPort.sh /etc/transmission-daemon/updatePort.sh -ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf +ADD runOpenVpn.sh /etc/openvpn/start.sh +ADD transmission/transmissionSettings.json /etc/transmission-daemon/settings.json +ADD transmission/updateTransmissionPort.sh /etc/transmission-daemon/updatePort.sh +ADD transmission/periodicUpdates.sh /etc/transmission-daemon/periodicUpdates.sh -# Expose port and run supervisord +# Expose port and run. Use baseimage-docker's init system EXPOSE 9091 -CMD ["/usr/bin/supervisord"] +CMD ["/sbin/my_init"] diff --git a/piaconfig/config.ovpn b/piaconfig/config.ovpn index b80de7c..84fdf05 100644 --- a/piaconfig/config.ovpn +++ b/piaconfig/config.ovpn @@ -6,13 +6,13 @@ resolv-retry infinite nobind persist-key persist-tun -ca ca.crt +ca /etc/openvpn/ca.crt tls-client remote-cert-tls server -auth-user-pass credentials.txt +auth-user-pass /etc/openvpn/credentials.txt comp-lzo verb 1 reneg-sec 0 -crl-verify crl.pem +crl-verify /etc/openvpn/crl.pem diff --git a/runOpenVpn.sh b/runOpenVpn.sh new file mode 100755 index 0000000..4dbc3f5 --- /dev/null +++ b/runOpenVpn.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exec openvpn --config /etc/openvpn/config.ovpn diff --git a/startOpenVPN.sh b/startOpenVPN.sh deleted file mode 100755 index 7c60f38..0000000 --- a/startOpenVPN.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -cd /etc/openvpn/ -openvpn --config config.ovpn diff --git a/transmission/periodicUpdates.sh b/transmission/periodicUpdates.sh new file mode 100755 index 0000000..8c45480 --- /dev/null +++ b/transmission/periodicUpdates.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +while [ 1 ] +do + sleep 1m + /etc/transmission-daemon/updatePort.sh + sleep 1m +done diff --git a/transmission/run.sh b/transmission/run.sh new file mode 100755 index 0000000..0231457 --- /dev/null +++ b/transmission/run.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/bin/transmission-daemon -f -g /etc/transmission-daemon/ diff --git a/transmission/runUpdates.sh b/transmission/runUpdates.sh new file mode 100755 index 0000000..5e9a023 --- /dev/null +++ b/transmission/runUpdates.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exec /etc/transmission-daemon/periodicUpdates.sh diff --git a/transmissionSettings.json b/transmission/transmissionSettings.json similarity index 100% rename from transmissionSettings.json rename to transmission/transmissionSettings.json diff --git a/updateTransmissionPort.sh b/transmission/updateTransmissionPort.sh similarity index 100% rename from updateTransmissionPort.sh rename to transmission/updateTransmissionPort.sh