update docker - #325

Merged
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker
Oct 28, 2022
Merged

update docker#325
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker

Conversation

@ReenigneArcher

@ReenigneArcherReenigneArcher commented Aug 11, 2022

Copy link
Copy Markdown
Member

Description

  • Add sunshine docker image

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 12 times, most recently from 1e44b40 to 9b91da1CompareAugust 11, 2022 23:14
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 5 times, most recently from bd41c84 to 81430bdCompareAugust 12, 2022 00:42
@ReenigneArcherReenigneArcher mentioned this pull request Aug 12, 2022
7 tasks
@ReenigneArcher
ReenigneArcher marked this pull request as ready for review August 12, 2022 02:13
@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

@ABeltramo could you please review this PR when you have time? Most importantly, the Dockerfile and DOCKER_README.md. Let me know if I need to add anything in order for this to be usable for GOW.

@ABeltramo

Copy link
Copy Markdown
Contributor

I encountered a few issues by checking this out on my local machine, I'll present them in order:

Docker build failed

I started by trying to build the image and this error was returned: mkdir unable to create folder /root/sunshine-build/build.
This is because I'm also building via cmake in the same folder so the build/ folder was already present and it'll be COPY-ed over when doing COPY . ..

My suggestion is to add a .dockerignore file with the stuff that shouldn't be copied, ex:

build
.github
tools
docs

This will also avoid invalidating the cache when changing stuff that's not going into the container anyway.

TZ, PUID and PGID aren't mapped

While you specified them as part of possible environment variables they aren't mapped to anything in the dockerfile. Docker doesn't take care of them automagically (unfortunately).

If you set them as ARG like ARG TZ="America/New_York" this can be changed only during build time but once an image has been built they are written in stone.

The correct way is to set them as ENV and then, in order to properly set this stuff up, you'll have to add a bash script on startup that creates the user with the correct PUID, PGID and changes the timezone to what the user passed at runtime.

Running the container doesn't work

After building the docker image I tried to run it but I've got the following error:

unable to start container process: exec: "/usr/bin/sunshine": stat /usr/bin/sunshine: no such file or directory: unknown.

Let's see what's in the docker image then:

docker run -it --rm --name=sunshine --net=host --entrypoint /bin/bash lizardbyte/sunshine:local
ls /usr/bin/sunshine
ls: cannot access '/usr/bin/sunshine': No such file or directory
ls -la /config/
total 8
drwxr-xr-x 2 root root 4096 Aug 12 07:46 .
drwxr-xr-x 1 root root 4096 Aug 12 08:05 ..
ls /sunshine.deb
/sunshine.deb
dpkg-deb -I /sunshine.deb
new Debian package, version 2.0.
size 3170778 bytes: control archive=2586 bytes.
78 bytes, 2 lines conffiles 631 bytes, 12 lines control 4631 bytes, 51 lines md5sums 1232 bytes, 41 lines postinst #!/bin/sh
385 bytes, 9 lines preinst #!/bin/sh
Architecture: amd64
Depends: openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2
Description: Sunshine is a Gamestream host for Moonlight.
Sunshine is a Gamestream host for Moonlight.
Homepage: https://app.lizardbyte.dev
Maintainer: https://github.com/LizardByte
Package: sunshine
Priority: optional
Section: devel
Version: 0.14.1
Installed-Size: 12739
dpkg-deb -c /sunshine.deb
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/bin/
lrwxrwxrwx root/root 0 2022-08-12 07:46 ./etc/bin/sunshine -> sunshine-0.14.1
-rwxr-xr-x root/root 4548680 2022-08-12 07:46 ./etc/bin/sunshine-0.14.1
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/user/
-rw-r--r-- root/root 148 2022-08-12 07:45 ./etc/lib/systemd/user/sunshine.service
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/rules.d/
-rw-r--r-- root/root 75 2022-08-12 07:37 ./etc/lib/udev/rules.d/85-sunshine.rules
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/
-rw-r--r-- root/root 998 2022-08-12 07:37 ./etc/sunshine/assets/box.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/opengl/
-rw-r--r-- root/root 855 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.frag
-rw-r--r-- root/root 620 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.vert
-rw-r--r-- root/root 399 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertY.frag
-rw-r--r-- root/root 181 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.frag
-rw-r--r-- root/root 347 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.vert
-rw-r--r-- root/root 25012 2022-08-12 07:37 ./etc/sunshine/assets/steam.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/
-rw-r--r-- root/root 8177 2022-08-12 07:37 ./etc/sunshine/assets/web/apps.html
-rw-r--r-- root/root 63 2022-08-12 07:37 ./etc/sunshine/assets/web/clients.html
-rw-r--r-- root/root 33037 2022-08-12 07:37 ./etc/sunshine/assets/web/config.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/
-rw-r--r-- root/root 1548 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/LICENSE.txt
-rw-r--r-- root/root 187 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/attribution.js
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/
-rw-r--r-- root/root 59305 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/all.min.css
-rw-r--r-- root/root 675 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/brands.min.css
-rw-r--r-- root/root 57873 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/fontawesome.min.css
-rw-r--r-- root/root 677 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/regular.min.css
-rw-r--r-- root/root 669 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/solid.min.css
-rw-r--r-- root/root 6359 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/svg-with-js.min.css
-rw-r--r-- root/root 26702 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/v4-shims.min.css
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/
-rw-r--r-- root/root 134294 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.eot
-rw-r--r-- root/root 747927 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.svg
-rw-r--r-- root/root 133988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.ttf
-rw-r--r-- root/root 89988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff
-rw-r--r-- root/root 76736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff2
-rw-r--r-- root/root 34034 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.eot
-rw-r--r-- root/root 144714 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.svg
-rw-r--r-- root/root 33736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.ttf
-rw-r--r-- root/root 16276 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff
-rw-r--r-- root/root 13224 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff2
-rw-r--r-- root/root 203030 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.eot
-rw-r--r-- root/root 918991 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.svg
-rw-r--r-- root/root 202744 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.ttf
-rw-r--r-- root/root 101648 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff
-rw-r--r-- root/root 78268 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff2
-rw-r--r-- root/root 452 2022-08-12 07:37 ./etc/sunshine/assets/web/header-no-nav.html
-rw-r--r-- root/root 2762 2022-08-12 07:37 ./etc/sunshine/assets/web/header.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/images/
-rw-r--r-- root/root 120760 2022-08-12 07:37 ./etc/sunshine/assets/web/images/favicon.ico
-rw-r--r-- root/root 2115 2022-08-12 07:37 ./etc/sunshine/assets/web/images/logo-sunshine-45.png
-rw-r--r-- root/root 1546 2022-08-12 07:37 ./etc/sunshine/assets/web/index.html
-rw-r--r-- root/root 3636 2022-08-12 07:37 ./etc/sunshine/assets/web/password.html
-rw-r--r-- root/root 1525 2022-08-12 07:37 ./etc/sunshine/assets/web/pin.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/third_party/
-rw-r--r-- root/root 79665 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.bundle.min.js
-rw-r--r-- root/root 155567 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.min.css
-rw-r--r-- root/root 342147 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/vue.js
-rw-r--r-- root/root 2454 2022-08-12 07:37 ./etc/sunshine/assets/web/troubleshooting.html
-rw-r--r-- root/root 2855 2022-08-12 07:37 ./etc/sunshine/assets/web/welcome.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/config/
-rw-r--r-- root/root 377 2022-08-12 07:37 ./etc/sunshine/config/apps.json
-rw-r--r-- root/root 73 2022-08-12 07:37 ./etc/sunshine/config/sunshine.conf

Found it! It looks like Sunshine is installed at /etc/bin/sunshine. I'm not sure here what's the latest on the cpack you can either change the ENTRYPOINT or change the install path with some cmake variable if you have one.

Let's run it!

I've changed the entrypoint, rebuilt and run:

docker run -it --rm --name=sunshine --net=host lizardbyte/sunshine:local

Nothing happens, no log message, no output. The process is stuck there eating CPU at 100% but worst of all allocating memory like crazy!

Screenshot 2022-08-12 at 09 19 56

(it keeps growing, here at ~6.5GB of RAM used I forcefully killed the container).

I don't know what the issue is but this seems pretty bad.

Final comments

There are a few things missing in this Dockerfile compared to the Dockerfile on GOW most notably:

  • you haven't installed any additional libraries when installing the .deb
  • using --no-install-recommends when installing sunshine.deb might have created an environment that is missing some required library.

Even assuming that the final container is in a good state the instructions in the DOCKER_README aren't really sufficient to run Sunshine. You'll have to pass the Xorg/Wayland socket, PulseAudio/Pipewire, udev, dbus and on top of that, depending on the GPU, you'll have to install the correct drivers, software packages and pass the right options to the docker run command (see the docs on GOW: run on desktop, NVIDIA config.

Some might say this looks like a completely different project and that's probably why you should point people to GOW instead 😉

@ABeltramo

Copy link
Copy Markdown
Contributor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

Revisiting this again. I agree with this idea and my updates to this branch "should" reflect that.

