GithubHelp home page GithubHelp logo

owntracks / docker-recorder Goto Github PK

View Code? Open in Web Editor NEW
122.0 10.0 68.0 83 KB

Docker image for OwnTracks Recorder

Makefile 6.56% Shell 1.88% Dockerfile 3.83% Lua 87.73%
owntracks recorder docker-image owntracks-recorder mosquitto-broker http mqtt

docker-recorder's Introduction

OwnTracks

OwnTracks allows you to keep track of your own location. You can build your private location diary or share it with your family and friends. OwnTracks is open-source and uses open protocols for communication so you can be sure your data stays secure and private.

To get started, install OwnTracks on your smartphone. Afterwards you can connect it to an existing server straight away or follow the guide in our Documentation to set up your own.

Documentation

Build Status

docker-recorder's People

Contributors

deisi avatar f0rdprefect avatar ippocratis avatar jaeha-choi avatar jpmens avatar juzam avatar kirichkov avatar marcopaganini avatar mbhoek avatar przemas75 avatar schoentoon avatar stavros-k avatar stv0g avatar suhlig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-recorder's Issues

ot-recorder silently fails on startup

Hi there!

Attempting to use owntracks/recorder:latest (currently 0.9.3) silently fails:

$ sudo podman run --net=host -v /srv/owntracks/store:/store -v /srv/owntracks/config:/config --name owntracks docker.io/owntracks/recorder:latest
$ sudo podman container ls -a
CONTAINER ID  IMAGE                                         COMMAND               CREATED        STATUS                    PORTS                                            NAMES
1fe3574ce4be  docker.io/owntracks/recorder:latest                                 5 seconds ago  Exited (2) 5 seconds ago                                                   owntracks

The most recent version I could find without this issue is owntracks/recorder:0.9.1-22:

$ sudo podman container rm owntracks
$ sudo podman run --net=host -v /srv/owntracks/store:/store -v /srv/owntracks/config:/config --name owntracks docker.io/owntracks/recorder:0.9.1-22
ot-recorder[2]: version 0.9.1 starting with STORAGEDIR=/store
ot-recorder[2]: connecting to MQTT on 127.0.0.1:1883 as clientID ot-recorder-mymachine-2 without TLS
ot-recorder[2]: HTTP listener started on , without browser-apikey
ot-recorder[2]: HTTP port is in use. Exiting.

To be clear, the :latest tag does not show any of the messages starting with ot-recorder[2], so I couldn't identify the misconfiguration without using an older version.

This is a completely fresh installation, so I'm not sure if ot-recorder would've quietly continued working if the configuration was dialed in correctly before upgrading to 0.9.2. I'd assume that to be the case.

I'm also not sure if this is an issue with the container itself or if ot-recorder's behavior changed between those revisions.

When using systemd, HEALTHCHECK causes tons of syslog spam

It appears systemd monitors the mounts on the system and reports on any mountpoint activity. For some reason, healthcheck in docker causes a temporary filesystem to be mounted and dismounted every time the recorder-health.sh script is called. This causes an large amount of syslog spam, making it difficult to see useful information.

Sample log message, repeated ad nauseam:

Mar 25 19:57:10 foo systemd[1]: run-docker-runtime\x2drunc-moby-d83a458ad894bcbdb570b0042d046a3ca2887635cf6d0dfc830c96de8e41ac70-runc.H9q28H.mount: Succeeded.

While using healthcheck is possibly a good idea, the vast majority of docker configurations I see do not use it. Also, it's arguable if monitoring of a container should be under docker or delegated to another system.

It would be a good idea to balance the usefulness of healthcheck vs the immense amount of syslog spam the feature generates, maybe turning the feature off until the problem is better understood.

docker: Recorder webapp is empty

I'm using the docker image and have owntracks running well! However, the web interface is empty despite data being pushed to the MQTT broker. Is there some sort of config I'm missing?

Error: Address not available

I'm trying to set up the recorder on docker. And since the documentation is, sorry, very hard to understand, and it isn't easy to connect all services together I'm creating this issue here.
Couldn't find any documentation about this error code.
This is my compose:

---
version: '3'

services:

  otrecorder:
    image: owntracks/recorder
    container_name: otrecorder
    ports:
      - 8083:8083
    volumes:
      - /owntracks/otrecorder/config:/config
      - /owntracks/otrecorder/store:/store
    restart: unless-stopped

Frontend stopped connecting to recorder (crosspost from owntracks/frontend)

I am sorry for cross-posting, but I have no idea which part is responsible for this issue...)

I run owntracks recorder and frontend in swarm. After the latest recorder upgrade (version 0.8.8), the frontend stopped working properly. It is throwing:

