rinigus / osmscout-server

Maps server providing tiles, geocoder, and router
https://rinigus.github.io/osmscout-server
GNU General Public License v3.0
166 stars 28 forks source link

Package click for Ubuntu Touch 20.04 (focal) #412

Closed jonnius closed 1 year ago

jonnius commented 1 year ago

This PR changes the click target from Ubuntu 16.04 to 20.04.

ToDos:

jonnius commented 1 year ago

The error is: /usr/bin/ld: cannot find -lboost_filesystem.1.71.0, despite:

$ ls /usr/lib/x86_64-linux-gnu/libboost_filesystem*so*
/usr/lib/x86_64-linux-gnu/libboost_filesystem.so
/usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.71.0

When I run g++ manually, changing -lboost_filesystem.1.71.0 to -lboost_filesystem, linking succeeds.

I can't seem to find where linking against this lib is defined anywhere in the qmake config.

jonnius commented 1 year ago

Observations about Map Tiles with Pure Maps Offline

All scenarios tested with Pure Maps unconfined to rule out issues caused by AppArmor restrictions.

Before starting OSM Scout Server App

Pure Maps can't connect to OSM Scout Server, because Connection refused. Logs:

Jan 14 16:46:01 ubuntu-phablet aa-exec[3181]: QObject::connect: No such signal QNetworkReplyHttpImpl::error()
Jan 14 16:46:01 ubuntu-phablet aa-exec[3181]: [ ERROR ]  "{unknown}[Setup]: loading style failed: Connection refused"
Jan 14 16:46:01 ubuntu-phablet aa-exec[3181]: loading style failed: Connection refused
Jan 14 16:46:02 ubuntu-phablet aa-exec[3181]: file:///opt/click.ubuntu.com/pure-maps-slim.jonnius/3.1.1/share/pure-maps-slim.jonnius/qml/MapErrorPage.qml:93:17: Unable to assign [undefined] to QString
● osmscout-server.service - OSM Scout Server
     Loaded: loaded (/home/phablet/.config/systemd/user/osmscout-server.service; static; vendor preset: enabled)
     Active: inactive (dead)

With OSM Scout Server App running

Pure Maps can load map data when OSM Scout Server app is not suspended (e.g. switching forth and back).

After Closing OSM Scout Server App

Pure Maps can load map data.

jonnius commented 1 year ago

Other Observations with Pure Maps Offline

All scenarios tested after OSM Scout Server app was opened and closed again to start the background service. Pure Maps was unconfined to rule out issues caused by AppArmor restrictions.

Styles

Despite being able to load map tiles, the Pure Maps main menu reports an error on loading the map:

loading style failed: HTTP status code 404

Logs:

Jan 14 17:13:05 ubuntu-phablet aa-exec[3847]: Using QSGMapboxGLTextureNode for map rendering. devicePixelRatio: 1
Jan 14 17:13:05 ubuntu-phablet aa-exec[3847]: QObject::connect: No such signal QNetworkReplyHttpImpl::error()
Jan 14 17:13:05 ubuntu-phablet aa-exec[3847]: [ ERROR ]  "{unknown}[General]: The resource `http://localhost:8553/v1/mbgl/style` not found"
Jan 14 17:13:05 ubuntu-phablet aa-exec[3847]: [ ERROR ]  "{unknown}[Setup]: loading style failed: HTTP status code 404"
Jan 14 17:13:05 ubuntu-phablet aa-exec[3847]: QObject::connect: No such signal QNetworkReplyHttpImpl::error()
Jan 14 17:13:05 ubuntu-phablet aa-exec[3847]: QObject::connect: No such signal QNetworkReplyHttpImpl::error()
Jan 14 17:13:05 ubuntu-phablet aa-exec[3847]: [ ERROR ]  "{unknown}[General]: The resource `http://127.0.0.1:8553/v1/mbgl/sprite@2x.json` not found"
Jan 14 17:13:05 ubuntu-phablet aa-exec[3847]: [ ERROR ]  "{unknown}[General]: The resource `http://127.0.0.1:8553/v1/mbgl/sprite@2x.png` not found"
Jan 14 17:13:05 ubuntu-phablet aa-exec[3847]: loading style failed: HTTP status code 404
Jan 14 17:13:05 ubuntu-phablet aa-exec[3847]: [ ERROR ]  "{unknown}[Style]: Failed to load sprite: HTTP status code 404"
Jan 14 17:13:05 ubuntu-phablet aa-exec[3847]: [ ERROR ]  "{unknown}[Style]: Failed to load sprite: HTTP status code 404"

Navigation

Fails without any message in Pure Maps logs. In OSM Scout Server App only an INFO entry for the route request. But on start:

WARNING: Failed to load Valhalla configuration: <unspecified file>(1): expected value
WARNING: Error opening Valhalla's configuration template usr/share/osmscout-server/data/valhalla.json

Search

Seams to work just fine.

rinigus commented 1 year ago

Map tiles are frequently cached, as well as styles, in MapLibre GL. In some sense, easiest is to test using search. If search responds to new queries, it is able to contact the server.

Have you tried to reach the server from browser? For example at http://localhost:8553/v1/activate

jonnius commented 1 year ago

Same effect as for Pure Maps. Connection refused. But if I started the server app once, it response with active status.

rinigus commented 1 year ago

So, it means that the server is not starting. Do you have socket activation enabled? When you start the server, the activation is in preferences.

rinigus commented 1 year ago

I can also see in the patch, that QML imports have changed. So, should we now add new platform?

jonnius commented 1 year ago