These items from your previous review should be fixed as well.

  • build and several other directories/files added to .dockerignore
  • TZ, PUID and PGID args removed
  • sunshine binary should now be at /usr/bin/sunshine (actually fixed by fix path issues #330 )
  • DOCKER_README.md updated (still probably lacking)

Not real sure about the CPU and ram usage. My only guess would be that Sunshine was continuously crashing and restarting?

@ABeltramo

Copy link
Copy Markdown
Contributor

I have to spend some more time in trying this out with GOW but I have a quick suggestion, first:

TZ, PUID and PGID args removed

This is probably not the best way forward; processes in Docker container shouldn't run as root. I think it would be better to create a default user but also give users the ability to override that at build time (if needed).

Something like:

FROM sunshine-base as sunshine
# copy deb from builderCOPY --from=sunshine-build /root/sunshine-build/build/cpack_artifacts/Sunshine.deb /sunshine.deb
# install sunshineRUN apt-get update -y \
&& apt-get install -y --no-install-recommends /sunshine.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV TZ="Europe/London"ARG UNAME=retro
ENV UNAME=${UNAME}
ARG PUID=1000
ENV PUID=${PUID}
ARG PGID=1000
ENV PGID=${PGID}
RUN groupadd -f -g "${PGID}""${UNAME}"RUN useradd -mk "$(mktemp -d)" -u "${PUID}" -g "${PGID}""${UNAME}"ENV HOME=/home/$UNAME
USER ${UNAME}
# network setupEXPOSE 47984-47990/tcp
EXPOSE 48010
EXPOSE 47998-48000/udp
# setup config directoryRUN mkdir ${HOME}/config
# entrypointENTRYPOINT ["/usr/bin/sunshine", "${HOME}/config/sunshine.conf"]

- add user setup
- simplify `ENTRYPOINT` by creating symbolic link to user's config directory
Co-Authored-By: ABeltramo <beltramo.ale@gmail.com>
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 2 times, most recently from bf7625e to 497e609CompareOctober 27, 2022 03:25
@ReenigneArcher
ReenigneArcher merged commit dcdd716 into nightlyOct 28, 2022
@ReenigneArcher
ReenigneArcher deleted the update/docker branch October 28, 2022 01:51
@ReenigneArcherReenigneArcher mentioned this pull request Oct 28, 2022
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ReenigneArcher@ABeltramo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

update docker - #325

Merged
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker
Oct 28, 2022
Merged

update docker#325
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker

Conversation

@ReenigneArcher

@ReenigneArcherReenigneArcher commented Aug 11, 2022

Copy link
Copy Markdown
Member

Description

  • Add sunshine docker image

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 12 times, most recently from 1e44b40 to 9b91da1CompareAugust 11, 2022 23:14
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 5 times, most recently from bd41c84 to 81430bdCompareAugust 12, 2022 00:42
@ReenigneArcherReenigneArcher mentioned this pull request Aug 12, 2022
7 tasks
@ReenigneArcher
ReenigneArcher marked this pull request as ready for review August 12, 2022 02:13
@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

@ABeltramo could you please review this PR when you have time? Most importantly, the Dockerfile and DOCKER_README.md. Let me know if I need to add anything in order for this to be usable for GOW.

@ABeltramo

Copy link
Copy Markdown
Contributor

I encountered a few issues by checking this out on my local machine, I'll present them in order:

Docker build failed

I started by trying to build the image and this error was returned: mkdir unable to create folder /root/sunshine-build/build.
This is because I'm also building via cmake in the same folder so the build/ folder was already present and it'll be COPY-ed over when doing COPY . ..

My suggestion is to add a .dockerignore file with the stuff that shouldn't be copied, ex:

build
.github
tools
docs

This will also avoid invalidating the cache when changing stuff that's not going into the container anyway.

TZ, PUID and PGID aren't mapped

While you specified them as part of possible environment variables they aren't mapped to anything in the dockerfile. Docker doesn't take care of them automagically (unfortunately).

If you set them as ARG like ARG TZ="America/New_York" this can be changed only during build time but once an image has been built they are written in stone.

The correct way is to set them as ENV and then, in order to properly set this stuff up, you'll have to add a bash script on startup that creates the user with the correct PUID, PGID and changes the timezone to what the user passed at runtime.

Running the container doesn't work

After building the docker image I tried to run it but I've got the following error:

unable to start container process: exec: "/usr/bin/sunshine": stat /usr/bin/sunshine: no such file or directory: unknown.

Let's see what's in the docker image then:

docker run -it --rm --name=sunshine --net=host --entrypoint /bin/bash lizardbyte/sunshine:local
ls /usr/bin/sunshine
ls: cannot access '/usr/bin/sunshine': No such file or directory
ls -la /config/
total 8
drwxr-xr-x 2 root root 4096 Aug 12 07:46 .
drwxr-xr-x 1 root root 4096 Aug 12 08:05 ..
ls /sunshine.deb
/sunshine.deb
dpkg-deb -I /sunshine.deb
new Debian package, version 2.0.
size 3170778 bytes: control archive=2586 bytes.
78 bytes, 2 lines conffiles 631 bytes, 12 lines control 4631 bytes, 51 lines md5sums 1232 bytes, 41 lines postinst #!/bin/sh
385 bytes, 9 lines preinst #!/bin/sh
Architecture: amd64
Depends: openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2
Description: Sunshine is a Gamestream host for Moonlight.
Sunshine is a Gamestream host for Moonlight.
Homepage: https://app.lizardbyte.dev
Maintainer: https://github.com/LizardByte
Package: sunshine
Priority: optional
Section: devel
Version: 0.14.1
Installed-Size: 12739
dpkg-deb -c /sunshine.deb
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/bin/
lrwxrwxrwx root/root 0 2022-08-12 07:46 ./etc/bin/sunshine -> sunshine-0.14.1
-rwxr-xr-x root/root 4548680 2022-08-12 07:46 ./etc/bin/sunshine-0.14.1
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/user/
-rw-r--r-- root/root 148 2022-08-12 07:45 ./etc/lib/systemd/user/sunshine.service
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/rules.d/
-rw-r--r-- root/root 75 2022-08-12 07:37 ./etc/lib/udev/rules.d/85-sunshine.rules
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/
-rw-r--r-- root/root 998 2022-08-12 07:37 ./etc/sunshine/assets/box.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/opengl/
-rw-r--r-- root/root 855 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.frag
-rw-r--r-- root/root 620 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.vert
-rw-r--r-- root/root 399 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertY.frag
-rw-r--r-- root/root 181 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.frag
-rw-r--r-- root/root 347 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.vert
-rw-r--r-- root/root 25012 2022-08-12 07:37 ./etc/sunshine/assets/steam.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/
-rw-r--r-- root/root 8177 2022-08-12 07:37 ./etc/sunshine/assets/web/apps.html
-rw-r--r-- root/root 63 2022-08-12 07:37 ./etc/sunshine/assets/web/clients.html
-rw-r--r-- root/root 33037 2022-08-12 07:37 ./etc/sunshine/assets/web/config.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/
-rw-r--r-- root/root 1548 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/LICENSE.txt
-rw-r--r-- root/root 187 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/attribution.js
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/
-rw-r--r-- root/root 59305 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/all.min.css
-rw-r--r-- root/root 675 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/brands.min.css
-rw-r--r-- root/root 57873 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/fontawesome.min.css
-rw-r--r-- root/root 677 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/regular.min.css
-rw-r--r-- root/root 669 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/solid.min.css
-rw-r--r-- root/root 6359 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/svg-with-js.min.css
-rw-r--r-- root/root 26702 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/v4-shims.min.css
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/
-rw-r--r-- root/root 134294 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.eot
-rw-r--r-- root/root 747927 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.svg
-rw-r--r-- root/root 133988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.ttf
-rw-r--r-- root/root 89988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff
-rw-r--r-- root/root 76736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff2
-rw-r--r-- root/root 34034 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.eot
-rw-r--r-- root/root 144714 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.svg
-rw-r--r-- root/root 33736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.ttf
-rw-r--r-- root/root 16276 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff
-rw-r--r-- root/root 13224 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff2
-rw-r--r-- root/root 203030 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.eot
-rw-r--r-- root/root 918991 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.svg
-rw-r--r-- root/root 202744 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.ttf
-rw-r--r-- root/root 101648 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff
-rw-r--r-- root/root 78268 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff2
-rw-r--r-- root/root 452 2022-08-12 07:37 ./etc/sunshine/assets/web/header-no-nav.html
-rw-r--r-- root/root 2762 2022-08-12 07:37 ./etc/sunshine/assets/web/header.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/images/
-rw-r--r-- root/root 120760 2022-08-12 07:37 ./etc/sunshine/assets/web/images/favicon.ico
-rw-r--r-- root/root 2115 2022-08-12 07:37 ./etc/sunshine/assets/web/images/logo-sunshine-45.png
-rw-r--r-- root/root 1546 2022-08-12 07:37 ./etc/sunshine/assets/web/index.html
-rw-r--r-- root/root 3636 2022-08-12 07:37 ./etc/sunshine/assets/web/password.html
-rw-r--r-- root/root 1525 2022-08-12 07:37 ./etc/sunshine/assets/web/pin.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/third_party/
-rw-r--r-- root/root 79665 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.bundle.min.js
-rw-r--r-- root/root 155567 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.min.css
-rw-r--r-- root/root 342147 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/vue.js
-rw-r--r-- root/root 2454 2022-08-12 07:37 ./etc/sunshine/assets/web/troubleshooting.html
-rw-r--r-- root/root 2855 2022-08-12 07:37 ./etc/sunshine/assets/web/welcome.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/config/
-rw-r--r-- root/root 377 2022-08-12 07:37 ./etc/sunshine/config/apps.json
-rw-r--r-- root/root 73 2022-08-12 07:37 ./etc/sunshine/config/sunshine.conf

Found it! It looks like Sunshine is installed at /etc/bin/sunshine. I'm not sure here what's the latest on the cpack you can either change the ENTRYPOINT or change the install path with some cmake variable if you have one.

Let's run it!

I've changed the entrypoint, rebuilt and run:

docker run -it --rm --name=sunshine --net=host lizardbyte/sunshine:local

Nothing happens, no log message, no output. The process is stuck there eating CPU at 100% but worst of all allocating memory like crazy!

Screenshot 2022-08-12 at 09 19 56

(it keeps growing, here at ~6.5GB of RAM used I forcefully killed the container).

I don't know what the issue is but this seems pretty bad.

Final comments

There are a few things missing in this Dockerfile compared to the Dockerfile on GOW most notably:

  • you haven't installed any additional libraries when installing the .deb
  • using --no-install-recommends when installing sunshine.deb might have created an environment that is missing some required library.

Even assuming that the final container is in a good state the instructions in the DOCKER_README aren't really sufficient to run Sunshine. You'll have to pass the Xorg/Wayland socket, PulseAudio/Pipewire, udev, dbus and on top of that, depending on the GPU, you'll have to install the correct drivers, software packages and pass the right options to the docker run command (see the docs on GOW: run on desktop, NVIDIA config.

Some might say this looks like a completely different project and that's probably why you should point people to GOW instead 😉

@ABeltramo

Copy link
Copy Markdown
Contributor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

Revisiting this again. I agree with this idea and my updates to this branch "should" reflect that.

These items from your previous review should be fixed as well.

  • build and several other directories/files added to .dockerignore
  • TZ, PUID and PGID args removed
  • sunshine binary should now be at /usr/bin/sunshine (actually fixed by fix path issues #330 )
  • DOCKER_README.md updated (still probably lacking)

Not real sure about the CPU and ram usage. My only guess would be that Sunshine was continuously crashing and restarting?

@ABeltramo

Copy link
Copy Markdown
Contributor

I have to spend some more time in trying this out with GOW but I have a quick suggestion, first:

TZ, PUID and PGID args removed

This is probably not the best way forward; processes in Docker container shouldn't run as root. I think it would be better to create a default user but also give users the ability to override that at build time (if needed).

Something like:

FROM sunshine-base as sunshine
# copy deb from builderCOPY --from=sunshine-build /root/sunshine-build/build/cpack_artifacts/Sunshine.deb /sunshine.deb
# install sunshineRUN apt-get update -y \
&& apt-get install -y --no-install-recommends /sunshine.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV TZ="Europe/London"ARG UNAME=retro
ENV UNAME=${UNAME}
ARG PUID=1000
ENV PUID=${PUID}
ARG PGID=1000
ENV PGID=${PGID}
RUN groupadd -f -g "${PGID}""${UNAME}"RUN useradd -mk "$(mktemp -d)" -u "${PUID}" -g "${PGID}""${UNAME}"ENV HOME=/home/$UNAME
USER ${UNAME}
# network setupEXPOSE 47984-47990/tcp
EXPOSE 48010
EXPOSE 47998-48000/udp
# setup config directoryRUN mkdir ${HOME}/config
# entrypointENTRYPOINT ["/usr/bin/sunshine", "${HOME}/config/sunshine.conf"]

- add user setup
- simplify `ENTRYPOINT` by creating symbolic link to user's config directory
Co-Authored-By: ABeltramo <beltramo.ale@gmail.com>
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 2 times, most recently from bf7625e to 497e609CompareOctober 27, 2022 03:25
@ReenigneArcher
ReenigneArcher merged commit dcdd716 into nightlyOct 28, 2022
@ReenigneArcher
ReenigneArcher deleted the update/docker branch October 28, 2022 01:51
@ReenigneArcherReenigneArcher mentioned this pull request Oct 28, 2022
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ReenigneArcher@ABeltramo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

update docker - #325

Merged
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker
Oct 28, 2022
Merged

update docker#325
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker

Conversation

@ReenigneArcher

@ReenigneArcherReenigneArcher commented Aug 11, 2022

Copy link
Copy Markdown
Member

Description

  • Add sunshine docker image

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 12 times, most recently from 1e44b40 to 9b91da1CompareAugust 11, 2022 23:14
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 5 times, most recently from bd41c84 to 81430bdCompareAugust 12, 2022 00:42
@ReenigneArcherReenigneArcher mentioned this pull request Aug 12, 2022
7 tasks
@ReenigneArcher
ReenigneArcher marked this pull request as ready for review August 12, 2022 02:13
@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

@ABeltramo could you please review this PR when you have time? Most importantly, the Dockerfile and DOCKER_README.md. Let me know if I need to add anything in order for this to be usable for GOW.

@ABeltramo

Copy link
Copy Markdown
Contributor

I encountered a few issues by checking this out on my local machine, I'll present them in order:

Docker build failed

I started by trying to build the image and this error was returned: mkdir unable to create folder /root/sunshine-build/build.
This is because I'm also building via cmake in the same folder so the build/ folder was already present and it'll be COPY-ed over when doing COPY . ..

My suggestion is to add a .dockerignore file with the stuff that shouldn't be copied, ex:

build
.github
tools
docs

This will also avoid invalidating the cache when changing stuff that's not going into the container anyway.

TZ, PUID and PGID aren't mapped

While you specified them as part of possible environment variables they aren't mapped to anything in the dockerfile. Docker doesn't take care of them automagically (unfortunately).

If you set them as ARG like ARG TZ="America/New_York" this can be changed only during build time but once an image has been built they are written in stone.

The correct way is to set them as ENV and then, in order to properly set this stuff up, you'll have to add a bash script on startup that creates the user with the correct PUID, PGID and changes the timezone to what the user passed at runtime.

Running the container doesn't work

After building the docker image I tried to run it but I've got the following error:

unable to start container process: exec: "/usr/bin/sunshine": stat /usr/bin/sunshine: no such file or directory: unknown.

Let's see what's in the docker image then:

docker run -it --rm --name=sunshine --net=host --entrypoint /bin/bash lizardbyte/sunshine:local
ls /usr/bin/sunshine
ls: cannot access '/usr/bin/sunshine': No such file or directory
ls -la /config/
total 8
drwxr-xr-x 2 root root 4096 Aug 12 07:46 .
drwxr-xr-x 1 root root 4096 Aug 12 08:05 ..
ls /sunshine.deb
/sunshine.deb
dpkg-deb -I /sunshine.deb
new Debian package, version 2.0.
size 3170778 bytes: control archive=2586 bytes.
78 bytes, 2 lines conffiles 631 bytes, 12 lines control 4631 bytes, 51 lines md5sums 1232 bytes, 41 lines postinst #!/bin/sh
385 bytes, 9 lines preinst #!/bin/sh
Architecture: amd64
Depends: openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2
Description: Sunshine is a Gamestream host for Moonlight.
Sunshine is a Gamestream host for Moonlight.
Homepage: https://app.lizardbyte.dev
Maintainer: https://github.com/LizardByte
Package: sunshine
Priority: optional
Section: devel
Version: 0.14.1
Installed-Size: 12739
dpkg-deb -c /sunshine.deb
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/bin/
lrwxrwxrwx root/root 0 2022-08-12 07:46 ./etc/bin/sunshine -> sunshine-0.14.1
-rwxr-xr-x root/root 4548680 2022-08-12 07:46 ./etc/bin/sunshine-0.14.1
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/user/
-rw-r--r-- root/root 148 2022-08-12 07:45 ./etc/lib/systemd/user/sunshine.service
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/rules.d/
-rw-r--r-- root/root 75 2022-08-12 07:37 ./etc/lib/udev/rules.d/85-sunshine.rules
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/
-rw-r--r-- root/root 998 2022-08-12 07:37 ./etc/sunshine/assets/box.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/opengl/
-rw-r--r-- root/root 855 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.frag
-rw-r--r-- root/root 620 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.vert
-rw-r--r-- root/root 399 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertY.frag
-rw-r--r-- root/root 181 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.frag
-rw-r--r-- root/root 347 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.vert
-rw-r--r-- root/root 25012 2022-08-12 07:37 ./etc/sunshine/assets/steam.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/
-rw-r--r-- root/root 8177 2022-08-12 07:37 ./etc/sunshine/assets/web/apps.html
-rw-r--r-- root/root 63 2022-08-12 07:37 ./etc/sunshine/assets/web/clients.html
-rw-r--r-- root/root 33037 2022-08-12 07:37 ./etc/sunshine/assets/web/config.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/
-rw-r--r-- root/root 1548 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/LICENSE.txt
-rw-r--r-- root/root 187 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/attribution.js
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/
-rw-r--r-- root/root 59305 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/all.min.css
-rw-r--r-- root/root 675 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/brands.min.css
-rw-r--r-- root/root 57873 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/fontawesome.min.css
-rw-r--r-- root/root 677 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/regular.min.css
-rw-r--r-- root/root 669 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/solid.min.css
-rw-r--r-- root/root 6359 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/svg-with-js.min.css
-rw-r--r-- root/root 26702 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/v4-shims.min.css
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/
-rw-r--r-- root/root 134294 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.eot
-rw-r--r-- root/root 747927 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.svg
-rw-r--r-- root/root 133988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.ttf
-rw-r--r-- root/root 89988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff
-rw-r--r-- root/root 76736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff2
-rw-r--r-- root/root 34034 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.eot
-rw-r--r-- root/root 144714 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.svg
-rw-r--r-- root/root 33736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.ttf
-rw-r--r-- root/root 16276 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff
-rw-r--r-- root/root 13224 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff2
-rw-r--r-- root/root 203030 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.eot
-rw-r--r-- root/root 918991 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.svg
-rw-r--r-- root/root 202744 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.ttf
-rw-r--r-- root/root 101648 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff
-rw-r--r-- root/root 78268 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff2
-rw-r--r-- root/root 452 2022-08-12 07:37 ./etc/sunshine/assets/web/header-no-nav.html
-rw-r--r-- root/root 2762 2022-08-12 07:37 ./etc/sunshine/assets/web/header.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/images/
-rw-r--r-- root/root 120760 2022-08-12 07:37 ./etc/sunshine/assets/web/images/favicon.ico
-rw-r--r-- root/root 2115 2022-08-12 07:37 ./etc/sunshine/assets/web/images/logo-sunshine-45.png
-rw-r--r-- root/root 1546 2022-08-12 07:37 ./etc/sunshine/assets/web/index.html
-rw-r--r-- root/root 3636 2022-08-12 07:37 ./etc/sunshine/assets/web/password.html
-rw-r--r-- root/root 1525 2022-08-12 07:37 ./etc/sunshine/assets/web/pin.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/third_party/
-rw-r--r-- root/root 79665 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.bundle.min.js
-rw-r--r-- root/root 155567 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.min.css
-rw-r--r-- root/root 342147 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/vue.js
-rw-r--r-- root/root 2454 2022-08-12 07:37 ./etc/sunshine/assets/web/troubleshooting.html
-rw-r--r-- root/root 2855 2022-08-12 07:37 ./etc/sunshine/assets/web/welcome.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/config/
-rw-r--r-- root/root 377 2022-08-12 07:37 ./etc/sunshine/config/apps.json
-rw-r--r-- root/root 73 2022-08-12 07:37 ./etc/sunshine/config/sunshine.conf

Found it! It looks like Sunshine is installed at /etc/bin/sunshine. I'm not sure here what's the latest on the cpack you can either change the ENTRYPOINT or change the install path with some cmake variable if you have one.

Let's run it!

I've changed the entrypoint, rebuilt and run:

docker run -it --rm --name=sunshine --net=host lizardbyte/sunshine:local

Nothing happens, no log message, no output. The process is stuck there eating CPU at 100% but worst of all allocating memory like crazy!

Screenshot 2022-08-12 at 09 19 56

(it keeps growing, here at ~6.5GB of RAM used I forcefully killed the container).

I don't know what the issue is but this seems pretty bad.

Final comments

There are a few things missing in this Dockerfile compared to the Dockerfile on GOW most notably:

  • you haven't installed any additional libraries when installing the .deb
  • using --no-install-recommends when installing sunshine.deb might have created an environment that is missing some required library.

Even assuming that the final container is in a good state the instructions in the DOCKER_README aren't really sufficient to run Sunshine. You'll have to pass the Xorg/Wayland socket, PulseAudio/Pipewire, udev, dbus and on top of that, depending on the GPU, you'll have to install the correct drivers, software packages and pass the right options to the docker run command (see the docs on GOW: run on desktop, NVIDIA config.

Some might say this looks like a completely different project and that's probably why you should point people to GOW instead 😉

@ABeltramo

Copy link
Copy Markdown
Contributor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

Revisiting this again. I agree with this idea and my updates to this branch "should" reflect that.

These items from your previous review should be fixed as well.

  • build and several other directories/files added to .dockerignore
  • TZ, PUID and PGID args removed
  • sunshine binary should now be at /usr/bin/sunshine (actually fixed by fix path issues #330 )
  • DOCKER_README.md updated (still probably lacking)

Not real sure about the CPU and ram usage. My only guess would be that Sunshine was continuously crashing and restarting?

@ABeltramo

Copy link
Copy Markdown
Contributor

I have to spend some more time in trying this out with GOW but I have a quick suggestion, first:

TZ, PUID and PGID args removed

This is probably not the best way forward; processes in Docker container shouldn't run as root. I think it would be better to create a default user but also give users the ability to override that at build time (if needed).

Something like:

FROM sunshine-base as sunshine
# copy deb from builderCOPY --from=sunshine-build /root/sunshine-build/build/cpack_artifacts/Sunshine.deb /sunshine.deb
# install sunshineRUN apt-get update -y \
&& apt-get install -y --no-install-recommends /sunshine.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV TZ="Europe/London"ARG UNAME=retro
ENV UNAME=${UNAME}
ARG PUID=1000
ENV PUID=${PUID}
ARG PGID=1000
ENV PGID=${PGID}
RUN groupadd -f -g "${PGID}""${UNAME}"RUN useradd -mk "$(mktemp -d)" -u "${PUID}" -g "${PGID}""${UNAME}"ENV HOME=/home/$UNAME
USER ${UNAME}
# network setupEXPOSE 47984-47990/tcp
EXPOSE 48010
EXPOSE 47998-48000/udp
# setup config directoryRUN mkdir ${HOME}/config
# entrypointENTRYPOINT ["/usr/bin/sunshine", "${HOME}/config/sunshine.conf"]

- add user setup
- simplify `ENTRYPOINT` by creating symbolic link to user's config directory
Co-Authored-By: ABeltramo <beltramo.ale@gmail.com>
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 2 times, most recently from bf7625e to 497e609CompareOctober 27, 2022 03:25
@ReenigneArcher
ReenigneArcher merged commit dcdd716 into nightlyOct 28, 2022
@ReenigneArcher
ReenigneArcher deleted the update/docker branch October 28, 2022 01:51
@ReenigneArcherReenigneArcher mentioned this pull request Oct 28, 2022
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ReenigneArcher@ABeltramo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

update docker - #325

Merged
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker
Oct 28, 2022
Merged

update docker#325
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker

Conversation

@ReenigneArcher

@ReenigneArcherReenigneArcher commented Aug 11, 2022

Copy link
Copy Markdown
Member

Description

  • Add sunshine docker image

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 12 times, most recently from 1e44b40 to 9b91da1CompareAugust 11, 2022 23:14
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 5 times, most recently from bd41c84 to 81430bdCompareAugust 12, 2022 00:42
@ReenigneArcherReenigneArcher mentioned this pull request Aug 12, 2022
7 tasks
@ReenigneArcher
ReenigneArcher marked this pull request as ready for review August 12, 2022 02:13
@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

@ABeltramo could you please review this PR when you have time? Most importantly, the Dockerfile and DOCKER_README.md. Let me know if I need to add anything in order for this to be usable for GOW.

@ABeltramo

Copy link
Copy Markdown
Contributor

I encountered a few issues by checking this out on my local machine, I'll present them in order:

Docker build failed

I started by trying to build the image and this error was returned: mkdir unable to create folder /root/sunshine-build/build.
This is because I'm also building via cmake in the same folder so the build/ folder was already present and it'll be COPY-ed over when doing COPY . ..

My suggestion is to add a .dockerignore file with the stuff that shouldn't be copied, ex:

build
.github
tools
docs

This will also avoid invalidating the cache when changing stuff that's not going into the container anyway.

TZ, PUID and PGID aren't mapped

While you specified them as part of possible environment variables they aren't mapped to anything in the dockerfile. Docker doesn't take care of them automagically (unfortunately).

If you set them as ARG like ARG TZ="America/New_York" this can be changed only during build time but once an image has been built they are written in stone.

The correct way is to set them as ENV and then, in order to properly set this stuff up, you'll have to add a bash script on startup that creates the user with the correct PUID, PGID and changes the timezone to what the user passed at runtime.

Running the container doesn't work

After building the docker image I tried to run it but I've got the following error:

unable to start container process: exec: "/usr/bin/sunshine": stat /usr/bin/sunshine: no such file or directory: unknown.

Let's see what's in the docker image then:

docker run -it --rm --name=sunshine --net=host --entrypoint /bin/bash lizardbyte/sunshine:local
ls /usr/bin/sunshine
ls: cannot access '/usr/bin/sunshine': No such file or directory
ls -la /config/
total 8
drwxr-xr-x 2 root root 4096 Aug 12 07:46 .
drwxr-xr-x 1 root root 4096 Aug 12 08:05 ..
ls /sunshine.deb
/sunshine.deb
dpkg-deb -I /sunshine.deb
new Debian package, version 2.0.
size 3170778 bytes: control archive=2586 bytes.
78 bytes, 2 lines conffiles 631 bytes, 12 lines control 4631 bytes, 51 lines md5sums 1232 bytes, 41 lines postinst #!/bin/sh
385 bytes, 9 lines preinst #!/bin/sh
Architecture: amd64
Depends: openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2
Description: Sunshine is a Gamestream host for Moonlight.
Sunshine is a Gamestream host for Moonlight.
Homepage: https://app.lizardbyte.dev
Maintainer: https://github.com/LizardByte
Package: sunshine
Priority: optional
Section: devel
Version: 0.14.1
Installed-Size: 12739
dpkg-deb -c /sunshine.deb
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/bin/
lrwxrwxrwx root/root 0 2022-08-12 07:46 ./etc/bin/sunshine -> sunshine-0.14.1
-rwxr-xr-x root/root 4548680 2022-08-12 07:46 ./etc/bin/sunshine-0.14.1
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/user/
-rw-r--r-- root/root 148 2022-08-12 07:45 ./etc/lib/systemd/user/sunshine.service
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/rules.d/
-rw-r--r-- root/root 75 2022-08-12 07:37 ./etc/lib/udev/rules.d/85-sunshine.rules
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/
-rw-r--r-- root/root 998 2022-08-12 07:37 ./etc/sunshine/assets/box.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/opengl/
-rw-r--r-- root/root 855 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.frag
-rw-r--r-- root/root 620 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.vert
-rw-r--r-- root/root 399 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertY.frag
-rw-r--r-- root/root 181 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.frag
-rw-r--r-- root/root 347 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.vert
-rw-r--r-- root/root 25012 2022-08-12 07:37 ./etc/sunshine/assets/steam.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/
-rw-r--r-- root/root 8177 2022-08-12 07:37 ./etc/sunshine/assets/web/apps.html
-rw-r--r-- root/root 63 2022-08-12 07:37 ./etc/sunshine/assets/web/clients.html
-rw-r--r-- root/root 33037 2022-08-12 07:37 ./etc/sunshine/assets/web/config.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/
-rw-r--r-- root/root 1548 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/LICENSE.txt
-rw-r--r-- root/root 187 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/attribution.js
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/
-rw-r--r-- root/root 59305 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/all.min.css
-rw-r--r-- root/root 675 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/brands.min.css
-rw-r--r-- root/root 57873 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/fontawesome.min.css
-rw-r--r-- root/root 677 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/regular.min.css
-rw-r--r-- root/root 669 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/solid.min.css
-rw-r--r-- root/root 6359 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/svg-with-js.min.css
-rw-r--r-- root/root 26702 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/v4-shims.min.css
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/
-rw-r--r-- root/root 134294 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.eot
-rw-r--r-- root/root 747927 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.svg
-rw-r--r-- root/root 133988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.ttf
-rw-r--r-- root/root 89988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff
-rw-r--r-- root/root 76736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff2
-rw-r--r-- root/root 34034 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.eot
-rw-r--r-- root/root 144714 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.svg
-rw-r--r-- root/root 33736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.ttf
-rw-r--r-- root/root 16276 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff
-rw-r--r-- root/root 13224 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff2
-rw-r--r-- root/root 203030 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.eot
-rw-r--r-- root/root 918991 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.svg
-rw-r--r-- root/root 202744 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.ttf
-rw-r--r-- root/root 101648 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff
-rw-r--r-- root/root 78268 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff2
-rw-r--r-- root/root 452 2022-08-12 07:37 ./etc/sunshine/assets/web/header-no-nav.html
-rw-r--r-- root/root 2762 2022-08-12 07:37 ./etc/sunshine/assets/web/header.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/images/
-rw-r--r-- root/root 120760 2022-08-12 07:37 ./etc/sunshine/assets/web/images/favicon.ico
-rw-r--r-- root/root 2115 2022-08-12 07:37 ./etc/sunshine/assets/web/images/logo-sunshine-45.png
-rw-r--r-- root/root 1546 2022-08-12 07:37 ./etc/sunshine/assets/web/index.html
-rw-r--r-- root/root 3636 2022-08-12 07:37 ./etc/sunshine/assets/web/password.html
-rw-r--r-- root/root 1525 2022-08-12 07:37 ./etc/sunshine/assets/web/pin.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/third_party/
-rw-r--r-- root/root 79665 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.bundle.min.js
-rw-r--r-- root/root 155567 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.min.css
-rw-r--r-- root/root 342147 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/vue.js
-rw-r--r-- root/root 2454 2022-08-12 07:37 ./etc/sunshine/assets/web/troubleshooting.html
-rw-r--r-- root/root 2855 2022-08-12 07:37 ./etc/sunshine/assets/web/welcome.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/config/
-rw-r--r-- root/root 377 2022-08-12 07:37 ./etc/sunshine/config/apps.json
-rw-r--r-- root/root 73 2022-08-12 07:37 ./etc/sunshine/config/sunshine.conf

Found it! It looks like Sunshine is installed at /etc/bin/sunshine. I'm not sure here what's the latest on the cpack you can either change the ENTRYPOINT or change the install path with some cmake variable if you have one.

Let's run it!

I've changed the entrypoint, rebuilt and run:

docker run -it --rm --name=sunshine --net=host lizardbyte/sunshine:local

Nothing happens, no log message, no output. The process is stuck there eating CPU at 100% but worst of all allocating memory like crazy!

Screenshot 2022-08-12 at 09 19 56

(it keeps growing, here at ~6.5GB of RAM used I forcefully killed the container).

I don't know what the issue is but this seems pretty bad.

Final comments

There are a few things missing in this Dockerfile compared to the Dockerfile on GOW most notably:

  • you haven't installed any additional libraries when installing the .deb
  • using --no-install-recommends when installing sunshine.deb might have created an environment that is missing some required library.

Even assuming that the final container is in a good state the instructions in the DOCKER_README aren't really sufficient to run Sunshine. You'll have to pass the Xorg/Wayland socket, PulseAudio/Pipewire, udev, dbus and on top of that, depending on the GPU, you'll have to install the correct drivers, software packages and pass the right options to the docker run command (see the docs on GOW: run on desktop, NVIDIA config.

Some might say this looks like a completely different project and that's probably why you should point people to GOW instead 😉

@ABeltramo

Copy link
Copy Markdown
Contributor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

Revisiting this again. I agree with this idea and my updates to this branch "should" reflect that.

These items from your previous review should be fixed as well.

  • build and several other directories/files added to .dockerignore
  • TZ, PUID and PGID args removed
  • sunshine binary should now be at /usr/bin/sunshine (actually fixed by fix path issues #330 )
  • DOCKER_README.md updated (still probably lacking)

Not real sure about the CPU and ram usage. My only guess would be that Sunshine was continuously crashing and restarting?

@ABeltramo

Copy link
Copy Markdown
Contributor

I have to spend some more time in trying this out with GOW but I have a quick suggestion, first:

TZ, PUID and PGID args removed

This is probably not the best way forward; processes in Docker container shouldn't run as root. I think it would be better to create a default user but also give users the ability to override that at build time (if needed).

Something like:

FROM sunshine-base as sunshine
# copy deb from builderCOPY --from=sunshine-build /root/sunshine-build/build/cpack_artifacts/Sunshine.deb /sunshine.deb
# install sunshineRUN apt-get update -y \
&& apt-get install -y --no-install-recommends /sunshine.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV TZ="Europe/London"ARG UNAME=retro
ENV UNAME=${UNAME}
ARG PUID=1000
ENV PUID=${PUID}
ARG PGID=1000
ENV PGID=${PGID}
RUN groupadd -f -g "${PGID}""${UNAME}"RUN useradd -mk "$(mktemp -d)" -u "${PUID}" -g "${PGID}""${UNAME}"ENV HOME=/home/$UNAME
USER ${UNAME}
# network setupEXPOSE 47984-47990/tcp
EXPOSE 48010
EXPOSE 47998-48000/udp
# setup config directoryRUN mkdir ${HOME}/config
# entrypointENTRYPOINT ["/usr/bin/sunshine", "${HOME}/config/sunshine.conf"]

- add user setup
- simplify `ENTRYPOINT` by creating symbolic link to user's config directory
Co-Authored-By: ABeltramo <beltramo.ale@gmail.com>
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 2 times, most recently from bf7625e to 497e609CompareOctober 27, 2022 03:25
@ReenigneArcher
ReenigneArcher merged commit dcdd716 into nightlyOct 28, 2022
@ReenigneArcher
ReenigneArcher deleted the update/docker branch October 28, 2022 01:51
@ReenigneArcherReenigneArcher mentioned this pull request Oct 28, 2022
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ReenigneArcher@ABeltramo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

update docker - #325

Merged
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker
Oct 28, 2022
Merged

update docker#325
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker

Conversation

@ReenigneArcher

@ReenigneArcherReenigneArcher commented Aug 11, 2022

Copy link
Copy Markdown
Member

Description

  • Add sunshine docker image

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 12 times, most recently from 1e44b40 to 9b91da1CompareAugust 11, 2022 23:14
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 5 times, most recently from bd41c84 to 81430bdCompareAugust 12, 2022 00:42
@ReenigneArcherReenigneArcher mentioned this pull request Aug 12, 2022
7 tasks
@ReenigneArcher
ReenigneArcher marked this pull request as ready for review August 12, 2022 02:13
@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

@ABeltramo could you please review this PR when you have time? Most importantly, the Dockerfile and DOCKER_README.md. Let me know if I need to add anything in order for this to be usable for GOW.

@ABeltramo

Copy link
Copy Markdown
Contributor

I encountered a few issues by checking this out on my local machine, I'll present them in order:

Docker build failed

I started by trying to build the image and this error was returned: mkdir unable to create folder /root/sunshine-build/build.
This is because I'm also building via cmake in the same folder so the build/ folder was already present and it'll be COPY-ed over when doing COPY . ..

My suggestion is to add a .dockerignore file with the stuff that shouldn't be copied, ex:

build
.github
tools
docs

This will also avoid invalidating the cache when changing stuff that's not going into the container anyway.

TZ, PUID and PGID aren't mapped

While you specified them as part of possible environment variables they aren't mapped to anything in the dockerfile. Docker doesn't take care of them automagically (unfortunately).

If you set them as ARG like ARG TZ="America/New_York" this can be changed only during build time but once an image has been built they are written in stone.

The correct way is to set them as ENV and then, in order to properly set this stuff up, you'll have to add a bash script on startup that creates the user with the correct PUID, PGID and changes the timezone to what the user passed at runtime.

Running the container doesn't work

After building the docker image I tried to run it but I've got the following error:

unable to start container process: exec: "/usr/bin/sunshine": stat /usr/bin/sunshine: no such file or directory: unknown.

Let's see what's in the docker image then:

docker run -it --rm --name=sunshine --net=host --entrypoint /bin/bash lizardbyte/sunshine:local
ls /usr/bin/sunshine
ls: cannot access '/usr/bin/sunshine': No such file or directory
ls -la /config/
total 8
drwxr-xr-x 2 root root 4096 Aug 12 07:46 .
drwxr-xr-x 1 root root 4096 Aug 12 08:05 ..
ls /sunshine.deb
/sunshine.deb
dpkg-deb -I /sunshine.deb
new Debian package, version 2.0.
size 3170778 bytes: control archive=2586 bytes.
78 bytes, 2 lines conffiles 631 bytes, 12 lines control 4631 bytes, 51 lines md5sums 1232 bytes, 41 lines postinst #!/bin/sh
385 bytes, 9 lines preinst #!/bin/sh
Architecture: amd64
Depends: openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2
Description: Sunshine is a Gamestream host for Moonlight.
Sunshine is a Gamestream host for Moonlight.
Homepage: https://app.lizardbyte.dev
Maintainer: https://github.com/LizardByte
Package: sunshine
Priority: optional
Section: devel
Version: 0.14.1
Installed-Size: 12739
dpkg-deb -c /sunshine.deb
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/bin/
lrwxrwxrwx root/root 0 2022-08-12 07:46 ./etc/bin/sunshine -> sunshine-0.14.1
-rwxr-xr-x root/root 4548680 2022-08-12 07:46 ./etc/bin/sunshine-0.14.1
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/user/
-rw-r--r-- root/root 148 2022-08-12 07:45 ./etc/lib/systemd/user/sunshine.service
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/rules.d/
-rw-r--r-- root/root 75 2022-08-12 07:37 ./etc/lib/udev/rules.d/85-sunshine.rules
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/
-rw-r--r-- root/root 998 2022-08-12 07:37 ./etc/sunshine/assets/box.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/opengl/
-rw-r--r-- root/root 855 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.frag
-rw-r--r-- root/root 620 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.vert
-rw-r--r-- root/root 399 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertY.frag
-rw-r--r-- root/root 181 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.frag
-rw-r--r-- root/root 347 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.vert
-rw-r--r-- root/root 25012 2022-08-12 07:37 ./etc/sunshine/assets/steam.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/
-rw-r--r-- root/root 8177 2022-08-12 07:37 ./etc/sunshine/assets/web/apps.html
-rw-r--r-- root/root 63 2022-08-12 07:37 ./etc/sunshine/assets/web/clients.html
-rw-r--r-- root/root 33037 2022-08-12 07:37 ./etc/sunshine/assets/web/config.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/
-rw-r--r-- root/root 1548 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/LICENSE.txt
-rw-r--r-- root/root 187 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/attribution.js
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/
-rw-r--r-- root/root 59305 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/all.min.css
-rw-r--r-- root/root 675 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/brands.min.css
-rw-r--r-- root/root 57873 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/fontawesome.min.css
-rw-r--r-- root/root 677 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/regular.min.css
-rw-r--r-- root/root 669 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/solid.min.css
-rw-r--r-- root/root 6359 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/svg-with-js.min.css
-rw-r--r-- root/root 26702 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/v4-shims.min.css
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/
-rw-r--r-- root/root 134294 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.eot
-rw-r--r-- root/root 747927 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.svg
-rw-r--r-- root/root 133988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.ttf
-rw-r--r-- root/root 89988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff
-rw-r--r-- root/root 76736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff2
-rw-r--r-- root/root 34034 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.eot
-rw-r--r-- root/root 144714 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.svg
-rw-r--r-- root/root 33736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.ttf
-rw-r--r-- root/root 16276 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff
-rw-r--r-- root/root 13224 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff2
-rw-r--r-- root/root 203030 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.eot
-rw-r--r-- root/root 918991 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.svg
-rw-r--r-- root/root 202744 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.ttf
-rw-r--r-- root/root 101648 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff
-rw-r--r-- root/root 78268 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff2
-rw-r--r-- root/root 452 2022-08-12 07:37 ./etc/sunshine/assets/web/header-no-nav.html
-rw-r--r-- root/root 2762 2022-08-12 07:37 ./etc/sunshine/assets/web/header.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/images/
-rw-r--r-- root/root 120760 2022-08-12 07:37 ./etc/sunshine/assets/web/images/favicon.ico
-rw-r--r-- root/root 2115 2022-08-12 07:37 ./etc/sunshine/assets/web/images/logo-sunshine-45.png
-rw-r--r-- root/root 1546 2022-08-12 07:37 ./etc/sunshine/assets/web/index.html
-rw-r--r-- root/root 3636 2022-08-12 07:37 ./etc/sunshine/assets/web/password.html
-rw-r--r-- root/root 1525 2022-08-12 07:37 ./etc/sunshine/assets/web/pin.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/third_party/
-rw-r--r-- root/root 79665 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.bundle.min.js
-rw-r--r-- root/root 155567 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.min.css
-rw-r--r-- root/root 342147 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/vue.js
-rw-r--r-- root/root 2454 2022-08-12 07:37 ./etc/sunshine/assets/web/troubleshooting.html
-rw-r--r-- root/root 2855 2022-08-12 07:37 ./etc/sunshine/assets/web/welcome.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/config/
-rw-r--r-- root/root 377 2022-08-12 07:37 ./etc/sunshine/config/apps.json
-rw-r--r-- root/root 73 2022-08-12 07:37 ./etc/sunshine/config/sunshine.conf

Found it! It looks like Sunshine is installed at /etc/bin/sunshine. I'm not sure here what's the latest on the cpack you can either change the ENTRYPOINT or change the install path with some cmake variable if you have one.

Let's run it!

I've changed the entrypoint, rebuilt and run:

docker run -it --rm --name=sunshine --net=host lizardbyte/sunshine:local

Nothing happens, no log message, no output. The process is stuck there eating CPU at 100% but worst of all allocating memory like crazy!

Screenshot 2022-08-12 at 09 19 56

(it keeps growing, here at ~6.5GB of RAM used I forcefully killed the container).

I don't know what the issue is but this seems pretty bad.

Final comments

There are a few things missing in this Dockerfile compared to the Dockerfile on GOW most notably:

  • you haven't installed any additional libraries when installing the .deb
  • using --no-install-recommends when installing sunshine.deb might have created an environment that is missing some required library.

Even assuming that the final container is in a good state the instructions in the DOCKER_README aren't really sufficient to run Sunshine. You'll have to pass the Xorg/Wayland socket, PulseAudio/Pipewire, udev, dbus and on top of that, depending on the GPU, you'll have to install the correct drivers, software packages and pass the right options to the docker run command (see the docs on GOW: run on desktop, NVIDIA config.

Some might say this looks like a completely different project and that's probably why you should point people to GOW instead 😉

@ABeltramo

Copy link
Copy Markdown
Contributor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

Revisiting this again. I agree with this idea and my updates to this branch "should" reflect that.

These items from your previous review should be fixed as well.

  • build and several other directories/files added to .dockerignore
  • TZ, PUID and PGID args removed
  • sunshine binary should now be at /usr/bin/sunshine (actually fixed by fix path issues #330 )
  • DOCKER_README.md updated (still probably lacking)

Not real sure about the CPU and ram usage. My only guess would be that Sunshine was continuously crashing and restarting?

@ABeltramo

Copy link
Copy Markdown
Contributor

I have to spend some more time in trying this out with GOW but I have a quick suggestion, first:

TZ, PUID and PGID args removed

This is probably not the best way forward; processes in Docker container shouldn't run as root. I think it would be better to create a default user but also give users the ability to override that at build time (if needed).

Something like:

FROM sunshine-base as sunshine
# copy deb from builderCOPY --from=sunshine-build /root/sunshine-build/build/cpack_artifacts/Sunshine.deb /sunshine.deb
# install sunshineRUN apt-get update -y \
&& apt-get install -y --no-install-recommends /sunshine.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV TZ="Europe/London"ARG UNAME=retro
ENV UNAME=${UNAME}
ARG PUID=1000
ENV PUID=${PUID}
ARG PGID=1000
ENV PGID=${PGID}
RUN groupadd -f -g "${PGID}""${UNAME}"RUN useradd -mk "$(mktemp -d)" -u "${PUID}" -g "${PGID}""${UNAME}"ENV HOME=/home/$UNAME
USER ${UNAME}
# network setupEXPOSE 47984-47990/tcp
EXPOSE 48010
EXPOSE 47998-48000/udp
# setup config directoryRUN mkdir ${HOME}/config
# entrypointENTRYPOINT ["/usr/bin/sunshine", "${HOME}/config/sunshine.conf"]

- add user setup
- simplify `ENTRYPOINT` by creating symbolic link to user's config directory
Co-Authored-By: ABeltramo <beltramo.ale@gmail.com>
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 2 times, most recently from bf7625e to 497e609CompareOctober 27, 2022 03:25
@ReenigneArcher
ReenigneArcher merged commit dcdd716 into nightlyOct 28, 2022
@ReenigneArcher
ReenigneArcher deleted the update/docker branch October 28, 2022 01:51
@ReenigneArcherReenigneArcher mentioned this pull request Oct 28, 2022
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ReenigneArcher@ABeltramo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

update docker - #325

Merged
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker
Oct 28, 2022
Merged

update docker#325
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker

Conversation

@ReenigneArcher

@ReenigneArcherReenigneArcher commented Aug 11, 2022

Copy link
Copy Markdown
Member

Description

  • Add sunshine docker image

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 12 times, most recently from 1e44b40 to 9b91da1CompareAugust 11, 2022 23:14
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 5 times, most recently from bd41c84 to 81430bdCompareAugust 12, 2022 00:42
@ReenigneArcherReenigneArcher mentioned this pull request Aug 12, 2022
7 tasks
@ReenigneArcher
ReenigneArcher marked this pull request as ready for review August 12, 2022 02:13
@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

@ABeltramo could you please review this PR when you have time? Most importantly, the Dockerfile and DOCKER_README.md. Let me know if I need to add anything in order for this to be usable for GOW.

@ABeltramo

Copy link
Copy Markdown
Contributor

I encountered a few issues by checking this out on my local machine, I'll present them in order:

Docker build failed

I started by trying to build the image and this error was returned: mkdir unable to create folder /root/sunshine-build/build.
This is because I'm also building via cmake in the same folder so the build/ folder was already present and it'll be COPY-ed over when doing COPY . ..

My suggestion is to add a .dockerignore file with the stuff that shouldn't be copied, ex:

build
.github
tools
docs

This will also avoid invalidating the cache when changing stuff that's not going into the container anyway.

TZ, PUID and PGID aren't mapped

While you specified them as part of possible environment variables they aren't mapped to anything in the dockerfile. Docker doesn't take care of them automagically (unfortunately).

If you set them as ARG like ARG TZ="America/New_York" this can be changed only during build time but once an image has been built they are written in stone.

The correct way is to set them as ENV and then, in order to properly set this stuff up, you'll have to add a bash script on startup that creates the user with the correct PUID, PGID and changes the timezone to what the user passed at runtime.

Running the container doesn't work

After building the docker image I tried to run it but I've got the following error:

unable to start container process: exec: "/usr/bin/sunshine": stat /usr/bin/sunshine: no such file or directory: unknown.

Let's see what's in the docker image then:

docker run -it --rm --name=sunshine --net=host --entrypoint /bin/bash lizardbyte/sunshine:local
ls /usr/bin/sunshine
ls: cannot access '/usr/bin/sunshine': No such file or directory
ls -la /config/
total 8
drwxr-xr-x 2 root root 4096 Aug 12 07:46 .
drwxr-xr-x 1 root root 4096 Aug 12 08:05 ..
ls /sunshine.deb
/sunshine.deb
dpkg-deb -I /sunshine.deb
new Debian package, version 2.0.
size 3170778 bytes: control archive=2586 bytes.
78 bytes, 2 lines conffiles 631 bytes, 12 lines control 4631 bytes, 51 lines md5sums 1232 bytes, 41 lines postinst #!/bin/sh
385 bytes, 9 lines preinst #!/bin/sh
Architecture: amd64
Depends: openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2
Description: Sunshine is a Gamestream host for Moonlight.
Sunshine is a Gamestream host for Moonlight.
Homepage: https://app.lizardbyte.dev
Maintainer: https://github.com/LizardByte
Package: sunshine
Priority: optional
Section: devel
Version: 0.14.1
Installed-Size: 12739
dpkg-deb -c /sunshine.deb
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/bin/
lrwxrwxrwx root/root 0 2022-08-12 07:46 ./etc/bin/sunshine -> sunshine-0.14.1
-rwxr-xr-x root/root 4548680 2022-08-12 07:46 ./etc/bin/sunshine-0.14.1
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/user/
-rw-r--r-- root/root 148 2022-08-12 07:45 ./etc/lib/systemd/user/sunshine.service
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/rules.d/
-rw-r--r-- root/root 75 2022-08-12 07:37 ./etc/lib/udev/rules.d/85-sunshine.rules
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/
-rw-r--r-- root/root 998 2022-08-12 07:37 ./etc/sunshine/assets/box.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/opengl/
-rw-r--r-- root/root 855 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.frag
-rw-r--r-- root/root 620 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.vert
-rw-r--r-- root/root 399 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertY.frag
-rw-r--r-- root/root 181 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.frag
-rw-r--r-- root/root 347 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.vert
-rw-r--r-- root/root 25012 2022-08-12 07:37 ./etc/sunshine/assets/steam.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/
-rw-r--r-- root/root 8177 2022-08-12 07:37 ./etc/sunshine/assets/web/apps.html
-rw-r--r-- root/root 63 2022-08-12 07:37 ./etc/sunshine/assets/web/clients.html
-rw-r--r-- root/root 33037 2022-08-12 07:37 ./etc/sunshine/assets/web/config.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/
-rw-r--r-- root/root 1548 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/LICENSE.txt
-rw-r--r-- root/root 187 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/attribution.js
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/
-rw-r--r-- root/root 59305 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/all.min.css
-rw-r--r-- root/root 675 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/brands.min.css
-rw-r--r-- root/root 57873 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/fontawesome.min.css
-rw-r--r-- root/root 677 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/regular.min.css
-rw-r--r-- root/root 669 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/solid.min.css
-rw-r--r-- root/root 6359 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/svg-with-js.min.css
-rw-r--r-- root/root 26702 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/v4-shims.min.css
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/
-rw-r--r-- root/root 134294 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.eot
-rw-r--r-- root/root 747927 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.svg
-rw-r--r-- root/root 133988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.ttf
-rw-r--r-- root/root 89988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff
-rw-r--r-- root/root 76736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff2
-rw-r--r-- root/root 34034 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.eot
-rw-r--r-- root/root 144714 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.svg
-rw-r--r-- root/root 33736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.ttf
-rw-r--r-- root/root 16276 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff
-rw-r--r-- root/root 13224 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff2
-rw-r--r-- root/root 203030 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.eot
-rw-r--r-- root/root 918991 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.svg
-rw-r--r-- root/root 202744 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.ttf
-rw-r--r-- root/root 101648 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff
-rw-r--r-- root/root 78268 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff2
-rw-r--r-- root/root 452 2022-08-12 07:37 ./etc/sunshine/assets/web/header-no-nav.html
-rw-r--r-- root/root 2762 2022-08-12 07:37 ./etc/sunshine/assets/web/header.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/images/
-rw-r--r-- root/root 120760 2022-08-12 07:37 ./etc/sunshine/assets/web/images/favicon.ico
-rw-r--r-- root/root 2115 2022-08-12 07:37 ./etc/sunshine/assets/web/images/logo-sunshine-45.png
-rw-r--r-- root/root 1546 2022-08-12 07:37 ./etc/sunshine/assets/web/index.html
-rw-r--r-- root/root 3636 2022-08-12 07:37 ./etc/sunshine/assets/web/password.html
-rw-r--r-- root/root 1525 2022-08-12 07:37 ./etc/sunshine/assets/web/pin.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/third_party/
-rw-r--r-- root/root 79665 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.bundle.min.js
-rw-r--r-- root/root 155567 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.min.css
-rw-r--r-- root/root 342147 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/vue.js
-rw-r--r-- root/root 2454 2022-08-12 07:37 ./etc/sunshine/assets/web/troubleshooting.html
-rw-r--r-- root/root 2855 2022-08-12 07:37 ./etc/sunshine/assets/web/welcome.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/config/
-rw-r--r-- root/root 377 2022-08-12 07:37 ./etc/sunshine/config/apps.json
-rw-r--r-- root/root 73 2022-08-12 07:37 ./etc/sunshine/config/sunshine.conf

Found it! It looks like Sunshine is installed at /etc/bin/sunshine. I'm not sure here what's the latest on the cpack you can either change the ENTRYPOINT or change the install path with some cmake variable if you have one.

Let's run it!

I've changed the entrypoint, rebuilt and run:

docker run -it --rm --name=sunshine --net=host lizardbyte/sunshine:local

Nothing happens, no log message, no output. The process is stuck there eating CPU at 100% but worst of all allocating memory like crazy!

Screenshot 2022-08-12 at 09 19 56

(it keeps growing, here at ~6.5GB of RAM used I forcefully killed the container).

I don't know what the issue is but this seems pretty bad.

Final comments

There are a few things missing in this Dockerfile compared to the Dockerfile on GOW most notably:

  • you haven't installed any additional libraries when installing the .deb
  • using --no-install-recommends when installing sunshine.deb might have created an environment that is missing some required library.

Even assuming that the final container is in a good state the instructions in the DOCKER_README aren't really sufficient to run Sunshine. You'll have to pass the Xorg/Wayland socket, PulseAudio/Pipewire, udev, dbus and on top of that, depending on the GPU, you'll have to install the correct drivers, software packages and pass the right options to the docker run command (see the docs on GOW: run on desktop, NVIDIA config.

Some might say this looks like a completely different project and that's probably why you should point people to GOW instead 😉

@ABeltramo

Copy link
Copy Markdown
Contributor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

Revisiting this again. I agree with this idea and my updates to this branch "should" reflect that.

These items from your previous review should be fixed as well.

  • build and several other directories/files added to .dockerignore
  • TZ, PUID and PGID args removed
  • sunshine binary should now be at /usr/bin/sunshine (actually fixed by fix path issues #330 )
  • DOCKER_README.md updated (still probably lacking)

Not real sure about the CPU and ram usage. My only guess would be that Sunshine was continuously crashing and restarting?

@ABeltramo

Copy link
Copy Markdown
Contributor

I have to spend some more time in trying this out with GOW but I have a quick suggestion, first:

TZ, PUID and PGID args removed

This is probably not the best way forward; processes in Docker container shouldn't run as root. I think it would be better to create a default user but also give users the ability to override that at build time (if needed).

Something like:

FROM sunshine-base as sunshine
# copy deb from builderCOPY --from=sunshine-build /root/sunshine-build/build/cpack_artifacts/Sunshine.deb /sunshine.deb
# install sunshineRUN apt-get update -y \
&& apt-get install -y --no-install-recommends /sunshine.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV TZ="Europe/London"ARG UNAME=retro
ENV UNAME=${UNAME}
ARG PUID=1000
ENV PUID=${PUID}
ARG PGID=1000
ENV PGID=${PGID}
RUN groupadd -f -g "${PGID}""${UNAME}"RUN useradd -mk "$(mktemp -d)" -u "${PUID}" -g "${PGID}""${UNAME}"ENV HOME=/home/$UNAME
USER ${UNAME}
# network setupEXPOSE 47984-47990/tcp
EXPOSE 48010
EXPOSE 47998-48000/udp
# setup config directoryRUN mkdir ${HOME}/config
# entrypointENTRYPOINT ["/usr/bin/sunshine", "${HOME}/config/sunshine.conf"]

- add user setup
- simplify `ENTRYPOINT` by creating symbolic link to user's config directory
Co-Authored-By: ABeltramo <beltramo.ale@gmail.com>
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 2 times, most recently from bf7625e to 497e609CompareOctober 27, 2022 03:25
@ReenigneArcher
ReenigneArcher merged commit dcdd716 into nightlyOct 28, 2022
@ReenigneArcher
ReenigneArcher deleted the update/docker branch October 28, 2022 01:51
@ReenigneArcherReenigneArcher mentioned this pull request Oct 28, 2022
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ReenigneArcher@ABeltramo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

update docker - #325

Merged
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker
Oct 28, 2022
Merged

update docker#325
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker

Conversation

@ReenigneArcher

@ReenigneArcherReenigneArcher commented Aug 11, 2022

Copy link
Copy Markdown
Member

Description

  • Add sunshine docker image

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 12 times, most recently from 1e44b40 to 9b91da1CompareAugust 11, 2022 23:14
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 5 times, most recently from bd41c84 to 81430bdCompareAugust 12, 2022 00:42
@ReenigneArcherReenigneArcher mentioned this pull request Aug 12, 2022
7 tasks
@ReenigneArcher
ReenigneArcher marked this pull request as ready for review August 12, 2022 02:13
@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

@ABeltramo could you please review this PR when you have time? Most importantly, the Dockerfile and DOCKER_README.md. Let me know if I need to add anything in order for this to be usable for GOW.

@ABeltramo

Copy link
Copy Markdown
Contributor

I encountered a few issues by checking this out on my local machine, I'll present them in order:

Docker build failed

I started by trying to build the image and this error was returned: mkdir unable to create folder /root/sunshine-build/build.
This is because I'm also building via cmake in the same folder so the build/ folder was already present and it'll be COPY-ed over when doing COPY . ..

My suggestion is to add a .dockerignore file with the stuff that shouldn't be copied, ex:

build
.github
tools
docs

This will also avoid invalidating the cache when changing stuff that's not going into the container anyway.

TZ, PUID and PGID aren't mapped

While you specified them as part of possible environment variables they aren't mapped to anything in the dockerfile. Docker doesn't take care of them automagically (unfortunately).

If you set them as ARG like ARG TZ="America/New_York" this can be changed only during build time but once an image has been built they are written in stone.

The correct way is to set them as ENV and then, in order to properly set this stuff up, you'll have to add a bash script on startup that creates the user with the correct PUID, PGID and changes the timezone to what the user passed at runtime.

Running the container doesn't work

After building the docker image I tried to run it but I've got the following error:

unable to start container process: exec: "/usr/bin/sunshine": stat /usr/bin/sunshine: no such file or directory: unknown.

Let's see what's in the docker image then:

docker run -it --rm --name=sunshine --net=host --entrypoint /bin/bash lizardbyte/sunshine:local
ls /usr/bin/sunshine
ls: cannot access '/usr/bin/sunshine': No such file or directory
ls -la /config/
total 8
drwxr-xr-x 2 root root 4096 Aug 12 07:46 .
drwxr-xr-x 1 root root 4096 Aug 12 08:05 ..
ls /sunshine.deb
/sunshine.deb
dpkg-deb -I /sunshine.deb
new Debian package, version 2.0.
size 3170778 bytes: control archive=2586 bytes.
78 bytes, 2 lines conffiles 631 bytes, 12 lines control 4631 bytes, 51 lines md5sums 1232 bytes, 41 lines postinst #!/bin/sh
385 bytes, 9 lines preinst #!/bin/sh
Architecture: amd64
Depends: openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2
Description: Sunshine is a Gamestream host for Moonlight.
Sunshine is a Gamestream host for Moonlight.
Homepage: https://app.lizardbyte.dev
Maintainer: https://github.com/LizardByte
Package: sunshine
Priority: optional
Section: devel
Version: 0.14.1
Installed-Size: 12739
dpkg-deb -c /sunshine.deb
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/bin/
lrwxrwxrwx root/root 0 2022-08-12 07:46 ./etc/bin/sunshine -> sunshine-0.14.1
-rwxr-xr-x root/root 4548680 2022-08-12 07:46 ./etc/bin/sunshine-0.14.1
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/user/
-rw-r--r-- root/root 148 2022-08-12 07:45 ./etc/lib/systemd/user/sunshine.service
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/rules.d/
-rw-r--r-- root/root 75 2022-08-12 07:37 ./etc/lib/udev/rules.d/85-sunshine.rules
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/
-rw-r--r-- root/root 998 2022-08-12 07:37 ./etc/sunshine/assets/box.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/opengl/
-rw-r--r-- root/root 855 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.frag
-rw-r--r-- root/root 620 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.vert
-rw-r--r-- root/root 399 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertY.frag
-rw-r--r-- root/root 181 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.frag
-rw-r--r-- root/root 347 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.vert
-rw-r--r-- root/root 25012 2022-08-12 07:37 ./etc/sunshine/assets/steam.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/
-rw-r--r-- root/root 8177 2022-08-12 07:37 ./etc/sunshine/assets/web/apps.html
-rw-r--r-- root/root 63 2022-08-12 07:37 ./etc/sunshine/assets/web/clients.html
-rw-r--r-- root/root 33037 2022-08-12 07:37 ./etc/sunshine/assets/web/config.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/
-rw-r--r-- root/root 1548 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/LICENSE.txt
-rw-r--r-- root/root 187 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/attribution.js
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/
-rw-r--r-- root/root 59305 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/all.min.css
-rw-r--r-- root/root 675 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/brands.min.css
-rw-r--r-- root/root 57873 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/fontawesome.min.css
-rw-r--r-- root/root 677 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/regular.min.css
-rw-r--r-- root/root 669 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/solid.min.css
-rw-r--r-- root/root 6359 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/svg-with-js.min.css
-rw-r--r-- root/root 26702 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/v4-shims.min.css
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/
-rw-r--r-- root/root 134294 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.eot
-rw-r--r-- root/root 747927 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.svg
-rw-r--r-- root/root 133988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.ttf
-rw-r--r-- root/root 89988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff
-rw-r--r-- root/root 76736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff2
-rw-r--r-- root/root 34034 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.eot
-rw-r--r-- root/root 144714 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.svg
-rw-r--r-- root/root 33736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.ttf
-rw-r--r-- root/root 16276 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff
-rw-r--r-- root/root 13224 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff2
-rw-r--r-- root/root 203030 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.eot
-rw-r--r-- root/root 918991 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.svg
-rw-r--r-- root/root 202744 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.ttf
-rw-r--r-- root/root 101648 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff
-rw-r--r-- root/root 78268 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff2
-rw-r--r-- root/root 452 2022-08-12 07:37 ./etc/sunshine/assets/web/header-no-nav.html
-rw-r--r-- root/root 2762 2022-08-12 07:37 ./etc/sunshine/assets/web/header.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/images/
-rw-r--r-- root/root 120760 2022-08-12 07:37 ./etc/sunshine/assets/web/images/favicon.ico
-rw-r--r-- root/root 2115 2022-08-12 07:37 ./etc/sunshine/assets/web/images/logo-sunshine-45.png
-rw-r--r-- root/root 1546 2022-08-12 07:37 ./etc/sunshine/assets/web/index.html
-rw-r--r-- root/root 3636 2022-08-12 07:37 ./etc/sunshine/assets/web/password.html
-rw-r--r-- root/root 1525 2022-08-12 07:37 ./etc/sunshine/assets/web/pin.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/third_party/
-rw-r--r-- root/root 79665 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.bundle.min.js
-rw-r--r-- root/root 155567 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.min.css
-rw-r--r-- root/root 342147 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/vue.js
-rw-r--r-- root/root 2454 2022-08-12 07:37 ./etc/sunshine/assets/web/troubleshooting.html
-rw-r--r-- root/root 2855 2022-08-12 07:37 ./etc/sunshine/assets/web/welcome.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/config/
-rw-r--r-- root/root 377 2022-08-12 07:37 ./etc/sunshine/config/apps.json
-rw-r--r-- root/root 73 2022-08-12 07:37 ./etc/sunshine/config/sunshine.conf

Found it! It looks like Sunshine is installed at /etc/bin/sunshine. I'm not sure here what's the latest on the cpack you can either change the ENTRYPOINT or change the install path with some cmake variable if you have one.

Let's run it!

I've changed the entrypoint, rebuilt and run:

docker run -it --rm --name=sunshine --net=host lizardbyte/sunshine:local

Nothing happens, no log message, no output. The process is stuck there eating CPU at 100% but worst of all allocating memory like crazy!

Screenshot 2022-08-12 at 09 19 56

(it keeps growing, here at ~6.5GB of RAM used I forcefully killed the container).

I don't know what the issue is but this seems pretty bad.

Final comments

There are a few things missing in this Dockerfile compared to the Dockerfile on GOW most notably:

  • you haven't installed any additional libraries when installing the .deb
  • using --no-install-recommends when installing sunshine.deb might have created an environment that is missing some required library.

Even assuming that the final container is in a good state the instructions in the DOCKER_README aren't really sufficient to run Sunshine. You'll have to pass the Xorg/Wayland socket, PulseAudio/Pipewire, udev, dbus and on top of that, depending on the GPU, you'll have to install the correct drivers, software packages and pass the right options to the docker run command (see the docs on GOW: run on desktop, NVIDIA config.

Some might say this looks like a completely different project and that's probably why you should point people to GOW instead 😉

@ABeltramo

Copy link
Copy Markdown
Contributor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

Revisiting this again. I agree with this idea and my updates to this branch "should" reflect that.

These items from your previous review should be fixed as well.

  • build and several other directories/files added to .dockerignore
  • TZ, PUID and PGID args removed
  • sunshine binary should now be at /usr/bin/sunshine (actually fixed by fix path issues #330 )
  • DOCKER_README.md updated (still probably lacking)

Not real sure about the CPU and ram usage. My only guess would be that Sunshine was continuously crashing and restarting?

@ABeltramo

Copy link
Copy Markdown
Contributor

I have to spend some more time in trying this out with GOW but I have a quick suggestion, first:

TZ, PUID and PGID args removed

This is probably not the best way forward; processes in Docker container shouldn't run as root. I think it would be better to create a default user but also give users the ability to override that at build time (if needed).

Something like:

FROM sunshine-base as sunshine
# copy deb from builderCOPY --from=sunshine-build /root/sunshine-build/build/cpack_artifacts/Sunshine.deb /sunshine.deb
# install sunshineRUN apt-get update -y \
&& apt-get install -y --no-install-recommends /sunshine.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV TZ="Europe/London"ARG UNAME=retro
ENV UNAME=${UNAME}
ARG PUID=1000
ENV PUID=${PUID}
ARG PGID=1000
ENV PGID=${PGID}
RUN groupadd -f -g "${PGID}""${UNAME}"RUN useradd -mk "$(mktemp -d)" -u "${PUID}" -g "${PGID}""${UNAME}"ENV HOME=/home/$UNAME
USER ${UNAME}
# network setupEXPOSE 47984-47990/tcp
EXPOSE 48010
EXPOSE 47998-48000/udp
# setup config directoryRUN mkdir ${HOME}/config
# entrypointENTRYPOINT ["/usr/bin/sunshine", "${HOME}/config/sunshine.conf"]

- add user setup
- simplify `ENTRYPOINT` by creating symbolic link to user's config directory
Co-Authored-By: ABeltramo <beltramo.ale@gmail.com>
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 2 times, most recently from bf7625e to 497e609CompareOctober 27, 2022 03:25
@ReenigneArcher
ReenigneArcher merged commit dcdd716 into nightlyOct 28, 2022
@ReenigneArcher
ReenigneArcher deleted the update/docker branch October 28, 2022 01:51
@ReenigneArcherReenigneArcher mentioned this pull request Oct 28, 2022
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ReenigneArcher@ABeltramo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

update docker - #325

Merged
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker
Oct 28, 2022
Merged

update docker#325
ReenigneArcher merged 9 commits into
nightlyfrom
update/docker

Conversation

@ReenigneArcher

@ReenigneArcherReenigneArcher commented Aug 11, 2022

Copy link
Copy Markdown
Member

Description

  • Add sunshine docker image

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 12 times, most recently from 1e44b40 to 9b91da1CompareAugust 11, 2022 23:14
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 5 times, most recently from bd41c84 to 81430bdCompareAugust 12, 2022 00:42
@ReenigneArcherReenigneArcher mentioned this pull request Aug 12, 2022
7 tasks
@ReenigneArcher
ReenigneArcher marked this pull request as ready for review August 12, 2022 02:13
@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

@ABeltramo could you please review this PR when you have time? Most importantly, the Dockerfile and DOCKER_README.md. Let me know if I need to add anything in order for this to be usable for GOW.

@ABeltramo

Copy link
Copy Markdown
Contributor

I encountered a few issues by checking this out on my local machine, I'll present them in order:

Docker build failed

I started by trying to build the image and this error was returned: mkdir unable to create folder /root/sunshine-build/build.
This is because I'm also building via cmake in the same folder so the build/ folder was already present and it'll be COPY-ed over when doing COPY . ..

My suggestion is to add a .dockerignore file with the stuff that shouldn't be copied, ex:

build
.github
tools
docs

This will also avoid invalidating the cache when changing stuff that's not going into the container anyway.

TZ, PUID and PGID aren't mapped

While you specified them as part of possible environment variables they aren't mapped to anything in the dockerfile. Docker doesn't take care of them automagically (unfortunately).

If you set them as ARG like ARG TZ="America/New_York" this can be changed only during build time but once an image has been built they are written in stone.

The correct way is to set them as ENV and then, in order to properly set this stuff up, you'll have to add a bash script on startup that creates the user with the correct PUID, PGID and changes the timezone to what the user passed at runtime.

Running the container doesn't work

After building the docker image I tried to run it but I've got the following error:

unable to start container process: exec: "/usr/bin/sunshine": stat /usr/bin/sunshine: no such file or directory: unknown.

Let's see what's in the docker image then:

docker run -it --rm --name=sunshine --net=host --entrypoint /bin/bash lizardbyte/sunshine:local
ls /usr/bin/sunshine
ls: cannot access '/usr/bin/sunshine': No such file or directory
ls -la /config/
total 8
drwxr-xr-x 2 root root 4096 Aug 12 07:46 .
drwxr-xr-x 1 root root 4096 Aug 12 08:05 ..
ls /sunshine.deb
/sunshine.deb
dpkg-deb -I /sunshine.deb
new Debian package, version 2.0.
size 3170778 bytes: control archive=2586 bytes.
78 bytes, 2 lines conffiles 631 bytes, 12 lines control 4631 bytes, 51 lines md5sums 1232 bytes, 41 lines postinst #!/bin/sh
385 bytes, 9 lines preinst #!/bin/sh
Architecture: amd64
Depends: openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2
Description: Sunshine is a Gamestream host for Moonlight.
Sunshine is a Gamestream host for Moonlight.
Homepage: https://app.lizardbyte.dev
Maintainer: https://github.com/LizardByte
Package: sunshine
Priority: optional
Section: devel
Version: 0.14.1
Installed-Size: 12739
dpkg-deb -c /sunshine.deb
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/bin/
lrwxrwxrwx root/root 0 2022-08-12 07:46 ./etc/bin/sunshine -> sunshine-0.14.1
-rwxr-xr-x root/root 4548680 2022-08-12 07:46 ./etc/bin/sunshine-0.14.1
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/systemd/user/
-rw-r--r-- root/root 148 2022-08-12 07:45 ./etc/lib/systemd/user/sunshine.service
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/lib/udev/rules.d/
-rw-r--r-- root/root 75 2022-08-12 07:37 ./etc/lib/udev/rules.d/85-sunshine.rules
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/
-rw-r--r-- root/root 998 2022-08-12 07:37 ./etc/sunshine/assets/box.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/shaders/opengl/
-rw-r--r-- root/root 855 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.frag
-rw-r--r-- root/root 620 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertUV.vert
-rw-r--r-- root/root 399 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/ConvertY.frag
-rw-r--r-- root/root 181 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.frag
-rw-r--r-- root/root 347 2022-08-12 07:37 ./etc/sunshine/assets/shaders/opengl/Scene.vert
-rw-r--r-- root/root 25012 2022-08-12 07:37 ./etc/sunshine/assets/steam.png
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/
-rw-r--r-- root/root 8177 2022-08-12 07:37 ./etc/sunshine/assets/web/apps.html
-rw-r--r-- root/root 63 2022-08-12 07:37 ./etc/sunshine/assets/web/clients.html
-rw-r--r-- root/root 33037 2022-08-12 07:37 ./etc/sunshine/assets/web/config.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/
-rw-r--r-- root/root 1548 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/LICENSE.txt
-rw-r--r-- root/root 187 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/attribution.js
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/
-rw-r--r-- root/root 59305 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/all.min.css
-rw-r--r-- root/root 675 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/brands.min.css
-rw-r--r-- root/root 57873 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/fontawesome.min.css
-rw-r--r-- root/root 677 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/regular.min.css
-rw-r--r-- root/root 669 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/solid.min.css
-rw-r--r-- root/root 6359 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/svg-with-js.min.css
-rw-r--r-- root/root 26702 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/css/v4-shims.min.css
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/
-rw-r--r-- root/root 134294 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.eot
-rw-r--r-- root/root 747927 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.svg
-rw-r--r-- root/root 133988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.ttf
-rw-r--r-- root/root 89988 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff
-rw-r--r-- root/root 76736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff2
-rw-r--r-- root/root 34034 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.eot
-rw-r--r-- root/root 144714 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.svg
-rw-r--r-- root/root 33736 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.ttf
-rw-r--r-- root/root 16276 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff
-rw-r--r-- root/root 13224 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff2
-rw-r--r-- root/root 203030 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.eot
-rw-r--r-- root/root 918991 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.svg
-rw-r--r-- root/root 202744 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.ttf
-rw-r--r-- root/root 101648 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff
-rw-r--r-- root/root 78268 2022-08-12 07:37 ./etc/sunshine/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff2
-rw-r--r-- root/root 452 2022-08-12 07:37 ./etc/sunshine/assets/web/header-no-nav.html
-rw-r--r-- root/root 2762 2022-08-12 07:37 ./etc/sunshine/assets/web/header.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/images/
-rw-r--r-- root/root 120760 2022-08-12 07:37 ./etc/sunshine/assets/web/images/favicon.ico
-rw-r--r-- root/root 2115 2022-08-12 07:37 ./etc/sunshine/assets/web/images/logo-sunshine-45.png
-rw-r--r-- root/root 1546 2022-08-12 07:37 ./etc/sunshine/assets/web/index.html
-rw-r--r-- root/root 3636 2022-08-12 07:37 ./etc/sunshine/assets/web/password.html
-rw-r--r-- root/root 1525 2022-08-12 07:37 ./etc/sunshine/assets/web/pin.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/assets/web/third_party/
-rw-r--r-- root/root 79665 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.bundle.min.js
-rw-r--r-- root/root 155567 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/bootstrap.min.css
-rw-r--r-- root/root 342147 2022-08-12 07:37 ./etc/sunshine/assets/web/third_party/vue.js
-rw-r--r-- root/root 2454 2022-08-12 07:37 ./etc/sunshine/assets/web/troubleshooting.html
-rw-r--r-- root/root 2855 2022-08-12 07:37 ./etc/sunshine/assets/web/welcome.html
drwxr-xr-x root/root 0 2022-08-12 07:46 ./etc/sunshine/config/
-rw-r--r-- root/root 377 2022-08-12 07:37 ./etc/sunshine/config/apps.json
-rw-r--r-- root/root 73 2022-08-12 07:37 ./etc/sunshine/config/sunshine.conf

Found it! It looks like Sunshine is installed at /etc/bin/sunshine. I'm not sure here what's the latest on the cpack you can either change the ENTRYPOINT or change the install path with some cmake variable if you have one.

Let's run it!

I've changed the entrypoint, rebuilt and run:

docker run -it --rm --name=sunshine --net=host lizardbyte/sunshine:local

Nothing happens, no log message, no output. The process is stuck there eating CPU at 100% but worst of all allocating memory like crazy!

Screenshot 2022-08-12 at 09 19 56

(it keeps growing, here at ~6.5GB of RAM used I forcefully killed the container).

I don't know what the issue is but this seems pretty bad.

Final comments

There are a few things missing in this Dockerfile compared to the Dockerfile on GOW most notably:

  • you haven't installed any additional libraries when installing the .deb
  • using --no-install-recommends when installing sunshine.deb might have created an environment that is missing some required library.

Even assuming that the final container is in a good state the instructions in the DOCKER_README aren't really sufficient to run Sunshine. You'll have to pass the Xorg/Wayland socket, PulseAudio/Pipewire, udev, dbus and on top of that, depending on the GPU, you'll have to install the correct drivers, software packages and pass the right options to the docker run command (see the docs on GOW: run on desktop, NVIDIA config.

Some might say this looks like a completely different project and that's probably why you should point people to GOW instead 😉

@ABeltramo

Copy link
Copy Markdown
Contributor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

@ReenigneArcher

Copy link
Copy Markdown
MemberAuthor

I was thinking about avoiding duplicating efforts, the best way forward might be to provide a skeleton Docker image which includes the latest Sunshine build similar to what you have right now (just fix the entrypoint).

Since there's no one way of running Sunshine, with this anyone can create their own Docker image based on what they want to achieve; for example:

FROM lizardbyte/sunshine
# install Wayland and SteamENTRYPOINT start-wayland && start-steam && start-sunshine

You also don't have to deal with PID/GUID/TZ or any other runtime option, just keep a simple docker image that people can expand on.

Let me know what you think!

Revisiting this again. I agree with this idea and my updates to this branch "should" reflect that.

These items from your previous review should be fixed as well.

  • build and several other directories/files added to .dockerignore
  • TZ, PUID and PGID args removed
  • sunshine binary should now be at /usr/bin/sunshine (actually fixed by fix path issues #330 )
  • DOCKER_README.md updated (still probably lacking)

Not real sure about the CPU and ram usage. My only guess would be that Sunshine was continuously crashing and restarting?

@ABeltramo

Copy link
Copy Markdown
Contributor

I have to spend some more time in trying this out with GOW but I have a quick suggestion, first:

TZ, PUID and PGID args removed

This is probably not the best way forward; processes in Docker container shouldn't run as root. I think it would be better to create a default user but also give users the ability to override that at build time (if needed).

Something like:

FROM sunshine-base as sunshine
# copy deb from builderCOPY --from=sunshine-build /root/sunshine-build/build/cpack_artifacts/Sunshine.deb /sunshine.deb
# install sunshineRUN apt-get update -y \
&& apt-get install -y --no-install-recommends /sunshine.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV TZ="Europe/London"ARG UNAME=retro
ENV UNAME=${UNAME}
ARG PUID=1000
ENV PUID=${PUID}
ARG PGID=1000
ENV PGID=${PGID}
RUN groupadd -f -g "${PGID}""${UNAME}"RUN useradd -mk "$(mktemp -d)" -u "${PUID}" -g "${PGID}""${UNAME}"ENV HOME=/home/$UNAME
USER ${UNAME}
# network setupEXPOSE 47984-47990/tcp
EXPOSE 48010
EXPOSE 47998-48000/udp
# setup config directoryRUN mkdir ${HOME}/config
# entrypointENTRYPOINT ["/usr/bin/sunshine", "${HOME}/config/sunshine.conf"]

- add user setup
- simplify `ENTRYPOINT` by creating symbolic link to user's config directory
Co-Authored-By: ABeltramo <beltramo.ale@gmail.com>
@ReenigneArcher
ReenigneArcherforce-pushed the update/docker branch 2 times, most recently from bf7625e to 497e609CompareOctober 27, 2022 03:25
@ReenigneArcher
ReenigneArcher merged commit dcdd716 into nightlyOct 28, 2022
@ReenigneArcher
ReenigneArcher deleted the update/docker branch October 28, 2022 01:51
@ReenigneArcherReenigneArcher mentioned this pull request Oct 28, 2022
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ReenigneArcher@ABeltramo