From d4ea664d3642254493f16162e63520b225d4d175 Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Sat, 11 Apr 2020 14:04:53 +0200 Subject: [PATCH] switched init system to s6-overlay --- Dockerfile | 32 ++++++++++++++++-------------- README.md | 17 ++++++++++------ etc/services.d/webfused/run | 4 ++++ webfused.conf => etc/webfused.conf | 8 +++++++- 4 files changed, 39 insertions(+), 22 deletions(-) create mode 100644 etc/services.d/webfused/run rename webfused.conf => etc/webfused.conf (67%) diff --git a/Dockerfile b/Dockerfile index 91e973e..3fe401e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,22 +21,23 @@ RUN set -x \ ARG PARALLELMFLAGS=-j2 -ARG DUMB_INIT_VERSION=1.2.2 +ARG S6OVERLAY_VERSION=1.22.1.0 RUN set -x \ - && builddeps="xxd" \ - && apt install --yes --no-install-recommends $builddeps \ && builddir="/tmp/out" \ && mkdir -p "$builddir" \ && cd "$builddir" \ - && wget "https://github.com/Yelp/dumb-init/archive/v${DUMB_INIT_VERSION}.tar.gz" -O dumb_init.tar.gz \ - && tar -xf dumb_init.tar.gz \ - && cd "dumb-init-$DUMB_INIT_VERSION" \ - && make "$PARALLELMFLAGS" \ - && chmod +x dumb-init \ - && mv dumb-init /usr/local/bin/dumb-init \ - && dumb-init --version \ - && rm -rf "$builddir" \ - && apt purge -y $builddeps + && wget "https://github.com/just-containers/s6-overlay/releases/download/v${S6OVERLAY_VERSION}/s6-overlay-amd64.tar.gz" -O s6overlay.tar.gz \ + && tar -xf s6overlay.tar.gz -C / \ + && rm -rf "$builddir" + +ARG SOCKLOG_VERSION=3.1.0-2 +RUN set -x \ + && builddir="/tmp/out" \ + && mkdir -p "$builddir" \ + && cd "$builddir" \ + && wget "https://github.com/just-containers/socklog-overlay/releases/download/v${SOCKLOG_VERSION}/socklog-overlay-amd64.tar.gz" -O socklog.tar.gz \ + && tar -xf socklog.tar.gz -C / \ + && rm -rf "$builddir" ARG FUSE_VERSION=3.9.1 RUN set -x \ @@ -120,8 +121,6 @@ RUN set -x \ && make "$PARALLELMFLAGS" install \ && rm -rf "$builddir" -COPY webfused.conf /etc - ARG NPM_VERSION=">=6.14.0 <7.0.0" ARG NODEJS_VERSION=12 RUN set -x \ @@ -146,6 +145,9 @@ ARG USERID=1000 RUN set -x \ && useradd -u "$USERID" -ms /bin/bash user +COPY etc /etc + EXPOSE 8080 -ENTRYPOINT ["dumb-init", "--"] \ No newline at end of file +ENTRYPOINT ["/init"] +CMD ["/usr/bin/execlineb", "-P", "-c", "emptyenv export HOME /home/user s6-setuidgid user /bin/bash"] \ No newline at end of file diff --git a/README.md b/README.md index 7509a31..0df7c3d 100644 --- a/README.md +++ b/README.md @@ -11,17 +11,22 @@ Example of webfuse. docker run -p 8080:8080 --rm -it \ --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \ - --user `id -u` \ - webfuse bash - webfused -f /etc/webfused.conf + webfuse -Open a webbrowser and visit http://localhost:8080 and follow the instruction on the screen. +Open a webbrowser and visit http://localhost:8080 and establish a connection. -Then open another terminal and connect to the container. +Once connected, you can display the provided filesystem inside the container. - docker exec -it bash cat /tmp/test/hello.txt +### Logging + +To view log messages from webfuse, open another terminal an conntect to the container. +Log files can be found in /var/log/socklog/daemon directory. + + docker exec -it bash + tail -f /var/log/socklog/daemon/current + ## Fellow Repositories * [webfuse library](https://github.com/falk-werner/webfuse) diff --git a/etc/services.d/webfused/run b/etc/services.d/webfused/run new file mode 100644 index 0000000..d901bd2 --- /dev/null +++ b/etc/services.d/webfused/run @@ -0,0 +1,4 @@ +#!/usr/bin/execlineb -P + +s6-setuidgid user +/usr/local/bin/webfused -f /etc/webfused.conf diff --git a/webfused.conf b/etc/webfused.conf similarity index 67% rename from webfused.conf rename to etc/webfused.conf index 906fd72..8062fb9 100644 --- a/webfused.conf +++ b/etc/webfused.conf @@ -16,6 +16,12 @@ filesystems: log: { - provider: "stderr" + provider: "syslog" level: "all" + settings: + { + ident: "webfused" + facility: "daemon" + log_pid: true + } }