owntracks / recorder

Store and access data published by OwnTracks apps
Other
821 stars 120 forks source link

friends.txt in HTTP mode does not make devices visible from the mobile app #462

Closed iSaluki closed 2 months ago

iSaluki commented 2 months ago

I have a simple setup of the recorder in a Docker container, and I have two devices connected to my container, reporting their location.

However, I cannot see either device from the app (both Android).

I have created a friends.txt file in /config and populated it with:

myuser ["myuser/device0", "myuser/device1"]

And then I have applied these changes to the database using ocat -S /store/ --load=friends < friends.txt.

Yet, neither device can see the location data of the other, even after pressing the report button on both.

For reference, locations can be viewed from the web interface with no issues.

Am I doing something obviously wrong here?

jpmens commented 2 months ago

I think the problem will be that, as you're running in Docker, the ot-recorder process is already running and has the lmdb open and locked. This means that the ocat(1) you're correctly using cannot write to the database.

A very recent issue (https://github.com/owntracks/talk/issues/181) brought that to light; I think the only way to solve this (tips in the issue) is to shutdown the daemon, load the friends, and then restart.

iSaluki commented 2 months ago

Thank you for this. I thought I was missing something basic. Could you please inform me how I should approach shutting the daemon down without causing the container to recycle itself?

When I exec into the container I can see the process for ot-recorder and am able to kill it, but doing so causes the container to immediately restart. Additionally, I do not believe ocat can be run while the container is down. And as docker does not include a full init sytsem I'm a bit lost as to how the daemon can be taken out.

jpmens commented 2 months ago

Sadly I'm not very docker-savvy at all. I was hoping the tips in the issue I linked to would help you. I think the basics are to shutdown the container, then launch it with a new entrypoint (see that issue on how to), to run ocat. When you're done, exit and launch the container normally.

I'm almost certain you don't want to hear this now, but the OwnTracks project has always favoured MQTT as protocol (and that's how we started off and what most of us use daily). If at all possible, I'd like to recommend you consider using that protocol. :)

iSaluki commented 2 months ago

I appreciate you taking the time to help here. I've reassessed, and I do think that my use case would be possible with HTTP, but I will take your advice and redeploy with MQTT instead, as it looks like this method works better anyway (and it's new to me so might be some fun).

jpmens commented 2 months ago

I’d like to promote Quicksetup as the easiest and most pain free method to set up all OwnTracks components. https://owntracks.org/booklet/guide/quicksetup/