diff --git a/.gitignore b/.gitignore index 6e8ad97..b733b8b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +# Wireguard configs, you never know +wg*.conf # Windows image file caches Thumbs.db ehthumbs.db diff --git a/Dockerfile b/Dockerfile index 36ef5db..409d635 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,12 +26,14 @@ ENV DEBIAN_FRONTEND="noninteractive" \ PLEX_MEDIA_SERVER_INFO_DEVICE="Docker Container (LinuxServer.io)" RUN \ - echo "**** install runtime packages ****" && \ + echo "**** install runtime packages & wireguard ****" && \ apt-get update && \ apt-get install -y \ jq \ udev \ - wget && \ + wget \ + iproute2 \ + wireguard-tools &&\ echo "**** install plex ****" && \ if [ -z ${PLEX_RELEASE+x} ]; then \ PLEX_RELEASE=$(curl -sX GET 'https://plex.tv/api/downloads/5.json' \ @@ -54,6 +56,9 @@ RUN \ # add local files COPY root/ / +# add wireguard config +COPY ./wg0.conf /etc/wireguard/wg0.conf + # add unrar COPY --from=unrar /usr/bin/unrar-ubuntu /usr/bin/unrar diff --git a/root/etc/s6-overlay/s6-rc.d/init-wireguard/dependencies.d/init-services b/root/etc/s6-overlay/s6-rc.d/init-wireguard/dependencies.d/init-services new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-wireguard/run b/root/etc/s6-overlay/s6-rc.d/init-wireguard/run new file mode 100755 index 0000000..e5989a5 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-wireguard/run @@ -0,0 +1,10 @@ +#!/usr/bin/with-contenv bash +# Bring up WireGuard if not already up +if ! ip link show dev wg0 > /dev/null 2>&1; then + wg-quick up wg0 +else +sleep 60 +fi + +# Exit after running +exit 0 diff --git a/root/etc/s6-overlay/s6-rc.d/init-wireguard/type b/root/etc/s6-overlay/s6-rc.d/init-wireguard/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-wireguard/type @@ -0,0 +1 @@ +longrun diff --git a/root/etc/s6-overlay/s6-rc.d/init-wireguard/up b/root/etc/s6-overlay/s6-rc.d/init-wireguard/up new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-plex/run b/root/etc/s6-overlay/s6-rc.d/svc-plex/run index 8486676..6a5aefa 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-plex/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-plex/run @@ -1,5 +1,7 @@ #!/usr/bin/with-contenv bash +# Wait for WireGuard to be up + echo "Starting Plex Media Server. . . (you can ignore the libusb_init error)" export PLEX_MEDIA_SERVER_INFO_MODEL=$(uname -m) export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION=$(uname -r) diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-wireguard b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-wireguard new file mode 100644 index 0000000..e69de29