About platform: The Ubuntu UI Toolkit was renamed to Lomiri UI Toolkit in Ubuntu Touch 20.04. I made it a new platform now. The old UUITK is deprecated now and we can remove it once Ubuntu Touch 16.04 goes EoL.

jonnius commented 1 year ago

About socket: Yes, I have that setting enabled and I see the socket enabled in systemd.

rinigus commented 1 year ago

Re platform: excellent. That way we can keep support for the both UT versions while it makes sense.

Re systemd activation. So, something doesn't really work. Anything in the logs? Does it trigger starting osmscout-server on contact with the IP port? I would expect logs telling something when you try to access the server port...

jonnius commented 1 year ago

I made Pure Maps unconfined for my tests, so we can't blame AppArmour for this. Find below the logs from a fresh device boot where I just opened Pure Maps with Offline Profile.

$ journalctl --user -fu osmscout-server.service
Mär 04 20:04:19 ubuntu-phablet systemd[2084]: Started OSM Scout Server.
Mär 04 20:04:52 ubuntu-phablet systemd[2084]: Stopping OSM Scout Server...
Mär 04 20:04:52 ubuntu-phablet systemd[2084]: osmscout-server.service: Succeeded.
Mär 04 20:04:52 ubuntu-phablet systemd[2084]: Stopped OSM Scout Server.
$ journalctl --user -fu osmscout-server.socket
Mär 04 20:04:15 ubuntu-phablet systemd[2084]: Listening on OSM Scout Server Socket.
Mär 04 20:04:53 ubuntu-phablet systemd[2084]: osmscout-server.socket: Succeeded.
Mär 04 20:04:53 ubuntu-phablet systemd[2084]: Closed OSM Scout Server Socket.

Relevant lines in Pure Maps log (full log)

Mar 04 20:07:39 ubuntu-phablet aa-exec[3265]: QObject::connect: No such signal QNetworkReplyHttpImpl::error()
Mar 04 20:07:39 ubuntu-phablet aa-exec[3265]: [ ERROR ]  "{unknown}[Setup]: loading style failed: Connection refused"
Mar 04 20:07:39 ubuntu-phablet aa-exec[3265]: loading style failed: Connection refused
Mar 04 20:07:39 ubuntu-phablet aa-exec[3265]: file:///opt/click.ubuntu.com/pure-maps-slim.jonnius/3.2.0/share/pure-maps-slim.jonnius/qml/MapErrorPage.qml:93:17: Unable to assign [undefined] to QString

Any idea how to investigate further?

rinigus commented 1 year ago

What's the status with the browser? Have you tried to reach the server from browser? For example at http://localhost:8553/v1/activate

When it works with the browser, try to use Pure Maps in the same config.

jonnius commented 1 year ago

Same effect as for Pure Maps. Connection refused. But if I started the server app once, it response with active status.

jonnius commented 1 year ago

On boot, this is the status:

$ systemctl --user status osmscout-server.socket 
● osmscout-server.socket - OSM Scout Server Socket
     Loaded: loaded (/home/phablet/.config/systemd/user/osmscout-server.socket; enabled; vendor preset: e>
     Active: inactive (dead)
   Triggers: ● osmscout-server.service
     Listen: 127.0.0.1:8553 (Stream)
$ systemctl --user status osmscout-server.service 
● osmscout-server.service - OSM Scout Server
     Loaded: loaded (/home/phablet/.config/systemd/user/osmscout-server.service; static; vendor preset: e>
     Active: inactive (dead)

Would the socket need to be active?

rinigus commented 1 year ago

Here is what I have:

● osmscout-server.socket - OSM Scout Server Socket
   Loaded: loaded (/home/defaultuser/.config/systemd/user/osmscout-server.socket; enabled; vendor preset: enabled)
   Active: active (listening) since Sun 2023-03-05 11:54:00 EET; 31min ago
   Listen: 127.0.0.1:8553 (Stream)
   CGroup: /user.slice/user-100000.slice/user@100000.service/osmscout-server.socket

● osmscout-server.service - OSM Scout Server
   Loaded: loaded (/home/defaultuser/.config/systemd/user/osmscout-server.service; static; vendor preset: enabled)
   Active: inactive (dead)

Strange that the socket doesn't start on boot. So, our bug is in the server configs and has nothing to do with Pure Maps ...

jonnius commented 1 year ago

I am one step further. The socket unit has WantedBy=user-session.target which doesn't exist. I changed it to WantedBy=graphical-session.target and enabled the socket again. Now I can access the port via the browser after a reboot.

rinigus commented 1 year ago

Then I would expect that Pure Maps should work as well

jonnius commented 1 year ago

After I have set the working directory in the service file, it now works fine with Pure Maps, as well. :)

jonnius commented 1 year ago

~It also works if I remove the WantedBy line altogether. I wonder, is there any reason for it or is removing it just safe?~ Apparently it needs something there in order for systemctl enable to work.

jonnius commented 1 year ago

Now the question would be: Is it safe for other distros to just have graphical-session.target there instead of user-session.target or should we distinguish that on packaging?

rinigus commented 1 year ago

Now the question would be: Is it safe for other distros to just have graphical-session.target there instead of user-session.target or should we distinguish that on packaging?

I would prefer not to change that as it will require testing. So, let's fix it for UT only

jonnius commented 1 year ago

This PR seems to be complete. I got positive feedback from some testers, too.

rinigus commented 1 year ago

Thank you very much!

JamiKettunen commented 1 year ago

Hello @jonnius and thank you for the work on updating this to 20.04! Could an updated click be published to https://open-store.io/app/osmscout-server.jonnius? ^^

jonnius commented 1 year ago

I was waiting for the next release, but that seems to take a while. So I just uploaded 3.0.0 for focal.