10.0.1.11 - - [23/May/2022:07:56:26 +1000] "GET /?lat=-34.53xxx&lng=142.66xxx&zoom=6&start=2022-04-22T14%3A00%3A00&end=2022-05-23T13%3A59%3A59&layers=last,line HTTP/1.1" 200 471 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36"
10.0.1.11 - - [23/May/2022:07:56:26 +1000] "GET /config/config.js HTTP/1.1" 500 579 "https://owntracks.mydomain.com/?lat=-34.53xxx&lng=142.66xxx&zoom=6&start=2022-04-22T14%3A00%3A00&end=2022-05-23T13%3A59%3A59&layers=last,line" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36"
2022/05/23 07:56:26 [error] 9#9: *1 rewrite or internal redirection cycle while internally redirecting to "/config/config.js/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html", client: 10.0.1.11, server: , request: "GET /config/config.js HTTP/1.1", host: "owntracks.mydomain.com", referrer: "https://owntracks.mydomain.com/?lat=-34.53xxx&lng=142.66xxx&zoom=6&start=2022-04-22T14%3A00%3A00&end=2022-05-23T13%3A59%3A59&layers=last,line"
10.0.1.11 - - [23/May/2022:07:56:26 +1000] "GET /api/0/list HTTP/1.1" 502 559 "https://owntracks.mydomain.com/?lat=-34.53xxx&lng=142.66xxx&zoom=6&start=2022-04-22T14%3A00%3A00&end=2022-05-23T13%3A59%3A59&layers=last,line" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36"

I hope you can point me to the right direction in order to fix this issue...

My docker-compose.yml:

version: "3.8"

services:
  otr-recorder:
    image: owntracks/recorder
    volumes:
      - /mnt/docker/docker-volumes/owntracks:/store
    environment:
      - OTR_HOST=mosquitto.mydomain.com
      - OTR_USER=<edited>
      - OTR_PASS=<edited>
      - PUID=1000
      - PGID=1000
      - TZ=Australia/Melbourne
    networks:
      owntracks:
        aliases:
          - otr-recorder

  otr-frontend:
    image: owntracks/frontend
    environment:
      - SERVER_HOST=otr-recorder
      - SERVER_PORT=8083
      - TZ=Australia/Melbourne
    networks:
      - proxy
      - owntracks
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.owntracks.rule=Host(`owntracks.mydomain.com`)"
        - "traefik.http.routers.owntracks.tls.certresolver=letsencrypt"
        - "traefik.http.routers.owntracks.entrypoints=https"
        - "traefik.http.routers.owntracks.tls=true"
        - "traefik.http.routers.owntracks.middlewares=authelia@docker"
        - "traefik.http.services.owntracks.loadbalancer.server.port=80"

networks:
  owntracks:
    internal: true
  proxy:
    external: true

Cannot lmdb-open MainDB

Hi, i got an error Cannot lmdb-open MainDB after tryying to run a recorder container.

Can it be due to me using M1 mac for this? Is there a way to launch owntracks recorder docker image on m1 mac?

Invalid function arguments provided with TLS connection

(I have probably the same issue as #27, but to not confuse two debugging sessions, I'm opening another bug.)

I am trying to get recorder to run inside docker in a current version. I already have a self-compiled version 0.7.6 running on another server using the same broker, so I'm pretty sure it is not a settings issue.

To test this issue, I tried to run the docker container with a shell as an entrypoint with mounting the config folder:
docker run -v /var/lib/recorder/config:/config --entrypoint /bin/sh --no-healthcheck -it owntracks/recorder
with the le-all.pem from here in /var/lib/recorder/config

This launches a shell, where I can provide any random (or working) credentials,
export OTR_USER="username"
export OTR_PASS="password"
export OTR_CAFILE=/config/le-all.pem
ot-recorder --host mosquitto.example.org --port 8883 "owntracks/#"

it always shows:
ot-recorder[11]: version 0.8.3 starting with STORAGEDIR=/store
Cannot set TLS CA: Invalid function arguments provided. (check path names)

So you can see that there isn't even a connection attempt made.

ls /config and less /config/le-all.pem both show the expected values.

Docker image still using 0.8.3

The docker image still appears to be using recorder version 0.8.3, whilst 0.8.4 has been out for a while on the main repo. Could the image be updated, rather than having to manually rebuild?

Dockerfile: with/without openssl-dev?

I said earlier that the image would build for me only when I add openssl-dev as a dependency.

Thanks to @deisi 's excellent work, I've now added this to Travis, and it bails out with that requirement.

airjp583

I haven't yet followed all the deps, but this appears to be an OS difference? (I've been building on Docker for Mac)

For the time being I've removed openssl-dev from the Dockerfile.

Build error in hooks.c on RPi 3B+

Hi guys, I want to update my Recorder install from 0.8.6 to 0.8.7 on my RPi 3B+. I had installed 0.8.6 by manually building the docker image on the Pi from this git without problems.

However, now that I want to build 0.8.7 I am running into an error message that prevents the build process from completing. I've attached the log below.

Any ideas as to what's going wrong? Any help is appreciated!

Thanks for keeping this awesome project up!

ot-recorder.log

Unable to run image

Hi,
I am running this command verbatim:

docker run -d -p 8083:8083 -v recorder_store:/store -e OTR_HOST=mqtt_broker owntracks/recorder

But all it does is print a long hex string and nothing starts.
Checking with "docker ps" doesn't list anything.
Any advice?

