Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tribler in docker as a web application with a gui #6759

Open
dmuiX opened this issue Feb 4, 2022 · 8 comments
Open

Run tribler in docker as a web application with a gui #6759

dmuiX opened this issue Feb 4, 2022 · 8 comments

Comments

@dmuiX
Copy link

dmuiX commented Feb 4, 2022

Dear devs,

Nice application so far. Would be so nice if you could run this application as a web service in docker with a web gui. I want to use it on my home server. And with a web application I could use it from every device I have and let the downloads run over night. Way easier than running it locally on my notebook.

Thanks and kind regards

Daniel

@dmuiX dmuiX changed the title Run tribler in docker wohnt Web GUI Run tribler in docker as a web application with a gui Feb 4, 2022
@dmuiX
Copy link
Author

dmuiX commented Feb 4, 2022

Okay looks like somebody has already written this enhancement in another issue. Might be good to make the suggestions there more invisible so new users like me find it when lookin on Google for tribler docker.

@kotenok2000
Copy link

Maybe you meant visible?

@dmuiX
Copy link
Author

dmuiX commented Feb 9, 2022

Yeah visible of Course :D

@devos50
Copy link
Contributor

devos50 commented Feb 13, 2022

Thank you for your suggestion!

@devos50 devos50 added this to the Backlog milestone Feb 13, 2022
@mivale
Copy link

mivale commented Nov 27, 2022

After some fiddling I've got this working in a rudimentary fashion.

I've had to make some tweaks to the Dockerfile to get the Qt version to work, then I created another Dockerfile, which is basically a Xvfb / X11Vnc wrapper around the first image, which has all the correct librararies installed.

When I finally had it working, it turned out that api_port was not an int but a string, so not being a python guy myself, I just hacked this away:

diff --git a/src/tribler/gui/tribler_window.py b/src/tribler/gui/tribler_window.py
index 0e6b84730..3c53e1c49 100644
--- a/src/tribler/gui/tribler_window.py
+++ b/src/tribler/gui/tribler_window.py
@@ -177,6 +177,7 @@ class TriblerWindow(QMainWindow):
         api_port = api_port or default_network_utils.get_first_free_port(
             start=int(get_gui_setting(self.gui_settings, "api_port", DEFAULT_API_PORT))
         )
+        api_port = int(api_port)
         if not default_network_utils.is_port_free(api_port):
             raise RuntimeError(
                 "Tribler configuration conflicts with the current OS state: "

Then you need a simple start script which fires up xvfb / fluxbox / x11vnc / tribler (in said order) - never mind the sleeps

# Do not use 32bpp
export DISPLAYSIZE="1280x900x24"

# login with this password
export VNCPASSWORD="tribler"

export DISPLAY=:1

/usr/bin/Xvfb $DISPLAY -screen 0 "$DISPLAYSIZE" &

/usr/bin/fluxbox >/dev/null &

sleep 5
x11vnc -display $DISPLAY -bg -forever -usepw -passwd "$VNCPASSWORD" -shared -forever &

sleep 5
/tribler/src/tribler.sh

After the container has been started (mind you, this image is only local)

docker run --rm -d \
  -v $(pwd)/settings:/home/user/.Tribler \
  -v $(pwd)/download:/home/user/Downloads \
  -p 5900:5900 mivale/tribler-vnc:latest

you've got a gui version of tribler accessible via vnc running on any linux machine.

Caveat: the resulting docker image is 2.79GB and I have NOT tried downloading anything with it (it's currently not running in host mode, don't know if that's a must)

image

Notice the macos vncviewer artifacts 🤣

Let me know if anyone has interest in this and wether or not to create a pull request. You could build everything in a single container using a git clone off main (with the single int() tweak, that is).

It would be nice if someone else also were to test this 😬

Perhaps it would be better to just create a repo which does all the heavy work and leaves Tribler alone 😝

@allenyllee
Copy link

Just curious, can we separate frontend from backend? For example, run a backend inside a server container, and run a GUI frontend through a client container?

@mivale
Copy link

mivale commented Nov 28, 2022

Glad you asked that, because that was my first thought as well, and also my first try.

Technically it must be possible but when I tried to make the gui talk to another backend on a different container by claiming the api port and forwarding it, the gui (at least on mac) spawned its own api on the next port and started talking to that one.

A setting with a backend url would make this possible. I have a feeling the api/gui combo are hardwired together.

@febriansasi
Copy link

Is there any update how to run tribler on docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants