Kolibri: Content Import - Cannot add server on LAN as import Network Address

Created on 21 May 2019  Â·  11Comments  Â·  Source: learningequality/kolibri

Try to import using the LAN method on a specific port.

The images attached show a valid Kolibri address on the same LAN and a failed import/.

2019-05-21 15 46 25 192 168 1 104 c308e1cf160f

2019-05-21 15 46 52 192 168 1 100 90bd014cbb4f

Context

  • Kolibri version
    12.3
    Linux alarm 5.0.11-1-ARCH #1 SMP Fri May 3 01:14:14 UTC 2019 aarch64 GNU/Linux

Vivaldi

…

✅ Workaround

As, explained in https://github.com/learningequality/kolibri/issues/5519#issuecomment-495805834, this error might appear if the "Allow users to access content without signing in" setting is unchecked on the facility/#/settings page.

The current workaround is to uncheck that box and save the settings. (This will have the possibly unwanted result that people can explore content as a "guest").

P1 - important bug

All 11 comments

@nobicycle I did a quick test on two Kolibri 0.12.3 instances working on localhost ports 8000 and 8001, which went fine.

Based on your screenshots, it looks like you can access the port 8087 Kolibri fine in a web browser.

Is it possible that the Port 8087 Kolibri instance is an older version of Kolibri (and doesn't support "Import from network location", or are they both at version 0.12.3? Can you import from Port 8080 kolibri from the Port 8087 version? (You can try adding a Network Address on the Port 8087 Channels page).

If you can, can you share any error logs when trying to connect to 192.168.1.100:8087 from the "New address" modal? The request should be going to a URL with /api/discovery/networklocation.

@jonboiser

The server to import FROM is this type:

Server URL | http://192.168.1.100:8087/
-- | --
3 GB
0.12.2

I tried to import TO the 8087 port instance FROM the 8080 instance but got the same error already posted. Both instances are obviously online and working.

The 8087 logs are attached.
kolibri.log
server.log

best wishes

I see some connection errors in the log.
From the 8087 command line:

$ curl -v  http://192.168.1.104:8080/
*   Trying 192.168.1.104...
* TCP_NODELAY set
* Connected to 192.168.1.104 (192.168.1.104) port 8080 (#0)
> GET / HTTP/1.1
> Host: 192.168.1.104:8080
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 302 Found
< Content-Type: text/html; charset=utf-8
< Location: /user/
< X-Frame-Options: SAMEORIGIN
< Content-Length: 0
< Vary: Accept-Language, Cookie
< Content-Language: en
< Date: Wed, 22 May 2019 04:53:03 GMT
< Server: 0.0.0.0
< 
* Connection #0 to host 192.168.1.104 left intact
* Closing connection 0

Maybe this is related:
https://github.com/learningequality/kolibri/issues/5529

This occurred on the 8080 port instance - downloading from the internet.

@jamalex The network location discovery code seems to be failing. Here is some logs from server.log. http://192.168.1.104:8080/ looks to be the correct address. The NewConnectionError reason is "Connection refused"

INFO     Attempting connections to variations of the URL: None
INFO     Attempting connection to: http://192.168.1.104:8080/
INFO     Attempting connection to: http://192.168.1.104:8080/
INFO     Attempting connection to: http://192.168.1.104/
INFO     Unable to connect: HTTPConnectionPool(host='192.168.1.104', port=80): Max retries exceeded with url: /api/public/info/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f71fad282e8>: Failed to establish a new connection: [Errno 111] Connection refused'))
INFO     Attempting connection to: http://192.168.1.104:8008/
INFO     Unable to connect: HTTPConnectionPool(host='192.168.1.104', port=8008): Max retries exceeded with url: /api/public/info/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f71faa4d6a0>: Failed to establish a new connection: [Errno 111] Connection refused'))
INFO     Attempting connection to: https://192.168.1.104:8080/
INFO     Unable to connect: HTTPSConnectionPool(host='192.168.1.104', port=8080): Max retries exceeded with url: /api/public/info/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)')))
INFO     Attempting connection to: https://192.168.1.104/
INFO     Unable to connect: HTTPSConnectionPool(host='192.168.1.104', port=443): Max retries exceeded with url: /api/public/info/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f71fb039e10>: Failed to establish a new connection: [Errno 111] Connection refused'))

Thanks for the report. Could you try the following CURL request from that same machine (the 8087 one)?

curl -v http://192.168.1.104:8080/api/public/info/

Hi Jamalex
In a browser I get, after logging in:

An equivalent endpoint in studio which allows kolibri devices to know
if this device can serve content.
Spec doc: https://docs.google.com/document/d/1XKXQe25sf9Tht6uIXvqb3T40KeY3BLkkexcV08wvR9M/edit#

GET /api/public/info/
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
"application": "kolibri",
"kolibri_version": "0.12.3",
"instance_id": "da5c36a2007784102e795d4752d64b36",
"device_name": "alarm",
"operating_system": "Linux"
}

On the commend line, I get:

$ curl -v http://192.168.1.104:8080/api/public/info/

  • Trying 192.168.1.104...
  • TCP_NODELAY set
  • Connected to 192.168.1.104 (192.168.1.104) port 8080 (#0)

GET /api/public/info/ HTTP/1.1
Host: 192.168.1.104:8080
User-Agent: curl/7.64.1
Accept: /

< HTTP/1.1 302 Found
< Content-Type: text/html; charset=utf-8
< Location: /redirectuser/
< X-Frame-Options: SAMEORIGIN
< Content-Length: 0
< Vary: Accept-Language, Cookie
< Content-Language: en
< Date: Fri, 24 May 2019 11:55:43 GMT
< Server: 0.0.0.0
<

  • Connection #0 to host 192.168.1.104 left intact
  • Closing connection 0

Thanks, that was helpful!

I have a theory... do you by any chance have the "Allow users to access content without signing in" box unchecked on the /facility/#/settings page?

The following middleware prevents that endpoint from being accessed when not authenticated:
https://github.com/learningequality/kolibri/blob/release-v0.12.x/kolibri/core/middleware/signin_page.py#L34

I suggest we update the middleware to be a blacklist (of /learn/) rather than a whitelist, since there will otherwise likely be additional things that break when that setting is toggled.

(In the interim, until this is fixed, you can toggle that box back on when syncing content)

"do you by any chance have the "Allow users to access content without signing in" box unchecked on the /facility/#/settings page?"

That is correct.
Import stage is now working.

Thanks

Ok, great!

@indirectlylit Discussed with @rtibbles, and he didn't see any issues with switching to a blacklist instead of a whitelist.

Fixed in #5614

Was this page helpful?
0 / 5 - 0 ratings