some recorder.conf variables ignored.

Docker rookie so take that into account.
Started the ot-recorder docker with a local directory as the config directory. I had to so that my OTR_CAFILE was accessible. I had a previously working ot-recorder working on my Ubuntu box but the 19.04 upgrade broke it. So I know I had a good working configuration that I just had to duplicate in the docker setup.
Edited the recorder.conf to assign values to OTR_CAFILE, OTR_HOST, OTR_USER, OTR_PASS, and OTR_PORT and started the docker container without the -d option to see output. It ignored the user and port variables and tried to use the defaults but it honored the CAFILE and the HOST options. Everything is quoted.
But everything works if I specify the same values from the command line with -e.
I don't need this fixed, I have a working solution but I am willing to help troubleshoot / provide access to my system if there is a desire to investigate. But also feel free to close as "won't fix", I have a perfectly working workaround.

Path /store and /config not working with cifs mount on docker host

Hello,

I installed owntracks/recorder on a Ubuntu 22.04.1 LTS docker host. On host I mount a cifs folder with autofs. The user who the docker image run has full access to this folder.

This is the entry in /etc/auto.cifs-shares
docker -fstype=cifs,uid=1000,gid=1000,credentials=/home/user/.smbcredentials ://nas.intranet/docker

Here the file permissions of shared folder.

user@virtubuntu:/media/nas/docker/otr$ ll
total 0
drwxr-xr-x 2 user user 0 Dez 16 10:20 ./
drwxr-xr-x 2 user user 0 Dez 16 10:19 ../
drwxr-xr-x 2 user user 0 Dez 16 10:20 config/
drwxr-xr-x 2 user user 0 Dez 16 10:20 store/
user@virtubuntu:/media/nas/docker/otr$

This compose file do not work

services:
  otrecorder:
    image: owntracks/recorder
    container_name: otrecorder
    environment:
      TZ: Europe/Berlin
    ports:
      - 8083:8083    
    restart: unless-stopped
    #volumes:
    #  - /etc/otrecorder/store:/store
    #  - /etc/otrecorder/config:/config
    volumes:
      - /media/nas/docker/otr/store:/store
      - /media/nas/docker/otr/config:/config

After running this I get the error:

Segmentation fault (core dumped)
Segmentation fault (core dumped)

This compose file works

services:
  otrecorder:
    image: owntracks/recorder
    container_name: otrecorder
    environment:
      TZ: Europe/Berlin
    ports:
      - 8083:8083    
    restart: unless-stopped
    volumes:
      - /etc/otrecorder/store:/store
      - /etc/otrecorder/config:/config
    #volumes:
    #  - /media/nas/docker/otr/store:/store
    #  - /media/nas/docker/otr/config:/config

It works if I use a local folder on the docker host.

user@virtubuntu:/etc/otrecorder$ ll
total 24
drwxr-xr-x   4 user user  4096 Dez 15 18:06 ./
drwxr-xr-x 152 root root 12288 Dez 16 00:19 ../
drwxrwxr-x   2 user user  4096 Dez 15 23:47 config/
drwxrwxr-x   6 user user  4096 Dez 16 10:24 store/

Can anybody help me ? I want to use the shared folder for better backups of all my other docker volumes. Other docker images like mosquitto, phpmyadmin, paperless, traefik ... do not have any problems with the shared cifs folder.

Thanks

Mounts are ignored in docker compose

I am running owntracks-recorder with docker-compose
created some mounts for local folders on host with the container for config and store. But they are ignored and random volumes are created instead

My docker-compse.yml

version: '3'

services:

  otrecorder:
    container_name: ot-recorder
    image: jessestuart/owntracks
    environment:
      - OTR_PORT=0  # disables MQTT
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /run/media/ippo/TOSHIBA/owntracks-recorder/config:/config
      - /run/media/ippo/TOSHIBA/owntracks-recorder/store:/store
    ports:
      - 8083:8083
    restart: unless-stopped

The run/media/ippo/TOSHIBA/owntracks-recorder/store folder is empty

docker inspect container_name shows volume under "/var/lib/docker/volumes/ca799ff14564cd2f5850ff4ce8489b61dd87a71ce9220dbd699f85fa9852eef4/_data" which the recorder location data etc are stored

Does not work from scratch

Many unclear steps, and many points that just do not work.

How to setup eclipse-mosquitto

Setup eclipse-mosquitto in docker with authentification is not obvious part and should be described.
Shortly is something like

  1. Create ./mosquitto/{data,logs,config} dirs.
  2. Create mosquitto.conf without authentification
  3. Run container with mapped volumes,
  4. Jump in to the container and run mosquitto_passwd /mosquitto/config/passwd USER
  5. Shutdown docker, add allow_anonymous false and password_file /mosquitto/config/passwd to mosquitto.conf
  6. Run docker, check the connection with MQTT explorer or another way.

I had to collect this information from all over the internet, and still think that this is huge overhead just for running authenticated mqtt broker (I will definitely forget it in several month)

Broken and not clear docker-composes

