diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 61442457..5d995e1a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,19 +1,32 @@ -FROM nurdism/neko +FROM debian:stretch-slim -RUN apt-get update && apt-get install -y --no-install-recommends autoconf ca-certificates curl netbase wget \ - bzr git mercurial openssh-client subversion procps automake bzip2 dpkg-dev file g++ gcc \ - libbz2-dev libc6-dev libcurl4-openssl-dev libdb-dev libevent-dev libffi-dev libgdbm-dev libglib2.0-dev libgmp-dev \ - libjpeg-dev libkrb5-dev liblzma-dev libmagickcore-dev libmagickwand-dev libmaxminddb-dev libncurses5-dev libncursesw5-dev \ - libpng-dev libpq-dev libreadline-dev libsqlite3-dev libssl-dev libtool libwebp-dev libxml2-dev libxslt-dev libyaml-dev \ - make patch unzip xz-utils zlib1g-dev pkg-config \ - && if ! command -v gpg > /dev/null; then \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - fi +# +# cluster fuck of packages for neko, node, go and gstreamer +RUN apt-get update; apt-get install -y --no-install-recommends autoconf ca-certificates curl netbase wget \ + bzr git mercurial openssh-client subversion procps automake bzip2 dpkg-dev file g++ gcc \ + libbz2-dev libc6-dev libcurl4-openssl-dev libdb-dev libevent-dev libffi-dev libgdbm-dev libglib2.0-dev libgmp-dev \ + libjpeg-dev libkrb5-dev liblzma-dev libmagickcore-dev libmagickwand-dev libmaxminddb-dev libncurses5-dev libncursesw5-dev \ + libpng-dev libpq-dev libreadline-dev libsqlite3-dev libssl-dev libtool libwebp-dev libxml2-dev libxslt-dev libyaml-dev \ + make patch unzip xz-utils zlib1g-dev pkg-config \ + build-essential perl python autopoint bison flex \ + gettext openssl libopus-dev libvpx-dev libpulse-dev libx11-dev libxv-dev libxt-dev \ + libxfixes-dev apt-utils x11vnc libxtst-dev dialog \ + pulseaudio openbox chromium firefox-esr dbus-x11 xvfb xclip supervisor unzip; \ + if ! command -v gpg > /dev/null; then \ + apt-get install -y --no-install-recommends gnupg dirmngr; \ + fi +# +# set up env for gst +ENV PATH=/gst/local/bin:$PATH +ENV LD_LIBRARY_PATH=/gst/local/lib:$LD_LIBRARY_PATH +ENV PKG_CONFIG_PATH=/gst/local/lib/pkgconfig:$PKG_CONFIG_PATH + +# +# add node ENV NODE_VERSION 12.14.1 -RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ - && case "${dpkgArch##*-}" in \ +RUN ARCH= ; dpkgArch="$(dpkg --print-architecture)" \ + ;case "${dpkgArch##*-}" in \ amd64) ARCH='x64';; \ ppc64el) ARCH='ppc64le';; \ s390x) ARCH='s390x';; \ @@ -21,10 +34,10 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ armhf) ARCH='armv7l';; \ i386) ARCH='x86';; \ *) echo "unsupported architecture"; exit 1 ;; \ - esac \ + esac;\ # gpg keys listed at https://github.com/nodejs/node#release-keys - && set -eux \ - && for key in \ + set -eux;\ + for key in \ 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ FD3A5288F042B6850C66B31F09FE44734EB7990E \ 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ @@ -39,20 +52,22 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ ; do \ gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ - gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ - done \ - && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ - && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ - && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ - && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ - && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ - && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ - && ln -s /usr/local/bin/node /usr/local/bin/nodejs + gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key"; \ + done; \ + curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz"; \ + curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc"; \ + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc; \ + grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - ; \ + tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner; \ + rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \ + ln -s /usr/local/bin/node /usr/local/bin/nodejs +# +# add go ENV GOLANG_VERSION 1.13.6 -RUN set -eux \ - && dpkgArch="$(dpkg --print-architecture)" \ - && case "${dpkgArch##*-}" in \ +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ amd64) goRelArch='linux-amd64'; goRelSha256='a1bc06deb070155c4f67c579f896a45eeda5a8fa54f35ba233304074c4abbbbd' ;; \ armhf) goRelArch='linux-armv6l'; goRelSha256='37a1a83e363dcf146a67fa839d170fd1afb13009585fdd493d0a3370fbe6f785' ;; \ arm64) goRelArch='linux-arm64'; goRelSha256='0a18125c4ed80f9c3045cf92384670907c4796b43ed63c4307210fe93e5bbca5' ;; \ @@ -61,31 +76,31 @@ RUN set -eux \ s390x) goRelArch='linux-s390x'; goRelSha256='5cd9900a1fa0f0cac657930b648381cad9b8c5e2bbc77caf86a6fb5cedad0017' ;; \ *) goRelArch='src'; goRelSha256='aae5be954bdc40bcf8006eb77e8d8a5dde412722bc8effcdaf9772620d06420c'; \ echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;; \ - esac \ - && url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz" \ - && wget -O go.tgz "$url" \ - && echo "${goRelSha256} *go.tgz" | sha256sum -c - \ - && tar -C /usr/local -xzf go.tgz \ - && rm go.tgz \ - && if [ "$goRelArch" = 'src' ]; then \ + esac; \ + url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz"; \ + wget -O go.tgz "$url"; \ + echo "${goRelSha256} *go.tgz" | sha256sum -c - ; \ + tar -C /usr/local -xzf go.tgz; \ + rm go.tgz; \ + if [ "$goRelArch" = 'src' ]; then \ echo >&2; \ echo >&2 'error: UNIMPLEMENTED'; \ echo >&2 'TODO install golang-any from jessie-backports for GOROOT_BOOTSTRAP (and uninstall after build)'; \ echo >&2; \ exit 1; \ - fi \ - && export PATH="/usr/local/go/bin:$PATH" \ - && go version + fi; \ + export PATH="/usr/local/go/bin:$PATH"; \ + go version ENV GOPATH /go ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH # # install Go tools w/module support -RUN mkdir -p /tmp/gotools \ - && cd /tmp/gotools \ - && GO111MODULE=on go get -v golang.org/x/tools/gopls@latest 2>&1 \ - && GO111MODULE=on go get -v \ +RUN mkdir -p /tmp/gotools; \ + cd /tmp/gotools; \ + GO111MODULE=on go get -v golang.org/x/tools/gopls@latest 2>&1; \ + GO111MODULE=on go get -v \ honnef.co/go/tools/...@latest \ golang.org/x/tools/cmd/gorename@latest \ golang.org/x/tools/cmd/goimports@latest \ @@ -105,21 +120,20 @@ RUN mkdir -p /tmp/gotools \ github.com/zmb3/gogetdoc@latest \ github.com/fatih/gomodifytags@latest \ github.com/mgechev/revive@latest \ - github.com/go-delve/delve/cmd/dlv@latest 2>&1 \ + github.com/go-delve/delve/cmd/dlv@latest 2>&1; \ # # install Go tools w/o module support - && go get -v github.com/alecthomas/gometalinter 2>&1 \ + go get -v github.com/alecthomas/gometalinter 2>&1; \ # # install gocode-gomod - && go get -x -d github.com/stamblerre/gocode 2>&1 \ - && go build -o gocode-gomod github.com/stamblerre/gocode \ - && mv gocode-gomod $GOPATH/bin/ \ + go get -x -d github.com/stamblerre/gocode 2>&1; \ + go build -o gocode-gomod github.com/stamblerre/gocode; \ + mv gocode-gomod $GOPATH/bin/; \ # # install golangci-lint - && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin 2>&1 - -RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg/mod" && chmod -R 777 "$GOPATH" - + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin 2>&1; \ + mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg/mod"; chmod -R 777 "$GOPATH" +# # turn on go modules ENV GO111MODULE=on @@ -138,31 +152,27 @@ ARG INSTALL_ZSH="true" ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/common-debian.sh" ARG COMMON_SCRIPT_SHA="dev-mode" -# configure apt and install packages -RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-utils x11vnc libxtst-dev openssl dialog wget ca-certificates 2>&1 \ - # - # verify git, common tools / libs installed, add/modify non-root user, optionally install zsh - && wget -q -O /tmp/common-setup.sh $COMMON_SCRIPT_SOURCE \ - && if [ "$COMMON_SCRIPT_SHA" != "dev-mode" ]; then echo "$COMMON_SCRIPT_SHA /tmp/common-setup.sh" | sha256sum -c - ; fi \ - && /bin/bash /tmp/common-setup.sh "$INSTALL_ZSH" "$USERNAME" "$USER_UID" "$USER_GID" \ - && rm /tmp/common-setup.sh \ +# verify git, common tools / libs installed, add/modify non-root user, optionally install zsh +RUN wget -q -O /tmp/common-setup.sh $COMMON_SCRIPT_SOURCE; \ + if [ "$COMMON_SCRIPT_SHA" != "dev-mode" ]; then echo "$COMMON_SCRIPT_SHA /tmp/common-setup.sh" | sha256sum -c - ; fi; \ + /bin/bash /tmp/common-setup.sh "$INSTALL_ZSH" "$USERNAME" "$USER_UID" "$USER_GID"; \ + rm /tmp/common-setup.sh; \ # # install docker - && apt-get install -y apt-transport-https gnupg-agent software-properties-common lsb-release \ - && curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | (OUT=$(apt-key add - 2>&1) || echo $OUT) \ - && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \ - && apt-get update && apt-get install -y docker-ce-cli \ + apt-get install -y apt-transport-https gnupg-agent software-properties-common lsb-release; \ + curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | (OUT=$(apt-key add - 2>&1) || echo $OUT); \ + add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable"; \ + apt-get update; apt-get install -y docker-ce-cli; \ # # install docker compose - && curl -sSL "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \ - && chmod +x /usr/local/bin/docker-compose \ + curl -sSL "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose; \ + chmod +x /usr/local/bin/docker-compose; \ # # set alternate global install location that both users have rights to access - && mkdir -p /usr/local/share/npm-global \ - && chown ${USERNAME}:root /usr/local/share/npm-global \ - && npm config -g set prefix /usr/local/share/npm-global \ - && sudo -u ${USERNAME} npm config -g set prefix /usr/local/share/npm-global + mkdir -p /usr/local/share/npm-global; \ + chown ${USERNAME}:root /usr/local/share/npm-global; \ + npm config -g set prefix /usr/local/share/npm-global; \ + sudo -u ${USERNAME} npm config -g set prefix /usr/local/share/npm-global ENV PATH=/usr/local/share/npm-global/bin:$PATH diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml index 31207e92..32838ba7 100644 --- a/.devcontainer/docker-compose.yaml +++ b/.devcontainer/docker-compose.yaml @@ -11,7 +11,7 @@ services: security_opt: - seccomp:unconfined volumes: - - /home/nurd/neko:/workspace + - /home//neko:/workspace - /var/run/docker.sock:/var/run/docker.sock command: "/bin/sh -c \"while sleep 1000; do :; done\"" \ No newline at end of file diff --git a/.docker/build b/.docker/build index ad988440..ad1778da 100755 --- a/.docker/build +++ b/.docker/build @@ -1,16 +1,84 @@ #!/bin/bash -cd ../server \ - && go get \ - && ./build \ - && cd ../client \ - && npm install && npm run build \ - && cd ../ \ - && sudo docker build -f Dockerfile -t nurdism/neko . \ - && sudo docker images nurdism/neko +# sudo docker run -p 80:8080 -p 59000-59100:59000-59100/udp --cap-add SYS_ADMIN nurdism/neko:chromium +# sudo docker run -p 80:8080 -p 59000-59100:59000-59100/udp --shm-size=1gb nurdism/neko:firefox +# sudo docker run --network host --shm-size=1gb -it nurdism/neko:latest /bin/bash -# sudo docker images nurdism/neko -# sudo docker tag nurdism/neko:1.0 -# sudo docker push nurdism/neko:latest -# sudo docker run -p 80:8080 -p 59000-59100:59000-59100/udp --shm-size=1gb nurdism/neko:latest -# sudo docker run --network host --shm-size=1gb -it nurdism/neko:latest /bin/bash \ No newline at end of file +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.." + +build_gst() { + if [ ! -d /gst ]; then + sudo mkdir -p /workspace/.build/gst + sudo ln -s /workspace/.build/gst /gst + sudo chown -R neko /workspace/.build + fi + + # build & install gstreamer + sudo su -c 'set -eux; \ + sudo rm -rf /gst/local; \ + cd /gst; \ + for MODULE in \ + gstreamer \ + gst-plugins-base \ + gst-plugins-good \ + ; do \ + if [ ! -d $MODULE ]; then + git clone git://anongit.freedesktop.org/gstreamer/$MODULE; \ + fi + cd $MODULE; \ + git checkout 1.16; \ + case $MODULE in \ + gstreamer) GST_ARGS="--disable-gtk-doc" ;; \ + gst-plugins-base) GST_ARGS="--disable-gtk-doc --disable-x --disable-xvideo" ;; \ + gst-plugins-good) GST_ARGS="--disable-gtk-doc --disable-oss --disable-oss4 --disable-gst_v4l2" ;; \ + esac; \ + PATH=/gst/local/bin:$PATH PKG_CONFIG_PATH=/gst/local/lib/pkgconfig ./autogen.sh --prefix /gst/local $GST_ARGS; \ + make; make install; \ + cd /gst; \ + done' +} + +build_base() { + set -eux; \ + cd $DIR/server; go get; ./build; \ + cd $DIR/client; npm install; npm run build; \ + cd $DIR; sudo docker build -f Dockerfile -t nurdism/neko:base . ; +} + +build_firefox() { + set -eux; \ + cd $DIR/.docker/files/firefox; \ + sudo docker build -f Dockerfile -t nurdism/neko:firefox -t nurdism/neko:latest . ; +} + +build_chromium() { + set -eux; \ + cd $DIR/.docker/files/chromium; \ + sudo docker build -f Dockerfile -t nurdism/neko:chromium -t nurdism/neko:latest . ; +} + +build_docker() { + if [ ! -d /gst/local ]; then + build_gst + fi + + set -eux; \ + build_base; \ + build_firefox; \ + build_chromium; \ + sudo docker images nurdism/neko +} + +build_push() { + sudo docker push nurdism/neko:base + sudo docker push nurdism/neko:latest + sudo docker push nurdism/neko:firefox + sudo docker push nurdism/neko:chromium +} + +case $1 in + push) build_push ;; + docker) build_docker ;; + gst) build_gst ;; + *) build_docker ;; +esac diff --git a/.docker/files/brave/.gitkeep b/.docker/files/brave/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/.docker/files/chromium/Dockerfile b/.docker/files/chromium/Dockerfile new file mode 100644 index 00000000..743f0c78 --- /dev/null +++ b/.docker/files/chromium/Dockerfile @@ -0,0 +1,24 @@ +FROM nurdism/neko:base + +# install neko chromium +RUN set -eux; apt-get update; \ + apt-get install -y --no-install-recommends unzip chromium; \ + # + # install widevine module + WIDEVINE_VERSION=$(wget --quiet -O - https://dl.google.com/widevine-cdm/versions.txt | tail -n 1); \ + wget "https://dl.google.com/widevine-cdm/$WIDEVINE_VERSION-linux-x64.zip" -O /tmp/widevine.zip ; \ + unzip -p /tmp/widevine.zip libwidevinecdm.so > /usr/lib/chromium/libwidevinecdm.so; \ + chmod 644 /usr/lib/chromium/libwidevinecdm.so; \ + rm /tmp/widevine.zip; \ + # + # clean up + apt-get --purge autoremove -y unzip; \ + apt-get autoremove -y; \ + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +# +# copy configuation files +COPY supervisord.conf /etc/neko/supervisord/chromium.conf +COPY preferences.json /usr/share/chromium/master_preferences +COPY policies.json /etc/chromium/policies/managed/policies.json \ No newline at end of file diff --git a/.docker/files/chromium/policies.json b/.docker/files/chromium/policies.json new file mode 100644 index 00000000..58632e27 --- /dev/null +++ b/.docker/files/chromium/policies.json @@ -0,0 +1,36 @@ +{ + "HomepageLocation": "", + "AutoFillEnabled": false, + "AutofillAddressEnabled": false, + "AutofillCreditCardEnabled": false, + "BrowserSignin": 0, + "DefaultNotificationsSetting": 2, + "DeveloperToolsAvailability": 2, + "EditBookmarksEnabled": false, + "FullscreenAllowed": true, + "IncognitoModeAvailability": 1, + "SyncDisabled": true, + "AutoplayAllowed": true, + "BrowserAddPersonEnabled": false, + "BrowserGuestModeEnabled": false, + "DefaultPopupsSetting": 2, + "DownloadRestrictions": 3, + "VideoCaptureAllowed": true, + "AllowFileSelectionDialogs": false, + "PromptForDownloadLocation": false, + "BookmarkBarEnabled": false, + "PasswordManagerEnabled": false, + "URLBlacklist": [ + "file://*", + "chrome://policy" + ], + "ExtensionInstallWhitelist": [ + "cjpalhdlnbpafiamejdnhcphjbkeiagm" + ], + "ExtensionInstallBlacklist": [ + "*" + ], + "ExtensionInstallForcelist": [ + "cjpalhdlnbpafiamejdnhcphjbkeiagm" + ] +} \ No newline at end of file diff --git a/.docker/files/chromium/preferences.json b/.docker/files/chromium/preferences.json new file mode 100644 index 00000000..31cd367a --- /dev/null +++ b/.docker/files/chromium/preferences.json @@ -0,0 +1,110 @@ +{ + "homepage": "http://www.google.com", + "homepage_is_newtabpage": false, + "first_run_tabs": [ + "https://www.google.com/_/chrome/newtab?ie=UTF-8" + ], + "custom_links": { + "initialized": true, + "list": [ + { + "title": "YouTube", + "url": "https://www.youtube.com/" + }, + { + "title": "Netflix", + "url": "https://netflix.com" + }, + { + "title": "Hulu", + "url": "https://www.hulu.com/" + }, + { + "title": "9Anime", + "url": "https://9anime.to/" + }, + { + "title": "Crunchy Roll", + "url": "https://www.crunchyroll.com/" + }, + { + "title": "Funimation", + "url": "https://www.funimation.com/" + }, + { + "title": "Disney+", + "url": "https://www.disneyplus.com/" + }, + { + "title": "HBO Now", + "url": "https://play.hbonow.com/" + }, + { + "title": "Amazon Video", + "url": "https://www.amazon.com/Amazon-Video/b?node=2858778011" + }, + { + "title": "VRV", + "url": "https://vrv.co/" + }, + { + "title": "Twitch", + "url": "https://www.twitch.tv/" + }, + { + "title": "Mixer", + "url": "https://mixer.com/" + } + ] + }, + "browser": { + "custom_chrome_frame": false, + "show_home_button": true, + "window_placement": { + "maximized": true + } + }, + "bookmark_bar": { + "show_on_all_tabs": false + }, + "sync_promo": { + "show_on_first_run_allowed": false + }, + "distribution": { + "import_bookmarks_from_file": "bookmarks.html", + "import_bookmarks": true, + "import_history": true, + "import_home_page": true, + "import_search_engine": true, + "ping_delay": 60, + "do_not_create_desktop_shortcut": true, + "do_not_create_quick_launch_shortcut": true, + "do_not_create_taskbar_shortcut": true, + "do_not_launch_chrome": true, + "do_not_register_for_update_launch": true, + "make_chrome_default": true, + "make_chrome_default_for_user": true, + "system_level": false, + "verbose_logging": false + }, + "profile": { + "avatar_index": 19, + "default_content_setting_values": { + "clipboard": 2, + "cookies": 4, + "geolocation": 2, + "media_stream_camera": 2, + "media_stream_mic": 2, + "midi_sysex": 2, + "payment_handler": 2, + "usb_guard": 2 + }, + "name": "neko", + "using_default_avatar": false, + "using_default_name": false, + "using_gaia_avatar": false + }, + "signin": { + "allowed": false + } +} diff --git a/.docker/files/chromium/supervisord.conf b/.docker/files/chromium/supervisord.conf new file mode 100644 index 00000000..459472e1 --- /dev/null +++ b/.docker/files/chromium/supervisord.conf @@ -0,0 +1,15 @@ + +# https://peter.sh/experiments/chromium-command-line-switches/ --no-sandbox +[program:chromium] +environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s" +command=/usr/lib/chromium/chromium --window-position=0,0 --window-size=%(ENV_SCREEN_WIDTH)s,%(ENV_SCREEN_HEIGHT)s --display=%(ENV_DISPLAY)s --start-maximized --bwsi --test-type --force-dark-mode --disable-file-system --disable-gpu --disable-software-rasterizer --disable-dev-shm-usage +autorestart=true +priority=800 +user=%(ENV_USER)s +stdout_logfile=/var/log/neko/chromium.log +stdout_logfile_maxbytes=100MB +stdout_logfile_backups=10 +redirect_stderr=true +stderr_logfile=/var/log/neko/chromium.err.log +stderr_logfile_maxbytes=100MB +stderr_logfile_backups=10 \ No newline at end of file diff --git a/.docker/files/chromium/test b/.docker/files/chromium/test new file mode 100755 index 00000000..ca152db1 --- /dev/null +++ b/.docker/files/chromium/test @@ -0,0 +1,29 @@ +#!/bin/bash + +# +# chromium +mkdir -p /etc/chromium/policies/managed + +# https://cloud.google.com/docs/chrome-enterprise/policies/ +cp files/chromium/policies.json /etc/chromium/policies/managed/policies.json +#rm -f /etc/chromium/policies/managed/policies.json + +cp files/chromium/preferences.json /usr/share/chromium/master_preferences +#rm -f /usr/share/chromium/master_preferences + +cp files/chromium/supervisord.conf /etc/neko/supervisord/chromium.conf +#rm -f /etc/neko/supervisord/firefox.conf + +# install widevine module +if [ ! -f /usr/lib/chromium/libwidevinecdm.so ]; then + WIDEVINE_VERSION=$(wget --quiet -O - https://dl.google.com/widevine-cdm/versions.txt | tail -n 1) + wget "https://dl.google.com/widevine-cdm/$WIDEVINE_VERSION-linux-x64.zip" -O /tmp/widevine.zip + unzip -p /tmp/widevine.zip libwidevinecdm.so > /usr/lib/chromium/libwidevinecdm.so + chmod 644 /usr/lib/chromium/libwidevinecdm.so + rm /tmp/widevine.zip +fi + +# +# clean up old sessions +rm -rf /home/$USER/.cache/chromium +rm -rf /home/$USER/.config/chromium diff --git a/.docker/files/dbus b/.docker/files/dbus index a09c1cfc..2859a0e2 100755 --- a/.docker/files/dbus +++ b/.docker/files/dbus @@ -4,8 +4,8 @@ if [ ! -d /var/run/dbus ]; then mkdir -p /var/run/dbus fi -if [ -f /var/run/dbus.pid ]; then - rm -f /var/run/dbus.pid +if [ -f /var/run/dbus/pid ]; then + rm -f /var/run/dbus/pid fi /usr/bin/dbus-daemon --nofork --print-pid --config-file=/usr/share/dbus-1/system.conf \ No newline at end of file diff --git a/.docker/files/firefox/Dockerfile b/.docker/files/firefox/Dockerfile new file mode 100644 index 00000000..eebfee7e --- /dev/null +++ b/.docker/files/firefox/Dockerfile @@ -0,0 +1,23 @@ +FROM nurdism/neko:base + +# install firefox-esr +RUN set -eux; apt-get update; \ + apt-get install -y --no-install-recommends firefox-esr; \ + # + # install extensions + mkdir -p /usr/lib/firefox-esr/distribution/extensions; \ + wget -O /usr/lib/firefox-esr/distribution/extensions/uBlock0@raymondhill.net.xpi https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi; \ + wget -O /usr/lib/firefox-esr/distribution/extensions/nordvpnproxy@nordvpn.com.xpi https://addons.mozilla.org/firefox/downloads/latest/nordvpn-proxy-extension/latest.xpi; \ + # + # clean up + apt-get --purge autoremove -y wget ca-certificates; \ + apt-get autoremove -y; \ + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +# +# copy configuation files +COPY supervisord.conf /etc/neko/supervisord/firefox.conf +COPY neko.js /usr/lib/firefox-esr/mozilla.cfg +COPY autoconfig.js /usr/lib/firefox-esr/defaults/pref/autoconfig.js +COPY policies.json /usr/lib/firefox-esr/distribution/policies.json diff --git a/.docker/files/firefox/supervisord.conf b/.docker/files/firefox/supervisord.conf new file mode 100644 index 00000000..db3ce1a4 --- /dev/null +++ b/.docker/files/firefox/supervisord.conf @@ -0,0 +1,14 @@ + +[program:firefox-esr] +environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s" +command=/usr/lib/firefox-esr/firefox-esr --display=%(ENV_DISPLAY)s --setDefaultBrowser -width %(ENV_SCREEN_WIDTH)s -height %(ENV_SCREEN_HEIGHT)s +autorestart=true +priority=800 +user=%(ENV_USER)s +stdout_logfile=/var/log/neko/firefox-esr.log +stdout_logfile_maxbytes=100MB +stdout_logfile_backups=10 +redirect_stderr=true +stderr_logfile=/var/log/neko/firefox-esr.err.log +stderr_logfile_maxbytes=100MB +stderr_logfile_backups=10 \ No newline at end of file diff --git a/.docker/files/firefox/test b/.docker/files/firefox/test new file mode 100755 index 00000000..8882a757 --- /dev/null +++ b/.docker/files/firefox/test @@ -0,0 +1,34 @@ +#!/bin/bash + +# +# firefox +cp files/firefox/neko.js /usr/lib/firefox-esr/mozilla.cfg +#rm -f /usr/lib/firefox-esr/mozilla.cfg + +cp files/firefox/autoconfig.js /usr/lib/firefox-esr/defaults/pref/autoconfig.js +#rm -f /usr/lib/firefox-esr/defaults/pref/autoconfig.js + +#https://github.com/mozilla/policy-templates +cp files/firefox/policies.json /usr/lib/firefox-esr/distribution/policies.json +#rm -f /usr/lib/firefox-esr/distribution/policies.json + +cp files/firefox/supervisord.conf /etc/neko/supervisord/firefox.conf +#rm -f /etc/neko/supervisord/firefox.conf + +# +# install extensions +mkdir -p /usr/lib/firefox/distribution/extensions + +# uBlock0 +if [ ! -f /usr/lib/firefox/distribution/extensions/uBlock0@raymondhill.net.xpi ]; then + curl -o /usr/lib/firefox/distribution/extensions/uBlock0@raymondhill.net.xpi https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/addon-607454-latest.xpi +fi + +# nordvpnproxy +if [ ! -f /usr/lib/firefox/distribution/extensions/nordvpnproxy@nordvpn.com.xpi ]; then + curl -o /usr/lib/firefox/distribution/extensions/nordvpnproxy@nordvpn.com.xpi https://addons.mozilla.org/firefox/downloads/latest/nordvpn-proxy-extension/latest.xpi +fi + +# +# clean up old sessions +rm -rf /home/$USER/.mozilla \ No newline at end of file diff --git a/.docker/files/neko/supervisord.conf b/.docker/files/neko/supervisord.conf new file mode 100644 index 00000000..84e418a7 --- /dev/null +++ b/.docker/files/neko/supervisord.conf @@ -0,0 +1,14 @@ + +[program:neko] +environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s" +command=/usr/bin/neko serve -d --static "/var/www" +autorestart=true +priority=800 +user=%(ENV_USER)s +stdout_logfile=/var/log/neko/neko.log +stdout_logfile_maxbytes=100MB +stdout_logfile_backups=10 +redirect_stderr=true +stderr_logfile=/var/log/neko/neko.err.log +stderr_logfile_maxbytes=100MB +stderr_logfile_backups=10 \ No newline at end of file diff --git a/.docker/files/openbox.xml b/.docker/files/openbox.xml index af6f12df..ec8ec927 100644 --- a/.docker/files/openbox.xml +++ b/.docker/files/openbox.xml @@ -12,13 +12,19 @@ - + no true yes normal + + no + true + yes + normal + diff --git a/.docker/files/opera/.gitkeep b/.docker/files/opera/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/.docker/files/supervisord.conf b/.docker/files/supervisord.conf index 86d1ec94..afdf7878 100644 --- a/.docker/files/supervisord.conf +++ b/.docker/files/supervisord.conf @@ -5,17 +5,20 @@ logfile=/dev/null logfile_maxbytes=0 loglevel=debug +[include] +files=/etc/neko/supervisord/*.conf + [program:dbus] environment=HOME="/root",USER="root" command=/usr/bin/dbus autorestart=true priority=100 user=root -stdout_logfile=/home/%(ENV_USER)s/.neko/logs/dbus.log +stdout_logfile=/var/log/neko/dbus.log stdout_logfile_maxbytes=100MB stdout_logfile_backups=10 redirect_stderr=true -stderr_logfile=/home/%(ENV_USER)s/.neko/logs/dbus.err.log +stderr_logfile=/var/log/neko/dbus.err.log stderr_logfile_maxbytes=100MB stderr_logfile_backups=10 @@ -25,11 +28,11 @@ command=/usr/bin/Xvfb %(ENV_DISPLAY)s -screen 0 %(ENV_SCREEN_WIDTH)sx%(ENV_SCREE autorestart=true priority=300 user=%(ENV_USER)s -stdout_logfile=/home/%(ENV_USER)s/.neko/logs/xvfb.log +stdout_logfile=/var/log/neko/xvfb.log stdout_logfile_maxbytes=100MB stdout_logfile_backups=10 redirect_stderr=true -stderr_logfile=/home/%(ENV_USER)s/.neko/logs/xvfb.err.log +stderr_logfile=/var/log/neko/xvfb.err.log stderr_logfile_maxbytes=100MB stderr_logfile_backups=10 @@ -39,11 +42,11 @@ command=/usr/bin/pulseaudio --disallow-module-loading -vvvv --disallow-exit --ex autorestart=true priority=300 user=%(ENV_USER)s -stdout_logfile=/home/%(ENV_USER)s/.neko/logs/pulseaudio.log +stdout_logfile=/var/log/neko/pulseaudio.log stdout_logfile_maxbytes=100MB stdout_logfile_backups=10 redirect_stderr=true -stderr_logfile=/home/%(ENV_USER)s/.neko/logs/pulseaudio.err.log +stderr_logfile=/var/log/neko/pulseaudio.err.log stderr_logfile_maxbytes=100MB stderr_logfile_backups=10 @@ -53,38 +56,10 @@ command=/usr/bin/openbox --config-file /etc/neko/openbox.xml autorestart=true priority=300 user=%(ENV_USER)s -stdout_logfile=/home/%(ENV_USER)s/.neko/logs/openbox.log +stdout_logfile=/var/log/neko/openbox.log stdout_logfile_maxbytes=100MB stdout_logfile_backups=10 redirect_stderr=true -stderr_logfile=/home/%(ENV_USER)s/.neko/logs/openbox.err.log -stderr_logfile_maxbytes=100MB -stderr_logfile_backups=10 - -[program:firefox-esr] -environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s" -command=/usr/lib/firefox-esr/firefox-esr --display=%(ENV_DISPLAY)s --setDefaultBrowser -width %(ENV_SCREEN_WIDTH)s -height %(ENV_SCREEN_HEIGHT)s -autorestart=true -priority=400 -user=%(ENV_USER)s -stdout_logfile=/home/%(ENV_USER)s/.neko/logs/firefox-esr.log -stdout_logfile_maxbytes=100MB -stdout_logfile_backups=10 -redirect_stderr=true -stderr_logfile=/home/%(ENV_USER)s/.neko/logs/firefox-esr.err.log -stderr_logfile_maxbytes=100MB -stderr_logfile_backups=10 - -[program:neko] -environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s" -command=/usr/bin/neko serve -d --static "/var/www" -autorestart=true -priority=800 -user=%(ENV_USER)s -stdout_logfile=/home/%(ENV_USER)s/.neko/logs/neko.log -stdout_logfile_maxbytes=100MB -stdout_logfile_backups=10 -redirect_stderr=true -stderr_logfile=/home/%(ENV_USER)s/.neko/logs/neko.err.log +stderr_logfile=/var/log/neko/openbox.err.log stderr_logfile_maxbytes=100MB stderr_logfile_backups=10 diff --git a/.docker/supervisord.conf b/.docker/supervisord.conf deleted file mode 100644 index 837dee62..00000000 --- a/.docker/supervisord.conf +++ /dev/null @@ -1,76 +0,0 @@ -[supervisord] -nodaemon=true -pidfile=/var/run/supervisord.pid -logfile=/dev/null -logfile_maxbytes=0 -loglevel=debug - -[program:dbus] -environment=HOME="/root",USER="root" -command=/usr/bin/dbus -autorestart=true -priority=100 -user=root -stdout_logfile=./logs/dbus.log -stdout_logfile_maxbytes=100MB -stdout_logfile_backups=10 -redirect_stderr=true -stderr_logfile=./logs/dbus.err.log -stderr_logfile_maxbytes=100MB -stderr_logfile_backups=10 - -[program:xvfb] -environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s" -command=/usr/bin/Xvfb %(ENV_DISPLAY)s -screen 0 %(ENV_SCREEN_WIDTH)sx%(ENV_SCREEN_HEIGHT)sx%(ENV_SCREEN_DEPTH)s -autorestart=true -priority=300 -user=%(ENV_USER)s -stdout_logfile=./logs/xvfb.log -stdout_logfile_maxbytes=100MB -stdout_logfile_backups=10 -redirect_stderr=true -stderr_logfile=./logs/xvfb.err.log -stderr_logfile_maxbytes=100MB -stderr_logfile_backups=10 - -[program:pulseaudio] -environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s" -command=/usr/bin/pulseaudio --disallow-module-loading -vvvv --disallow-exit --exit-idle-time=-1 -autorestart=true -priority=300 -user=%(ENV_USER)s -stdout_logfile=./logs/pulseaudio.log -stdout_logfile_maxbytes=100MB -stdout_logfile_backups=10 -redirect_stderr=true -stderr_logfile=./logs/pulseaudio.err.log -stderr_logfile_maxbytes=100MB -stderr_logfile_backups=10 - -[program:openbox] -environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s" -command=/usr/bin/openbox --config-file /etc/neko/openbox.xml -autorestart=true -priority=300 -user=%(ENV_USER)s -stdout_logfile=./logs/openbox.log -stdout_logfile_maxbytes=100MB -stdout_logfile_backups=10 -redirect_stderr=true -stderr_logfile=./logs/openbox.err.log -stderr_logfile_maxbytes=100MB -stderr_logfile_backups=10 - -[program:firefox-esr] -environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s" -command=/usr/lib/firefox-esr/firefox-esr --display=%(ENV_DISPLAY)s --setDefaultBrowser -width %(ENV_SCREEN_WIDTH)s -height %(ENV_SCREEN_HEIGHT)s -autorestart=true -priority=400 -user=%(ENV_USER)s -stdout_logfile=./logs/firefox-esr.log -stdout_logfile_maxbytes=100MB -stdout_logfile_backups=10 -redirect_stderr=true -stderr_logfile=./logs/firefox-esr.err.log -stderr_logfile_maxbytes=100MB -stderr_logfile_backups=10 diff --git a/.docker/test b/.docker/test index a85af6bb..ad35f3fd 100755 --- a/.docker/test +++ b/.docker/test @@ -7,65 +7,72 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi -# if [ ! -f ../server/bin/neko ]; then -# echo "build server before testing" -# exit 1 -# fi - -# if [ ! -d ../client/dist/ ]; then -# echo "build client before testing" -# exit 1 -# fi - -sudo mkdir -p /var/run/dbus /etc/neko -sudo rm -rf /var/run/dbus.pid - -sudo cp files/firefox/neko.js /usr/lib/firefox-esr/mozilla.cfg -#sudo rm -f /usr/lib/firefox-esr/mozilla.cfg - -sudo cp files/firefox/autoconfig.js /usr/lib/firefox-esr/defaults/pref/autoconfig.js -#sudo rm -f /usr/lib/firefox-esr/defaults/pref/autoconfig.js - -sudo cp files/firefox/policies.json /usr/lib/firefox-esr/distribution/policies.json -#sudo rm -f /usr/lib/firefox-esr/distribution/policies.json - -sudo cp files/dbus /usr/bin/dbus -sudo cp files/default.pa /etc/pulse/default.pa -sudo cp files/supervisord.conf /etc/neko/supervisord.conf -sudo cp files/openbox.xml /etc/neko/openbox.xml - -sudo mkdir -p /usr/lib/firefox/distribution/extensions - -if [ ! -f /usr/lib/firefox/distribution/extensions/uBlock0@raymondhill.net.xpi ]; then - sudo curl -o /usr/lib/firefox/distribution/extensions/uBlock0@raymondhill.net.xpi https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/addon-607454-latest.xpi -fi - -if [ ! -f /usr/lib/firefox/distribution/extensions/nordvpnproxy@nordvpn.com.xpi ]; then - sudo curl -o /usr/lib/firefox/distribution/extensions/nordvpnproxy@nordvpn.com.xpi https://addons.mozilla.org/firefox/downloads/latest/nordvpn-proxy-extension/latest.xpi -fi - -sudo cp ../server/bin/neko /usr/bin/neko -sudo cp -R ../client/dist /var/www/ - -sudo rm -rf $HOME/.mozilla - -mkdir -p $HOME/.config/pulse -echo "default-server=unix:/tmp/pulseaudio.socket" > $HOME/.config/pulse/client.conf - export USER=neko export SCREEN_WIDTH=1280 export SCREEN_HEIGHT=720 export SCREEN_DEPTH=24 export DISPLAY=:99.0 -export NEKO_PASSWORD=neko -export NEKO_BIND=:8080 -export NEKO_KEY= -export NEKO_CERT= +# +# create log folders +if [ ! -L /var/log/neko ]; then + mkdir -p /var/log/neko + mkdir -p logs -if [ -d logs ]; then - sudo rm -rf logs + ln -s /workspace/.docker/logs /var/log/neko + + chown -R $USER logs + chown -R $USER /var/log/neko fi -mkdir logs -supervisord --configuration ./supervisord.conf \ No newline at end of file +# +# clean up old logs +if [ -d logs ]; then + rm -rf logs/*.log +fi + +# +# copy neko config +mkdir -p /etc/neko/supervisord +cp files/dbus /usr/bin/dbus +cp files/default.pa /etc/pulse/default.pa +cp files/supervisord.conf /etc/neko/supervisord.conf +cp files/openbox.xml /etc/neko/openbox.xml + +# +# remove old configs +rm -rf /etc/neko/supervisord/*.conf + +# +# copy dist files +if [ -f ../server/bin/neko ]; then + cp ../server/bin/neko /usr/bin/neko +fi + +if [ -d ../client/dist ]; then + cp -R ../client/dist /var/www/ +fi + +# +# setup pules +if [ ! -f /home/$USER/.config/pulse/client.conf ]; then + mkdir -p /home/$USER/.config/pulse + echo "default-server=unix:/tmp/pulseaudio.socket" > /home/$USER/.config/pulse/client.conf + chown -R $USER /home/$USER/.config; +fi + +# +# run setup for browser +case $1 in + firefox) ./files/firefox/test ;; + chromium) ./files/chromium/test ;; + *) ./files/chromium/test ;; +esac + +# +# clean up old sessions +rm -rf /home/$USER/.dbus + +# +# run supervisord +supervisord --configuration ./files/supervisord.conf \ No newline at end of file diff --git a/.gitignore b/.gitignore index 914f0ca2..cc3c0188 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ tmp/ logs/ *.log core +.build # Runtime data pids diff --git a/Dockerfile b/Dockerfile index 041bdd8b..c29eefc3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,84 +3,45 @@ FROM debian:stretch-slim # avoid warnings by switching to noninteractive ENV DEBIAN_FRONTEND=noninteractive -ENV GSTPATH /gst -ENV GST_VERSION 1.16 - -# build gstreamer -RUN set -eux && \ - apt-get update && apt-get install -y --no-install-recommends \ - git ca-certificates build-essential perl python pkg-config autoconf automake autopoint libtool bison flex \ - gettext nasm openssl libglib2.0-dev libopus-dev libvpx-dev libpulse-dev libx11-dev libxv-dev libxt-dev \ - libxtst-dev libxfixes-dev libssl-dev \ - ## set up dir - && mkdir $GSTPATH \ - # - # build openh264 - && cd $GSTPATH \ - && git clone https://github.com/cisco/openh264.git \ - && cd openh264 \ - && make && make install \ - && cd $GSTPATH && rm -rf openh264 \ - # - # build gstreamer - && for MODULE in \ - gstreamer \ - gst-plugins-base \ - gst-plugins-good \ - gst-plugins-bad \ - ; do \ - git clone git://anongit.freedesktop.org/gstreamer/$MODULE; \ - cd $MODULE; \ - git checkout $GST_VERSION; \ - PATH=$GSTPATH/local/bin:$PATH PKG_CONFIG_PATH=$GSTPATH/local/lib/pkgconfig ./autogen.sh --prefix $GSTPATH/local --disable-gtk-doc; \ - make && make install; \ - cd $GSTPATH && rm -rf $MODULE; \ - done \ - # - # remove build deps - && apt-get --purge autoremove -y build-essential perl python pkg-config autoconf automake autopoint libtool bison flex \ - gettext nasm openssl libglib2.0-dev libopus-dev libvpx-dev libpulse-dev libx11-dev libxv-dev libxt-dev \ - libxtst-dev libxfixes-dev libssl-dev - -ENV PATH=$GSTPATH/local/bin:$PATH -ENV LD_LIBRARY_PATH=$GSTPATH/local/lib:$LD_LIBRARY_PATH -ENV PKG_CONFIG_PATH=$GSTPATH/local/lib/pkgconfig:$PKG_CONFIG_PATH - ARG USERNAME=neko ARG USER_UID=1000 ARG USER_GID=$USER_UID # install neko dependencies -RUN set -eux \ - && apt-get update && apt-get install -y --no-install-recommends wget ca-certificates pulseaudio openbox dbus-x11 xvfb libxv1 xclip firefox-esr supervisor \ +RUN set -eux; apt-get update; \ + apt-get install -y --no-install-recommends wget ca-certificates pulseaudio openbox dbus-x11 xvfb xclip supervisor; \ + apt-get install -y --no-install-recommends libxv1 libopus0 libvpx4; \ # # create a non-root user - && groupadd --gid $USER_GID $USERNAME \ - && useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME \ - && adduser $USERNAME audio \ - && adduser $USERNAME video \ - && adduser $USERNAME pulse \ - # - # install extensions - && mkdir -p /usr/lib/firefox-esr/distribution/extensions \ - && wget -O /usr/lib/firefox-esr/distribution/extensions/uBlock0@raymondhill.net.xpi https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi \ - && wget -O /usr/lib/firefox-esr/distribution/extensions/nordvpnproxy@nordvpn.com.xpi https://addons.mozilla.org/firefox/downloads/latest/nordvpn-proxy-extension/latest.xpi \ + groupadd --gid $USER_GID $USERNAME; \ + useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME; \ + adduser $USERNAME audio; \ + adduser $USERNAME video; \ + adduser $USERNAME pulse; \ # # setup pulseaudio - && mkdir -p /home/$USERNAME/.config/pulse/ \ - && echo "default-server=unix:/tmp/pulseaudio.socket" > /home/$USERNAME/.config/pulse/client.conf \ + mkdir -p /home/$USERNAME/.config/pulse/; \ + echo "default-server=unix:/tmp/pulseaudio.socket" > /home/$USERNAME/.config/pulse/client.conf; \ # # workaround for an X11 problem: http://blog.tigerteufel.de/?p=476 - && mkdir /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix && chown $USERNAME /tmp/.X11-unix/ \ + mkdir /tmp/.X11-unix; chmod 1777 /tmp/.X11-unix; chown $USERNAME /tmp/.X11-unix/; \ # # make directories for neko - && mkdir -p /etc/neko /var/www /home/$USERNAME/.neko/logs \ - && chown -R $USERNAME:$USERNAME /home/$USERNAME \ + mkdir -p /etc/neko /var/www /var/log/neko; chmod 1777 /var/log/neko; chown $USERNAME /var/log/neko/; \ + chown -R $USERNAME:$USERNAME /home/$USERNAME; \ # # clean up - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* /var/cache/apt/* + apt-get autoremove -y; \ + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +# add gst to env +ENV PATH=/gst/local/bin:$PATH +ENV LD_LIBRARY_PATH=/gst/local/lib:$LD_LIBRARY_PATH +ENV PKG_CONFIG_PATH=/gst/local/lib/pkgconfig:$PKG_CONFIG_PATH + +# copy gst +COPY .build/gst/local /gst/local/ # # env @@ -94,11 +55,9 @@ ENV DISPLAY=:99.0 # copy configuation files COPY .docker/files/dbus /usr/bin/dbus COPY .docker/files/openbox.xml /etc/neko/openbox.xml +COPY .docker/files/neko/supervisord.conf /etc/neko/supervisord/neko.conf COPY .docker/files/supervisord.conf /etc/neko/supervisord.conf COPY .docker/files/default.pa /etc/pulse/default.pa -COPY .docker/files/firefox/neko.js /usr/lib/firefox-esr/mozilla.cfg -COPY .docker/files/firefox/autoconfig.js /usr/lib/firefox-esr/defaults/pref/autoconfig.js -COPY .docker/files/firefox/policies.json /usr/lib/firefox-esr/distribution/policies.json # # neko files diff --git a/README.md b/README.md index 875d4da1..fe171e0c 100644 --- a/README.md +++ b/README.md @@ -53,12 +53,20 @@ I like cats 🐱 (`Neko` is the Japanese word for cat), I'm a weeb/nerd > 💡 **Protip**: Run `nano docker-compose.yaml` to edit the settings, then press *ctrl+x* to exit and save the file. -### Running the container: +### Running: +#### Chromium container: ``` -sudo docker run -p 8080:8080 -p 59000-59100:59000-59100/udp -e NEKO_PASSWORD='secret' -e NEKO_ADMIN='secret' --shm-size=1gb nurdism/neko:latest +sudo docker run -p 80:8080 -p 59000-59100:59000-59100/udp --cap-add SYS_ADMIN nurdism/neko:chromium ``` +*Note:* `--cap-add SYS_ADMIN` is required for chromium to run properly + +---- +#### Firefox container: +``` +sudo docker run -p 8080:8080 -p 59000-59100:59000-59100/udp -e NEKO_PASSWORD='secret' -e NEKO_ADMIN='secret' --shm-size=1gb nurdism/neko:firefox +``` +*Note:* `--shm-size=1gb` is required for firefox, tabs will crash otherwise -*Note:* `--shm-size=1gb` is required, firefox tabs will crash, not sure what it does to be honest 😅 ### Docker Basic Configuration ``` diff --git a/docker-compose.yaml b/docker-compose.yaml index 8eecbf05..8891008e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,7 @@ version: "2.0" services: neko: - image: nurdism/neko + image: nurdism/neko:firefox restart: always shm_size: "1gb" ports: diff --git a/server/README.md b/server/README.md index 1e9ccfdf..53831a8d 100644 --- a/server/README.md +++ b/server/README.md @@ -47,8 +47,19 @@ Development: libxtst-dev ``` +### Testing +------ +located in `.docker` folder +``` +./test firefox // creates an x server, puleseaudio server add firefox instance +./test chromium // creates an x server, puleseaudio server add chromium instance +``` + ### Building ------ +located in `.docker` folder ``` -./build +./build gst // builds the required gst packages in `.build/gst/` +./build docker // builds the docker images +./build push // pushes the images to docker hub ```