{"id":13556209,"url":"https://github.com/owntracks/docker-recorder","last_synced_at":"2025-04-03T09:30:58.308Z","repository":{"id":38383835,"uuid":"50341212","full_name":"owntracks/docker-recorder","owner":"owntracks","description":"Docker image for OwnTracks Recorder","archived":false,"fork":false,"pushed_at":"2024-12-12T07:34:52.000Z","size":106,"stargazers_count":155,"open_issues_count":2,"forks_count":70,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-12-12T08:27:55.583Z","etag":null,"topics":["docker-image","http","mosquitto-broker","mqtt","owntracks","owntracks-recorder","recorder"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/owntracks.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-25T09:47:29.000Z","updated_at":"2024-12-12T07:34:57.000Z","dependencies_parsed_at":"2023-01-29T18:45:29.749Z","dependency_job_id":"d3dae4ab-79e6-4a16-881d-4ba2933034c3","html_url":"https://github.com/owntracks/docker-recorder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owntracks%2Fdocker-recorder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owntracks%2Fdocker-recorder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owntracks%2Fdocker-recorder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owntracks%2Fdocker-recorder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/owntracks","download_url":"https://codeload.github.com/owntracks/docker-recorder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246976159,"owners_count":20863026,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-image","http","mosquitto-broker","mqtt","owntracks","owntracks-recorder","recorder"],"created_at":"2024-08-01T12:03:42.074Z","updated_at":"2025-04-03T09:30:58.295Z","avatar_url":"https://github.com/owntracks.png","language":"Lua","funding_links":[],"categories":["Lua","http"],"sub_categories":[],"readme":"# Dockerfile for OwnTracks Recorder\n\n[![Build Status](https://app.travis-ci.com/owntracks/docker-recorder.svg?branch=master)](https://app.travis-ci.com/github/owntracks/docker-recorder)\n\nDockerfile for the [Recorder](https://github.com/owntracks/recorder) of the\nOwnTracks project. The image is [owntracks/recorder](https://hub.docker.com/r/owntracks/recorder).\n\n## Quickstart\n\n```bash\ndocker volume create recorder_store\ndocker run -d -p 8083:8083 -v recorder_store:/store -e OTR_HOST=mqtt_broker owntracks/recorder\n```\n\nRecorder is now accessible at `http://localhost:8083`.\n\n`-p 8083:8083` makes the container reachable at port 8083. `-d` detaches the\ncontainer into the background. The volume `recorder_store` is mounted at\n`/store` into the container. This is needed to have persistent data storage.\n`-e` allows to pass additional configuration to the container as\nenvironment variables. Multiple `-e` parameters can be used for multiple\nenvironment variables.\n\n## Configuration\n\nThe Recorder can be configured using two methods, environment variables and\nvia the a `recorder.conf` file in the `/config` volume of the container.\n\n### Environment variables\n\nCan be passed to the container with the `-e` parameter. Example:\n\n```bash\ndocker run -d -p 8083:8083 \\\n        -e OTR_HOST=mqtt_broker \\\n        -e OTR_PORT=1883 \\\n        -e OTR_USER=user \\\n        -e OTR_PASS=pass \\\n        owntracks/recorder\n```\n\nThe complete list of parameters can be found in the [recorder\ndocumentation](https://github.com/owntracks/recorder/blob/master/README.md#configuration-file).\n\n### Configuration file\n\nOne can also use a configuration file. The container reads a `recorder.conf`\nfile from the `/config` folder. To use this, create a folder e.g. `./config` and\nmount it into you docker container at `/config`.\n\n```bash\nmkdir config\ndocker run -d -p 8083:8083 -v recorder_store:/store -v ./config:/config owntracks/recorder\n```\n\nUp on starting the recorder, default `recorder.conf` settings are used if no file exists. Possible options are documented [here](https://github.com/owntracks/recorder/blob/master/README.md#configuration-file).\n\n**Notes:**\n\n- The value of `OTR_HOST` is as seen from the container. Thus `localhost` refers to\nthe container not the host and should likely not be used.\n- Environment variables, overwrite the `recorder.conf` file options.\n- The shell like style of the`recorder.conf` file needs `\"\"` encapsulated\nvariable values.\n\n## Storing data\n\nThe `/store` volume of the container is used for persistent storage of location\ndata. The volume needs to be created explicitly.\n\n```bash\ndocker volume create recorder_storage\ndocker run -d -p 8083:8083 -v recorder_store:/store owntracks/recorder\n```\n\nIt is also possible to use a local folder instead of an static docker volume.\n\n```bash\nmkdir store\ndocker run -d -p 8083:8083 -v ./store:/store owntracks/recorder\n```\n\nIf nothing is mounted at `/store`, docker will create a unique volume\nautomatically. However up on recreation of the docker container, this process\nwill be repeated and another unique volume will be created. As a result, the\ncontainer will have forgotten about previous tracks.\n\n## TLS between MQTT broker and recorder\n\nThe `OTR_CAPATH` of the container defaults to the `/config` volume. Thus\ncertificates and key files belong into the `/config` volume. `OTR_CAFILE` must be configured for TLS.\n\n`OTR_CERTFILE` defaults to `cert.pem` and `OTR_KEYFILE` to `key.pem`. These files are optional and the options are ignored if the files don't exist.\n\n## TLS encryption via reverse proxy\n\nThe Recorder has no encryption module by it self. Instead use a reverse proxy\nsetup. See https://github.com/jwilder/nginx-proxy for how to do this in a semi\nautomatic way with docker containers and\nhttps://github.com/owntracks/recorder#reverse-proxy for Recorder specific\ndetails.\n\n## Docker compose files\n\nSave a file with the name [docker-compose.yml](docker-compose.yml) and following content.\nRun with `docker-compose up` from the same folder.\n\n```yaml\nversion: '3'\n\nservices:\n\n  otrecorder:\n    image: owntracks/recorder\n    ports:\n      - 8083:8083\n    volumes:\n      - config:/config\n      - store:/store\n    restart: unless-stopped\n\nvolumes:\n  store:\n  config:\n```\n\nThis [docker-compose.yml](docker-compose.yml) file creates `store` and `config` volumes. It is\npossible to edit the `recorder.conf` file in the `config` volume to get the\nsystem up and running. It is also possible to pass environment variables to the\ndocker container via the `environment:` keyword. For details see\n[here](https://docs.docker.com/compose/environment-variables/) and for available\nvariables see\n[here](https://github.com/owntracks/recorder/blob/master/README.md#configuration-file).\n\nAn example might look like:\n\n```yaml\nservices:\n\n  otrecorder:\n    image: owntracks/recorder\n    ports:\n      - 8083:8083\n    volumes:\n      - store:/store\n    restart: unless-stopped\n    environment:\n      OTR_HOST: \"mqtt_broker\"\n      OTR_USER: \"user\"\n      OTR_PASS: \"pass\"\n\nvolumes:\n  store:\n```\n\n### With MQTT broker\n\nIf you need to set up an MQTT broker, you can easily use, say, Mosquitto. There are ready to use\ncontainers available on docker hub. To use `eclipse-mosquitto` add something like [the following](docker-compose-mqtt.yml) to your `docker-compose.yml` file.\n\n```yaml\nservices:\n\n  otrecorder:\n    image: owntracks/recorder\n    ports:\n      - 8083:8083\n    volumes:\n      - config:/config\n      - store:/store\n    restart: unless-stopped\n\n  mosquitto:\n    image: eclipse-mosquitto\n    ports:\n      - 1883:1883\n      - 8883:8883\n    volumes:\n      - mosquitto-data:/mosquitto/data\n      - mosquitto-logs:/mosquitto/logs\n      - mosquitto-conf:/mosquitto/config\n    restart: unless-stopped\n\nvolumes:\n  store:\n  config:\n  mosquitto-data:\n  mosquitto-logs:\n  mosquitto-conf:\n```\n\nSee [here](https://hub.docker.com/_/eclipse-mosquitto) for info on the eclipse-mosquitto image and how to configure it.\n\n### All in one solution with reverse proxy and Let's Encrypt\n\nThere are some caveats people seem to step into:\n\n1. mosquitto starts only if the cert files referenced in the configuration are\n   accessible. Therefore for a successful retrieval from Let's encrypt by the\n   ACME companion those lines in the configuration have to be commented out.\n   In order to test things start unencrypted first. \n\n2. The example documentation to create a password include `-c` as command line\n   switch. Be sure only to use this if you **want** to overwrite that password\n   file.\n\n3. In order to make ot-recorder talk SSL \u0026 accept Let's encrypt certificates a\n   kind of concatenated\n   [le-ca.pem](https://gist.github.com/jpmens/211dbe7904a0efd40e2e590066582ae5)\n   is needed. A [thread](https://github.com/owntracks/recorder/issues/193) in\n   an issue is discussing this in detail. In the example below this file is\n   downloaded as `ca.pem`. \n\n4. nginx-proxy allows basic auth. For that one needs to put a file name after\n   the virtual host, e.g. `owntrack.domain.com` in the **folder**\n   `/etc/nginx/htpasswd`\n\n```yaml\n\nversion: '2'\n\nservices:\n  nginx-proxy:\n    image: nginxproxy/nginx-proxy:alpine\n    container_name: nginx\n    ports:\n      - 80:80\n      - 443:443\n    volumes:\n      - ./proxy/conf.d:/etc/nginx/conf.d\n      - ./proxy/proxy.conf:/etc/nginx/proxy.conf\n      - ./proxy/vhost.d:/etc/nginx/vhost.d\n      - ./proxy/html:/usr/share/nginx/html\n      - ./proxy/certs:/etc/nginx/certs:ro\n      - ./proxy/htpasswd:/etc/nginx/htpasswd:ro\n      - /var/run/docker.sock:/tmp/docker.sock:ro\n      - acme:/etc/acme.sh\n    networks:\n      - proxy-tier\n\n  letsencrypt-nginx-proxy-companion:\n    image: nginxproxy/acme-companion\n    container_name: letsencrypt-companion\n    depends_on: [nginx]\n    volumes_from:\n      - nginx-proxy\n    volumes:\n      - /var/run/docker.sock:/var/run/docker.sock:ro\n      - ./proxy/certs:/etc/nginx/certs:rw\n      - acme:/etc/acme.sh\n    #environment:\n      #- ACME_CA_URI=https://acme-staging-v02.api.letsencrypt.org/directory\n      #User above line for testing the setup \n\n  otrecorder:\n    image: owntracks/recorder\n    restart: unless-stopped\n    environment:\n      - VIRTUAL_HOST=owntracks.domain.com\n      - VIRTUAL_PORT=8083\n      - LETSENCRYPT_HOST=owntracks.domain.com\n      - LETSENCRYPT_EMAIL=joe.doe@domain.com\n      - PUID=1000\n      - PGID=1000\n      - TZ=Europe/Berlin\n      - OTR_USER=\"user\"\n      - OTR_PASS=\"password\"\n      - OTR_HOST=mqtt.domain.com\n      - OTR_PORT=8883\n      - OTR_CAFILE=/config/ca.pem\n      #content of the file above from https://gist.github.com/jpmens/211dbe7904a0efd40e2e590066582ae5\n      #which is 6 certificates in one file. !!!This turns out to be important!!!\n    volumes:\n      - ./owntracks/config:/config\n      - ./owntracks/store:/store\n      - ./proxy/certs:/etc/letsencrypt/live:ro #probably this line is not needed\n    networks:\n      - proxy-tier\n  \n  mqtt:\n    container_name: mqtt\n    image: eclipse-mosquitto\n    environment:\n      - VIRTUAL_HOST=mqtt.domain.com\n      - LETSENCRYPT_HOST=mqtt.domain.com\n      - LETSENCRYPT_EMAIL=joe.doe@domain.com\n      - PUID=1000\n      - PGID=1000\n      - TZ=Europe/Berlin\n    ports:\n      - 1883:1883\n      - 8883:8883\n      - 8083:8083\n    volumes:\n      - ./mosquitto/data:/mosquitto/data\n      - ./mosquitto/logs:/mosquitto/logs\n      - ./mosquitto/conf:/mosquitto/config\n      - ./mosquitto/conf/passwd:/etc/mosquitto/passwd\n      - ./proxy/certs:/etc/letsencrypt/live:ro\n    restart: unless-stopped\n\nvolumes:\n  acme:\nnetworks:\n  proxy-tier:\n    external:\n      name: nginx-proxy\n```\n\na minimal mosquitto.conf which can act as a start:\n\n```\nallow_anonymous false\npassword_file /etc/mosquitto/passwd\n#use mosquitto_passwd inside container to populate the passwd file\n\n#listener 1883 \n#socket_domain ipv4\n#uncomment 2 lines above for first run so we get LE certificates. \n#at the same time comment out all lines below. Once you have the certificate\n#stop the unencrypted listener\n\nlistener 8883\ncertfile /etc/letsencrypt/live/mqtt.domain.com/cert.pem\ncafile /etc/letsencrypt/live/mqtt.domain.com/chain.pem\nkeyfile /etc/letsencrypt/live/mqtt.domain.com/key.pem\n\nlistener 8083\nprotocol websockets\ncertfile /etc/letsencrypt/live/mqtt.domain.com/cert.pem\ncafile /etc/letsencrypt/live/mqtt.domain.com/chain.pem\nkeyfile /etc/letsencrypt/live/mqtt.domain.com/key.pem \n```\n\n \n## Healthcheck\n\nThe Recorder container can perform a Docker-style `HEALTHCHECK` on itself by\nperiodically running `recorder-health.sh` on itself if enabled during build.\nThis program POSTS a `_type: location` JSON message to itself over HTTP to the\nping-ping endpoint and verifies via the HTTP API whether the message was\nreceived.\n\n## Possible enhancements\n\n- Maybe put the most common Mosquitto options in the section which uses an MQTT broker in the docker-compose file\n\n## Credits\n\n- [JSON.lua](http://regex.info/blog/lua/json), by Jeffrey Friedl. [LICENSE](https://creativecommons.org/licenses/by/3.0/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowntracks%2Fdocker-recorder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fowntracks%2Fdocker-recorder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowntracks%2Fdocker-recorder/lists"}