Why https://github.com/owntracks/docker-recorder/blob/master/docker-compose.yml
contain 2 recorders? one is built from a Docker file, and another is just a used image?
And ports forwarded only to one of them

Misunderstanding in ports that are used for otrecorder and mqtt (or broken compose).
8083 initially used for otrecorder web interface, but then https://github.com/owntracks/docker-recorder/blob/master/docker-compose-ssl.yml start using it for mqtt tls .
8083 forwarded to mqtt https://github.com/owntracks/docker-recorder/blob/master/docker-compose-ssl.yml#L74 service, but at the same time recorder request nginx to forward connection to this port
https://github.com/owntracks/docker-recorder/blob/master/docker-compose-ssl.yml#L41

otrecorder does not listening to external connections

I had to add ot-recorder ${OTR_TOPIC} --http-host 0.0.0.0 in entrypoint.sh, to start listening for external connections and only after that owntracks-frontend works.

No frontend

Easy way to check that everything works is owntracks-frontend, but this is not mentioned in this repo at all.

No arm messages

RPI is the most popular hardware for such things.

My working configuration is

version: '3'

services:
  owntracks-frontend:
    container_name: owntracks-frontend
    image: alexkutsan/owntracks_frontend_arm
    restart: unless-stopped
    expose:
      - "80"
    ports:
      - 8888:80
    environment:
      - SERVER_HOST=otrecorder
      - SERVER_PORT=8083
    depends_on:
      - otrecorder

  otrecorder:
    build: ./docker-recorder
    ports:
      - 8083:8083
    depends_on:
      - mosquitto
    volumes:
      # - ./owntrack/config:/config
      - ./owntrack/store:/store
    restart: unless-stopped
    environment:
      OTR_HOST: mosquitto
      OTR_USER: alex
      OTR_PASS: ******************
      OTR_STORAGEDIR: /store
      
  mosquitto:
    image: eclipse-mosquitto
    ports:
      - 1883:1883
      # - 8883:8883
    volumes:
      -  data:/mosquitto/data
      - ./mosquitto/logs:/mosquitto/logs
      - ./mosquitto/config:/mosquitto/config
    restart: unless-stopped

But even within this configuration, I have to remember how to init OTR_USER/OTR_PASS.
And how to set up a mobile app.

Trouble getting opencage to work.

Let me start by saying that this is probably a user error, but for the life of me, I cannot figure it out.

I installed the docker image on my unraid server. I have tried passing the OTR_GEOKEY from the -e docker variable definition and in the recorder.conf file. When I pass it into the container, I can start a shell in the container and when I check the exports it is listed and has the "opencage:xxxxx" (correct key instead of x) around it as described in the documentation. I get no indication of lookup failures (no 'missing' file in the ghash directory) nor do I get an address lookup. I have verified that the container can get to https://api.opencagedata.com/ by assembling the same url that recorder creates in geo.c and executing curl inside the container. The result is successful with the correct address.

Any insights on what to check next?

Also, how would you pass the --debug into the container?

Like I said, this is probably on my end, but I am unsure where to look next.

Noob Guide installation

The installation process of this one is quite a bit confusing for a beginner just like me. Can you suggest or create a noob-friendly installation on this one? like installing an MQTT_broker first, or does the mqtt_broker already installed if I pulled the docker image of owntracks recorder. I reviewed the repo of recorder, and frontend but I can't manage to run it.

Installed as per instructions - not accessible on port 8083

After starting the container, the web interface is not accessible on LANIP:8083 via browser
The machine docker runs on has no GUI/Browser

My docker run command is :
docker run -itd
-p 8083:8083
--name=owntracks
--restart=unless-stopped
--net=nginx-pm_default
-e OTR_HOST=mqtt
-e OTR_PORT=1883
-e OTR_USER=user
-e OTR_PASS=pass
-v recorder_store:/store
-v /home/user/owntracks/config:/config
owntracks/recorder

Adding the following lines does not help
-e OTR_HTTPHOST=0.0.0.0
-e OTR_HTTPPORT=8083 \

I can see by looking in the logs that the container has connected to my broker and has started.

I think I have a similarr issue to #55 but I do not understand how to fix.

All my other containers are accessible via the LAN on the mapped port given in the docker run command.

Permission Denied Problem on OSX

I tried to run the image on OSX, using the latest Docker for Mac, by following instruction written in http://owntracks.org/booklet/clients/recorder/, but kept getting permission denied error from both launcher.sh and generate-CA.sh ( i.e. on chown ).

This is the folder that I created "/Users/wei/Desktop/DEV/owntracks", with ownership "wei:staff".

Please help to assist what to do.

Thank You.

note. just tried to run this on Ubuntu 16.04.1, and it works well.

Environment variable OTR_TOPICS has no effect

When passing the environment variable OTR_TOPICS to the docker container it is not overriding what is written in the recorder.conf file.

$ docker inspect owntracks-recorder
...
"Config": {
            "Env": [
                ...
                "OTR_TOPICS=owntracks/some-user/#",
            ],
}

When looking at the logs of the container it subscribes to the topic defined in the default recorder.conf:

