OdyseeTeam / odysee-api

API server for Odysee
https://odysee.com
MIT License
229 stars 49 forks source link

How to run this without Docker? #295

Closed probonopd closed 3 years ago

probonopd commented 3 years ago

I want to run this on a small ARM-powered device which has no place for Docker. Downloaded and built it with go, but then? How to use it?

FreeBSD% /home/liveuser/go/bin/lbrytv 
{"buildCommit":"unknown","buildDate":"unknown","buildVersion":"unknown","level":"info","logLevel":"info","mode":"production","msg":"standard logger configured"}
{"level":"info","module":"monitor","msg":"sentry disabled (no DSN configured)"}
{"dsn":"postgres://lbrytv:lbrytv@localhost/lbrytv?sslmode=disable","level":"info","module":"storage","msg":"connecting to the DB"}
{"dsn":"postgres://lbrytv:lbrytv@localhost/lbrytv?sslmode=disable","level":"info","module":"storage","msg":"DB connection failed"}
panic: dial tcp [::1]:5432: connect: connection refused

goroutine 1 [running]:
main.main()
        /home/liveuser/lbrytv/main.go:41 +0x766
FreeBSD% /home/liveuser/go/bin/collector 
{"buildCommit":"unknown","buildDate":"unknown","buildVersion":"unknown","level":"info","logLevel":"info","mode":"production","msg":"standard logger configured"}
{"dsn":"postgres://collector:ZnPfJ!4vTb-nURv8M!JkkuAcjYLYbkiX@localhost:5433/collector?sslmode=disable","level":"info","module":"storage","msg":"connecting to the DB"}
{"dsn":"postgres://collector:ZnPfJ!4vTb-nURv8M!JkkuAcjYLYbkiX@localhost:5433/collector?sslmode=disable","level":"info","module":"storage","msg":"DB connection failed"}
panic: dial tcp [::1]:5433: connect: connection refused

goroutine 1 [running]:
github.com/lbryio/lbrytv/apps/environment.ForCollector(0xc74940)
        /home/liveuser/lbrytv/apps/environment/apps.go:22 +0x3b0
github.com/lbryio/lbrytv/apps/collector/cmd.glob..func3(0x1170d20, 0x11ac458, 0x0, 0x0)
        /home/liveuser/lbrytv/apps/collector/cmd/serve.go:19 +0x26
github.com/spf13/cobra.(*Command).execute(0x1170d20, 0xc000032200, 0x0, 0x0, 0x1170d20, 0xc000032200)
        /home/liveuser/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0x1170d20, 0x8bcc83b7490, 0x476aef, 0xc000110000)
        /home/liveuser/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        /home/liveuser/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
github.com/lbryio/lbrytv/apps/collector/cmd.Execute()
        /home/liveuser/lbrytv/apps/collector/cmd/serve.go:32 +0x31
main.main()
        /home/liveuser/lbrytv/apps/collector/main.go:16 +0x8a

Related: https://github.com/accumulator/plugin.video.lbry/issues/3

tzarebczan commented 3 years ago

What is is you want to run exactly? This repo is for a public lbry.tv api which would support websites like lbry.tv.

Maybe you're looking for the lbry-desktop repo, but don't think the sdk runs on arm devices without having it built there manually.

probonopd commented 3 years ago

Well, I am looking for "the API Server" that is apparently required to watch Lbry on KODI.

tzarebczan commented 3 years ago

It can use the public api we have running on api.lbry.tv

Also, maybe check out https://amp.reddit.com/r/lbry/comments/k40w1q/kodi_plugin_for_lbry/ ?

probonopd commented 3 years ago

Also, maybe check out https://amp.reddit.com/r/lbry/comments/k40w1q/kodi_plugin_for_lbry/ ?

Yes, this exact plugin is the reason that I am asking, because it asks for an "API Server" to be used: https://github.com/accumulator/plugin.video.lbry/issues/3

Are you saying I can just enter api.lbry.tv and use that with the plugin?

tzarebczan commented 3 years ago

Give that a try, should work. The other option would be to run the lbry-sdk on the device itself, or on another device on the network and allow external access (would need to run api server on 0.0.0.0)

probonopd commented 3 years ago

Entered https://api.lbry.tv without a port number, gave an error message. /storage/.kodi/temp/kodi.log:

2021-01-03 22:08:40.327 T:3463443312   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'simplejson.errors.JSONDecodeError'>
                                            Error Contents: Expecting value: line 1 column 1 (char 0)
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/plugin.video.lbry/lbry.py", line 6, in <module>
                                                plugin.run()
                                              File "/storage/.kodi/addons/plugin.video.lbry/resources/lib/plugin.py", line 403, in run
                                                plugin.run()
                                              File "/storage/.kodi/addons/script.module.routing/lib/routing.py", line 130, in run
                                                self._dispatch(self.path)
                                              File "/storage/.kodi/addons/script.module.routing/lib/routing.py", line 141, in _dispatch
                                                view_func(**kwargs)
                                              File "/storage/.kodi/addons/plugin.video.lbry/resources/lib/plugin.py", line 293, in lbry_new
                                                result = call_rpc('claim_search', query)
                                              File "/storage/.kodi/addons/plugin.video.lbry/resources/lib/plugin.py", line 59, in call_rpc
                                                raise e
                                            JSONDecodeError: Expecting value: line 1 column 1 (char 0)
                                            -->End of Python script error report<--
2021-01-03 22:08:40.525 T:3446666096   ERROR: GetDirectory - Error getting plugin://plugin.video.lbry/new/1
2021-01-03 22:08:40.528 T:4093468688   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.lbry/new/1) failed

Seems to be tripping over at https://github.com/accumulator/plugin.video.lbry/blob/main/resources/lib/plugin.py#L36.

From looking at this, can you tell whether this is a command that is in a format that https://api.lbry.tv should understand?

tzarebczan commented 3 years ago

You can see how they are called in the network tab on lbry.tv

I don't think it was intended to work with the public api, but a local one with a running on the device.

You can try api.lbry.tv/api/v1/proxy instead.

probonopd commented 3 years ago

Incredible! This works! Thank you so very, very much. :+1: :100: :1st_place_medal:

tzarebczan commented 3 years ago

Woohoo, I'm glad to hear that! If you find the time, please comment on his repo with the details. Maybe he can make that the default since most folks wouldn't need to run a local sdk.

probonopd commented 3 years ago

The pull request above does exactly that @tzarebczan. Thank you for your help.

tzarebczan commented 3 years ago

No, thank you! Shoot me over your LBC address on Twitter Dm (@tomzarebczan) and we'll get a tip over :)