From a26599d4ebc10e6342e4b0c49c187695402fe6df Mon Sep 17 00:00:00 2001 From: James May Date: Mon, 26 Apr 2021 01:29:16 +0200 Subject: [PATCH] Now it's webby --- .gitignore | 2 ++ README.md | 32 ++++++++++++++++++++++++++++++++ docker-compose.yml | 16 +++++++++++++--- docker/Dockerfile | 35 +++++++++++++++++++++++++++++------ docker/docker-entrypoint.sh | 18 +++++++++++------- 5 files changed, 87 insertions(+), 16 deletions(-) create mode 100644 .gitignore create mode 100644 README.md mode change 100644 => 100755 docker/docker-entrypoint.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5157ba4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +config +downloads diff --git a/README.md b/README.md new file mode 100644 index 0000000..3333881 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Intro + +Running a gtk-gnutella instance in docker, build from latest source and accessible via IPC-socket over SOCAT (see usage) or VNC. + +# Usage + +Make sure **all** mounted volumes under `/app` are owned by `1000:1000`. + +## VNC + +You can conenct and control your instance via given VNC port and password in `docker-compose.yml`. + +## NoVNC + +You can also access the VNC Interface via NoVNC WebInterface on port 5800 + +## IPC over `socat` + +You connect to the gtk-gnutella daemon via IPC over TCP. You need to have socat and gtk-gnutella on your client too. + +1.: +``` +sudo socat UNIX-LISTEN:/home/user/local.socket,fork TCP-CONNECT::8089 +``` +2.: +``` +gtk-gnutella --shell /home/user/local.socket +``` + +## Notes + +In both cases I strongly recommend using a VPN and not running either VNC or IPC over the internet. Especially the "IPC over socat" hack is truly dangerous when listening on outward facing interfaces since there is no protection at all. diff --git a/docker-compose.yml b/docker-compose.yml index 1a7d96a..2db7688 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,11 +3,21 @@ services: gnutella-server: build: docker + environment: + VNC_PASSWORD: "23eris42" + SOCAT_PORT: 1337 + ENABLE_SOCAT_TUNNEL: "FALSE" + HEADLESS: "FALSE" + DISPLAY_HEIGHT: 900 + DISPLAY_WIDTH: 1440 ports: - "22271:22271/tcp" - - "5903:5900/tcp" + - "22271:22271/udp" + - "192.168.5.26:5903:5900/tcp" + - "192.168.5.26:5800:5800/tcp" + # - "192.168.5.26:1337:1337/tcp" volumes: - - ./downloads:/home/nya/gtl-gnutella-downloads - - ./config:/home/nya/.gtk-gnutella/ + - ./downloads:/app/gtk-gnutella/downloads + - ./config:/app/.gtk-gnutella/ container_name: gnutella_server #restart: always diff --git a/docker/Dockerfile b/docker/Dockerfile index 5ebffa4..1ed60d6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,28 @@ -FROM debian:unstable-slim -RUN apt update && apt-get -y install wget unzip bash make gcc glibc-source gtk+2.0 gtk+2.0-dev zlib1g zlib1g-dev libgnutls28-dev xvfb x11vnc && rm -rf /var/lib/apt/lists/* +FROM jlesage/baseimage-gui:debian-10 + +ENV APP_NAME="Gnutella" + +RUN \ + APP_ICON_URL=https://upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Gtk-gnutella.svg/600px-Gtk-gnutella.svg.png && \ + install_app_icon.sh "$APP_ICON_URL" + +RUN \ + apt update && \ + apt-get -y --no-install-recommends install \ + socat \ + wget \ + unzip \ + bash \ + make \ + gcc \ + xterm \ + glibc-source \ + gettext \ + gtk+2.0 gtk+2.0-dev \ + zlib1g zlib1g-dev \ + libgnutls28-dev && \ + rm -rf /var/cache/apt/archives/* + RUN mkdir /app; \ wget -O /app/src.zip https://codeload.github.com/gtk-gnutella/gtk-gnutella/zip/master; \ cd /app && \ @@ -7,7 +30,7 @@ RUN mkdir /app; \ cd gtk-gnutella-master && \ ./build.sh --cc=gcc --gtk2 --disable-dbus && \ make install -ADD docker-entrypoint.sh /docker-entrypoint.sh -RUN chmod +x /docker-entrypoint.sh && useradd -m -u 1010 nya -USER nya -ENTRYPOINT ["/docker-entrypoint.sh"] + +RUN chown 1000:1000 /app + +COPY docker-entrypoint.sh /startapp.sh diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh old mode 100644 new mode 100755 index 627ebd0..989856e --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -1,9 +1,13 @@ #!/bin/bash # - -Xvfb :99 -screen 0 1650x1050x24 & -x11vnc -display :99 -rfbport 5900 -rfbportv6 -1 -no6 -noipv6 -httpportv6 -1 -forever -desktop Gnutella-Gtk -cursor arrow -shared -passwd 23eris42 & -sleep 5 -export DISPLAY=:99.0 -export XAUTHORITY=~/.Xauthority -gtk-gnutella --geometry 1650x1050 +export HOME=/app +if [ "${ENABLE_SOCAT_TUNNEL}" = "TRUE" ]; then + socat TCP-LISTEN:${SOCAT_PORT},fork UNIX-CONNECT:/home/nya/.gtk-gnutella/ipc/socket & +fi +if [ "${HEADLESS}" = "TRUE" ]; then + gtk-gnutella --topless --log-stderr /dev/null --log-stdout /dev/null +else + echo "nyanya" + gtk-gnutella --geometry ${DISPLAY_WIDTH}x${DISPLAY_HEIGHT} --log-stderr /dev/null --log-stdout /dev/null + sleep 2323; +fi