$ docker logs owntracks-recorder
ot-recorder[11]: Subscribing to owntracks/# (qos=2)

And the recorder.conf:

$ cat owntracks-recorder-volume/config/recorder.conf
OTR_TOPICS = "owntracks/#"

Error while deploying with rootless podman

Podman (rootless) was throwing an error while I was trying to deploy owntracks with the official image:

Error: open `.../.local/share/containers/storage/overlay/.../merged/.containerenv`: No such file or directory: OCI runtime attempted to invoke a command that was not found

So I tried to build the image myself but I encountered another error:

$ git clone https://github.com/owntracks/docker-recorder && cd docker-recorder
$ podman build --tag owntracks-local -f ./Dockerfile

[1/2] STEP 1/8: FROM alpine:3.15 AS builder
[1/2] STEP 2/8: ARG RECORDER_VERSION=0.9.0
--> 02aa05d5ece
[1/2] STEP 3/8: RUN apk add --no-cache         make         gcc         git         shadow         musl-dev         curl-dev         libconfig-dev         mosquitto-dev         lmdb-dev         libsodium-dev         lua5.2-dev
error running container: error from /usr/bin/crun creating container for [/bin/sh -c apk add --no-cache         make         gcc         git         shadow         musl-dev         curl-dev         libconfig-dev         mosquitto-dev         lmdb-dev         libsodium-dev         lua5.2-dev]: open `/var/tmp/buildah489432088/mnt/rootfs/resolv.conf`: No such file or directory
: exit status 1
[2/2] STEP 1/13: FROM alpine:3.15
Error: error building at STEP "RUN apk add --no-cache         make         gcc         git         shadow         musl-dev         curl-dev         libconfig-dev         mosquitto-dev         lmdb-dev         libsodium-dev         lua5.2-dev": error while running runtime: exit status 1

I didn't notice anything that could potentially cause this error within the Dockerfile. So I updated the alpine image version to 3.16 and ran the build again, which seems to fix the issue.

$ podman build --tag owntracks-local -f ./Dockerfile

[1/2] STEP 1/8: FROM alpine:3.16 AS builder
Resolved "alpine" as an alias (/etc/containers/registries.conf.d/shortnames.conf)
Trying to pull docker.io/library/alpine:3.16...
Getting image source signatures
Copying blob 2408cc74d12b [--------------------------------------] 0.0b / 0.0b
Copying config e66264b987 done  
Writing manifest to image destination
Storing signatures
[1/2] STEP 2/8: ARG RECORDER_VERSION=0.9.0
--> 64784bf9c3f
[1/2] STEP 3/8: RUN apk add --no-cache         make         gcc         git         shadow         musl-dev         curl-dev         libconfig-dev         mosquitto-dev         lmdb-dev         libsodium-dev         lua5.2-dev
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
(1/41) Installing pkgconf (1.8.0-r0)
(2/41) Installing openssl-dev (1.1.1o-r0)
(3/41) Installing nghttp2-libs (1.47.0-r0)
...
Successfully tagged localhost/owntracks-local:latest

I haven't tested it with Docker, but I'm leaving this in case anyone's using Podman.

Recorder and mqtt client disconnected and not authorised

I'm very frustrated trying to get the docker images working. I've stripped down the images and run mqtt separately from the otrecorder. I can get mqtt running and connect an app on my phone to mqtt without issue using the username I setup. However, if I run otrecorder and point it at the same IP address I get an error that the client is not authorised.

Here are the relevant mqtt logs. You can see the ot-recorder* is disconnected and not authorised. Even though it's using the same settings and username/password combo as the "test" client connecting from 10.100.1.11. I redacted the username.

2022-02-15T04:11:02.124726875Z 1644898262: New connection from 10.1.6.15:44465 on port 1883.
2022-02-15T04:11:02.125608165Z 1644898262: Client ot-recorder-897ffc6baf0a-12 disconnected, not authorised.
2022-02-15T04:13:24.268276982Z 1644898404: New connection from 10.100.1.11:44668 on port 1883.
2022-02-15T04:13:24.360620855Z 1644898404: New client connected from 10.100.1.11:44668 as test (p2, c1, k15, u'<username>').
2022-02-15T04:13:27.294632181Z 1644898407: Client test disconnected.
2022-02-15T04:13:36.641410137Z 1644898416: New connection from 10.1.6.15:44512 on port 1883.
2022-02-15T04:13:36.642553900Z 1644898416: Client ot-recorder-897ffc6baf0a-11 disconnected, not authorised.

I can also set the allow_anonymous to false in the mosquitto.conf file and owntracks can connect, but I don't want to leave it that way. It's not a network issue, both clients are connecting via IP and are not on the localhost (same host as mqtt). It's not a username/password issue, both clients are using the same credentials.

The only thing left is how owntracks is configured to connect and send the client info. And I don't see anything in the documentation that requires that type of setup. How can I possible get this working? What's next to review, config and test it?

How to use a custom acl?

Hi there,
I'm attempting to make changes to the mosquitto.acl file located in the base of this repo but whenever I make a change and run ./run.sh the default acl is used.

What might I need to do to implement a custom acl?

Docker container does not support OpenCage

After having problems with Google Geo API limits I wanted to switch to OpenCage. As far as I can see, the container lacks support for lua-opencage-geocoder. I tried to modify the Dockerfile to get lua-opencage-geocoder installed. I modified the RUN as followed:

RUN apt-get update && \
        apt-get install -y gnupg && \
        apt-key add /tmp/owntracks.gpg.key && \
        apt-get update && \
        apt-get install -y software-properties-common net-tools && \
        apt-add-repository 'deb http://repo.owntracks.org/debian stretch main' && \
        apt-get update && \
        apt-get install -y \
                libmosquitto1 \
                libsodium18 \
                libcurl3 \
                lua5.2 \
                liblua5.2-0 \
                liblua5.2-dev \
                mosquitto \
                mosquitto-clients \
                supervisor \
                ot-recorder \
                curl \
                luarocks \
                && \
        luarocks install lua-opencage-geocoder && \
        apt-get clean && \
        rm -rf /var/lib/apt/lists/*

I also added COPY opencage.lua /usr/local/share/opencage.lua to have the script available inside of the container. The container build shows a warning:

Installing https://luarocks.org/lua-cjson-2.1.0.6-1.src.rock
lua_cjson.c: In function 'json_append_data':
lua_cjson.c:743:19: warning: implicit declaration of function 'lua_objlen' [-Wimplicit-function-declaration]
             len = lua_objlen(l, -1);
                   ^~~~~~~~~~
gcc -O2 -fPIC -I/usr/include/lua5.2 -c lua_cjson.c -o lua_cjson.o
gcc -O2 -fPIC -I/usr/include/lua5.2 -c strbuf.c -o strbuf.o
gcc -O2 -fPIC -I/usr/include/lua5.2 -c fpconv.c -o fpconv.o
gcc -shared -o cjson.so -L/usr/local/lib lua_cjson.o strbuf.o fpconv.o
lua-cjson 2.1.0.6-1 is now installed in /usr/local (license: MIT)

lua-opencage-geocoder 0.1-0 is now installed in /usr/local (license: MIT <http://opensource.org/licenses/MIT>)

But with these modifications Recorder fails:

mosquitto-owntracks    | ot-recorder[37]: initializing Lua hooks from `/usr/local/share/opencage.lua'
mosquitto-owntracks    | ot-recorder[37]: Cannot load Lua from /usr/local/share/opencage.lua: error loading module 'cjson' from file '/usr/local/lib/lua/5.2/cjson.so':
mosquitto-owntracks    |        /usr/local/lib/lua/5.2/cjson.so: undefined symbol: lua_objlen
mosquitto-owntracks    | ot-recorder[37]: Cannot invoke Lua function otr_exit: (null)
mosquitto-owntracks    | ot-recorder[37]: unloading Lua: failed to load script
mosquitto-owntracks    | ot-recorder[37]: Stopping because loading of Lua script /usr/local/share/opencage.lua failed

Any advice how to fix this? I am a bit confused which package requires which version of lua. Is lua 5.1 or 5.2 required? Both choices seem to lead to errors. As of I am not sure which version to choose it might be just the wrong lua version.

Another option might be, that cjson may not be used in the current version, as of it has fixes for a incompatibility between lua 5.1 and 5.2.

ot-recorder should not run as root

We should avoid running binaries as root inside docker containers whenever possible. ot-recorder runs as root by default, but it's possible to run it as another user without changes to the Dockerfile. Maybe an update to the documentation to reflect the instructions above could be helpful for some people out there.

To run as another user, first create a user on the host just for ot-recorder. Resist the temptation of using the existing nobody user. Let's suppose we're using user recorder and group recorder, both with the same uid/gid (10000). The examples below work on a Debian system, but should be similar to most other distros:

export user=recorder
export uid=10000
sudo groupadd -g $uid $user
sudo useradd -c "$user" -d "/nonexistent" -g "$user" --uid $uid -s "/usr/sbin/nologin" $user

Now, create a directory to hold your static data. AFAICT, we can't use docker volumes (without altering the Dockerfile) as docker always mounts those as root:

mkdir /path/to/store/recorder/data
chown recorder:recorder /path/to/store/recorder/data

When running the container with docker run, replace the -v docker_store:/store option with -v /path/to/store/recorder/data:/store and add -u 10000:10000. Note that we need to use the UID/GID of the just user "recorder" on the host. We can't just use the string "recorder" here since this user is not available inside the docker container.

This works, but proper support for non-root users by default inside the Dockerfile would be a better solution.

Latest pull request is forcing TLS.

Pull request #52 is forcing TLS with an internally defined OTR_CAFILE environment variable.

My internal LAN setup does not use TLS to the broker on the same machine, but when I updated to the latest docker TLS is being forced on by an environment variable defined in the Dockerfile.

exec user process caused "exec format error"

When trying to start the docker image I get this error:
standard_init_linux.go:211: exec user process caused "exec format error".

I search around on the internet, most people say it's a problem with the architecture. I tried to run this on mu Raspberry Pi 3+. that should work as far as I know?

Best practice: How to archive data older than 30 days?

Hi everyone,

I've successfully set up owntracks and I like the project quite a lot. The only thing I'm wondering: Is there any way to store data for longer than just the default 30 days? If no, how do others automate archiving their location data?

Update supervisord

Make Image runnable again without supplying any extra variables at runtime see #9

Setting Custom OTR_BROWSERAPIKEY

I have not been able to find a (correct) way to set the OTR_BROWSERAPIKEY variable for ot-recorder while using this Docker setup.

I have tried setting a Docker environment variable like -e OTR_BROWSERAPIKEY='<key>', but that did not work. After a closer look at the docs, it seems like OTR_BROWSERAPIKEY cannot be passed in as an environment variable to ot-recorder, as I've already done with OTR_USER and OTR_PASS.

Is there a preferred method to set this variable I just haven't found? Perhaps during the creation of this container there could be a way to store the ot-recorder.default file outside the container so it's editable, just like was done for mosquitto.conf and the other config and storage files.

Having this Dockerfile (especially the .armhf version for the raspberry pi) was hugely helpful in getting OwnTracks and the recorder setup. Thanks for the work on this!

docker linux/arm64 build

The docker builds in linux/amd64 worked for the Frontend and Recorder and thanks for that.

While testing the ARM ARCH only the owntracks/frontend runs but cannot run the owntracks/recorder container as it does not have a linux/arm64 OS/ARCH with the container log error exec /usr/sbin/entrypoint.sh: exec format error

  • any chance of an official linux/arm64 arch for the owntracks/recorder ?

HEALTHCHECK prevents container starting if "allow_anonymous false" is defined

Hey folks,

When I first deployed OwnTracks, I inadvertently exposed my mosquitto broker to the world, unsecured. I quickly learned the error of my ways (hi, shodan.io!), and locked mosquitto down using allow_anonymous false, and a password_file.

When I recently updated my deployment to the latest docker image, I found that the recorderd container wouldn't fully start, because the HEALTHCHECK command was attempting to make unauthenticated pub/read requests.

Is there a way to avoid this problem? I tried creating a version of the Docker container which would accept environment variables to permit an authenticated healthcheck, but this didn't work, so for now, I've had to disable the healthcheck altogether.

Is there a more elegant way to solve this?

Thanks!
D

http endpoint dead

The http UI works for a hot second- but there is no data in there. Then, browser is unable to connect. The access log is empty.
The log indicates it receives data from devices just fine.

I had the recording running just fine before trying to switch to docker. No idea what's going on here.

ot-recorder[11]: version 0.8.7 starting with STORAGEDIR=/store
ot-recorder[11]: connecting to MQTT on 192.168.1.143:1883 as clientID ot-recorder-d7f6e6647dcd-11 without TLS
ot-recorder[11]: Using access log at /store/httplog/access.log
ot-recorder[11]: HTTP listener started on 127.0.0.1:8083
ot-recorder[11]: Using storage at /store with precision 7
ot-recorder[11]: Subscribing to owntracks/# (qos=2)
* 03:30:48 owntracks/aelius/<redacted>

The owntracks frontend (also in docker) is not getting any data from the recorder
image

Start in HTTP only mode i.e. suppress MQTT connection errors

I am not interested in MQTT functionality- is there a way to supress these errors?

Error: Address not available

ot-recorder[11]: version 0.8.7 starting with STORAGEDIR=/store

ot-recorder[11]: connecting to MQTT on localhost:1883 as clientID ot-recorder-f538fdbc46da-11 without TLS

Error: Address not available

ot-recorder[10]: version 0.8.7 starting with STORAGEDIR=/store

ot-recorder[10]: connecting to MQTT on localhost:1883 as clientID ot-recorder-f538fdbc46da-10 without TLS

Error: Address not available

Docker-compose website doesn't get populated with data

Dear sir, madam,

I've got a question, because it doesn't matter what old solution I try to incorporate, the recorder doesn't seem to "fetch" the data from the MQTT and populate the website with the recording points.

I use Traefik2, but primarily in combination with the frontend website. Which, due to the fact that the recorder doesn't receive any data, also doesn't show any information.

Can someone point me in the right direction? The logs (in Portainer) are also empty, so that's something that I also can't utilize at the moment.

The part of my docker-compose.yml file that I use:

  otrecorder:
    container_name: owntracks_recorder
    image: owntracks/recorder
    entrypoint: ot-recorder --http-host 0.0.0.0 owntracks/#
    restart: unless-stopped
    ports:
      - '8083:8083'
    networks:
      - owntracks_internal
    volumes:
      - ./recorderconfig:/config
      - ./recorderstore:/store
    environment:
      - OTR_HTTPHOST=0.0.0.0
      - OTR_HOST=192.168.1.100
      - OTR_POST=1884
      - OTR_USER=xxx
      - OTR_PASS=xxx
      - OTR_STORAGEDIR=/store
    depends_on:
      - mosquitto

  mosquitto:
    container_name: owntracks_mqtt
    image: eclipse-mosquitto
    ports:
      - 1884:1884
      - 8884:8884
    networks:
      - owntracks_internal
    volumes:
      - ./mqttdata:/mosquitto/data
      - ./mqttlogs:/mosquitto/logs
      - ./mqttconfig:/mosquitto/config
    restart: unless-stopped

volumes:
  recorderstore:
  recorderconfig:
  mqttdata:
  mqttlogs:
  mqttconfig:

networks:
  owntracks_internal:
  traefik2_proxy:
    external: true

Automatic rebuilds

The image rebuilds should be triggered after the debian jessie image changes to have the newest security updates installed

mosquitto.acl

How do you manage the acls? Why is there no way to manage this from a set of environment values or some tooling? Surely I don't have to edit this thing by hand? What's IPLIST and HOSTLIST for?

issues with mqtt docker-compose.yml

Using the docker-compose-mqtt.yml I get the following:

mosquitto_1_56cbab3d2390 | 1550349903: mosquitto version 1.5.6 starting mosquitto_1_56cbab3d2390 | 1550349903: Config loaded from /mosquitto/config/mosquitto.conf. mosquitto_1_56cbab3d2390 | 1550349903: Opening ipv4 listen socket on port 1883. mosquitto_1_56cbab3d2390 | 1550349903: Opening ipv6 listen socket on port 1883. otrecorder_1_f4b165228185 | ot-recorder[7]: version 0.8.3 starting with STORAGEDIR=/store otrecorder_1_f4b165228185 | ot-recorder[7]: connecting to MQTT on localhost:1883 as clientID ot-recorder-81f15eb7bee4-7 without TLS otrecorder_1_f4b165228185 | Error: Address not available owntracks_otrecorder_1_f4b165228185 exited with code 14 owntracks_otrecorder_1_f4b165228185 exited with code 14 owntracks_otrecorder_1_f4b165228185 exited with code 14 owntracks_otrecorder_1_f4b165228185 exited with code 14 owntracks_otrecorder_1_f4b165228185 exited with code 14 owntracks_otrecorder_1_f4b165228185 exited with code 14 owntracks_otrecorder_1_f4b165228185 exited with code 14 owntracks_otrecorder_1_f4b165228185 exited with code 14

Any idea whats wrong?

Why include mosquitto in Docker?

I wanted to run recorderd next to my Mosquitto instance but it seems they are both included in the docker image of recorderd.
Running multiple services in the same container is against Docker standards, the best way to run both is with a docker-compose configuration.

Can you provide a docker image without Mosquitto?

Payload encryption configuration

I am pretty new to docker in general so please excuse my ignorance, but is it possible to use the ocat program to add user:key combinations to be loaded from the config volume? When monitoring logs I get error: 'No decryption key for XXX' when a user publishes encrypted location data

From owntracks/recorder github page:
echo "jjolie-iphone s3cr1t" | ocat --load=keys

Or am I way off base here?

How to add some views ?

I am using this docker (thanks for it!). I would like to use views. In the documentation : It says " htdocs/views/ this path is actually configurable with the --viewsdir option."

When using a docker, is it possible to have a volume for this purpose ? or Is it possible to change the configuration "--viewsdir" with an environnement variable (or the config file recorder.conf) ?

Regards,

Lua script causing container to not boot

Hello,

I want to use this http-to-mqtt-repub.lua script inside owntracks-recorder service.

My docker-compose.yml:

owntracks-recorder:
    image: owntracks/recorder
    container_name: owntracks-recorder
      - ./http-to-mqtt-repub.lua:/http-to-mqtt-repub.lua
    restart: unless-stopped
    environment:
      OTR_HOST: mqtt
      OTR_LUASCRIPT: /http-to-mqtt-repub.lua

This causes the container to keep a Restarting state.

Any ideas what I'm doing wrong?
I can see in Dockerfile that lua5.2-dev is installed.
The http-to-mqtt-repub.lua has 777 chmods.

What am I missing here?

CAFILE can't be opened

recorder version: 0.8.3 (latest Docker image)
OS: Docker on Synology
MQTT broker: mosquitto 1.4.8 on external server/domain with Let's Encrypt certs

I'm running recorder on my Synology NAS using Docker. Everything works fine when I'm not using TLS (ie. over port 1883), but when I configure it to use port 8883 and set an OTR_CAFILE = le-all.pem (using the contents of https://gist.github.com/jpmens/211dbe7904a0efd40e2e590066582ae5), it returns

ot-recorder[7]: cafile configured as `le-all.pem' can't be opened: errno=2

and the Docker container stops.

le-all.pem is in my โ€ฆ/config directory which is mounted as /config, double-checked the permissions, and also tried different file names or paths. Tried setting the option both as Docker env variable and in recorder.conf.

Looking through older issues (esp. relating to LE) I didn't find anything that helped. I've got the feeling that maybe it's just a misinterpretation of the docs on my behalf. Glad to provide any further info that helps resolve this :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.