diff --git a/README.md b/README.md new file mode 100644 index 0000000..2fea0e4 --- /dev/null +++ b/README.md @@ -0,0 +1,222 @@ +# Community Hass.io Add-ons: Traccar + +[![GitHub Release][releases-shield]][releases] +![Project Stage][project-stage-shield] +[![License][license-shield]](LICENSE.md) + +[![GitLab CI][gitlabci-shield]][gitlabci] +![Project Maintenance][maintenance-shield] +[![GitHub Activity][commits-shield]][commits] + +[![Bountysource][bountysource-shield]][bountysource] +[![Discord][discord-shield]][discord] +[![Community Forum][forum-shield]][forum] + +[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee] + +[![Support my work on Patreon][patreon-shield]][patreon] + +Modern GPS Tracking Platform. + +## About + +Lorem ipsum. + +## Installation + +The installation of this add-on is pretty straightforward and not different in +comparison to installing any other Hass.io add-on. + +1. [Add our Hass.io add-ons repository][repository] to your Hass.io instance. +1. Install the "Traccar" add-on. +1. Start the "Traccar" add-on +1. Check the logs of the "Traccar" add-on to see if everything went well. +1. Click the "OPEN WEB UI" button and log in using `admin`/`admin`. +1. Be sure to change the username and password! + +**NOTE**: Do not add this repository to Hass.io, please use: +`https://github.com/hassio-addons/repository`. + +## Docker status + +![Supports armhf Architecture][armhf-shield] +![Supports aarch64 Architecture][aarch64-shield] +![Supports amd64 Architecture][amd64-shield] +![Supports i386 Architecture][i386-shield] + +[![Docker Layers][layers-shield]][microbadger] +[![Docker Pulls][pulls-shield]][dockerhub] + +## Configuration + +**Note**: _Remember to restart the add-on when the configuration is changed._ + +Example add-on configuration: + +```json +{ + "log_level": "info", + "port": 8082, + "ssl": true, + "certfile": "fullchain.pem", + "keyfile": "privkey.pem" +} +``` + +**Note**: _This is just an example, don't copy and past it! Create your own!_ + +### Option: `log_level` + +The `log_level` option controls the level of log output by the addon and can +be changed to be more or less verbose, which might be useful when you are +dealing with an unknown issue. Possible values are: + +- `trace`: Show every detail, like all called internal functions. +- `debug`: Shows detailed debug information. +- `info`: Normal (usually) interesting events. +- `warning`: Exceptional occurrences that are not errors. +- `error`: Runtime errors that do not require immediate action. +- `fatal`: Something went terribly wrong. Add-on becomes unusable. + +Please note that each level automatically includes log messages from a +more severe level, e.g., `debug` also shows `info` messages. By default, +the `log_level` is set to `info`, which is the recommended setting unless +you are troubleshooting. + +### Option: `port` + +The `port` setting allows you to change the port the web interface +Traccar is running on. + +### Option: `ssl` + +Enables/Disables SSL (HTTPS) on the web interface. +Set it `true` to enable it, `false` otherwise. + +### Option: `certfile` + +The certificate file to use for SSL. + +**Note**: _The file MUST be stored in `/ssl/`, which is the default for Hass.io_ + +### Option: `keyfile` + +The private key file to use for SSL. + +**Note**: _The file MUST be stored in `/ssl/`, which is the default for Hass.io_ + +## Changelog & Releases + +This repository keeps a change log using [GitHub's releases][releases] +functionality. The format of the log is based on +[Keep a Changelog][keepchangelog]. + +Releases are based on [Semantic Versioning][semver], and use the format +of ``MAJOR.MINOR.PATCH``. In a nutshell, the version will be incremented +based on the following: + +- ``MAJOR``: Incompatible or major changes. +- ``MINOR``: Backwards-compatible new features and enhancements. +- ``PATCH``: Backwards-compatible bugfixes and package updates. + +## Support + +Got questions? + +You have several options to get them answered: + +- The [Community Hass.io Add-ons Discord chat server][discord] for add-on + support and feature requests. +- The [Home Assistant Discord chat server][discord-ha] for general Home + Assistant discussions and questions. +- The Home Assistant [Community Forum][forum]. +- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit] + +You could also [open an issue here][issue] GitHub. + +## Contributing + +This is an active open-source project. We are always open to people who want to +use the code or contribute to it. + +We have set up a separate document containing our +[contribution guidelines](CONTRIBUTING.md). + +Thank you for being involved! :heart_eyes: + +## Authors & contributors + +The original setup of this repository is by [Franck Nijhof][frenck]. + +For a full list of all authors and contributors, +check [the contributor's page][contributors]. + +## We have got some Hass.io add-ons for you + +Want some more functionality to your Hass.io Home Assistant instance? + +We have created multiple add-ons for Hass.io. For a full list, check out +our [GitHub Repository][repository]. + +## License + +MIT License + +Copyright (c) 2018 Franck Nijhof + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg +[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg +[anchore-shield]: https://anchore.io/service/badges/image/67d1185473090e99d5ac5e1bb4d1aa2295117a9bd3d7abbf8cd8a71e331c8388 +[anchore]: https://anchore.io/image/dockerhub/hassioaddons%2Ftraccar%3Alatest +[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg +[bountysource-shield]: https://img.shields.io/bountysource/team/hassio-addons/activity.svg +[bountysource]: https://www.bountysource.com/teams/hassio-addons/issues +[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg +[buymeacoffee]: https://www.buymeacoffee.com/frenck +[commits-shield]: https://img.shields.io/github/commit-activity/y/hassio-addons/addon-traccar.svg +[commits]: https://github.com/hassio-addons/addon-traccar/commits/master +[contributors]: https://github.com/hassio-addons/addon-traccar/graphs/contributors +[discord-ha]: https://discord.gg/c5DvZ4e +[discord-shield]: https://img.shields.io/discord/478094546522079232.svg +[discord]: https://discord.me/hassioaddons +[dockerhub]: https://hub.docker.com/r/hassioaddons/traccar +[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg +[forum]: https://community.home-assistant.io/t/?u=frenck +[frenck]: https://github.com/frenck +[gitlabci-shield]: https://gitlab.com/hassio-addons/addon-traccar/badges/master/pipeline.svg +[gitlabci]: https://gitlab.com/hassio-addons/addon-traccar/pipelines +[home-assistant]: https://home-assistant.io +[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg +[issue]: https://github.com/hassio-addons/addon-traccar/issues +[keepchangelog]: http://keepachangelog.com/en/1.0.0/ +[layers-shield]: https://images.microbadger.com/badges/image/hassioaddons/traccar.svg +[license-shield]: https://img.shields.io/github/license/hassio-addons/addon-traccar.svg +[maintenance-shield]: https://img.shields.io/maintenance/yes/2018.svg +[microbadger]: https://microbadger.com/images/hassioaddons/traccar +[patreon-shield]: https://www.frenck.nl/images/patreon.png +[patreon]: https://www.patreon.com/frenck +[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg +[pulls-shield]: https://img.shields.io/docker/pulls/hassioaddons/traccar.svg +[reddit]: https://reddit.com/r/homeassistant +[releases-shield]: https://img.shields.io/github/release/hassio-addons/addon-traccar.svg +[releases]: https://github.com/hassio-addons/addon-traccar/releases +[repository]: https://github.com/hassio-addons/repository +[semver]: http://semver.org/spec/v2.0.0.htm diff --git a/traccar/.README.j2 b/traccar/.README.j2 new file mode 100644 index 0000000..cf8717b --- /dev/null +++ b/traccar/.README.j2 @@ -0,0 +1,70 @@ +# Community Hass.io Add-ons: Traccar + +[![Release][release-shield]][release] ![Project Stage][project-stage-shield] ![Project Maintenance][maintenance-shield] + +[![Discord][discord-shield]][discord] [![Community Forum][forum-shield]][forum] + +[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee] + +[![Support my work on Patreon][patreon-shield]][patreon] + +Modern GPS Tracking Platform. + +## About + +Lorem ipsum. + +[Click here for the full documentation][docs] + +{% if channel == "edge" %} +## WARNING! THIS IS AN EDGE VERSION! + +This Hass.io Add-ons repository contains edge builds of add-ons. Edge builds +add-ons are based upon the latest development version. + +- They may not work at all. +- They might stop working at any time. +- They could have a negative impact on your system. + +This repository was created for: + +- Anybody willing to test. +- Anybody interested in trying out upcoming add-ons or add-on features. +- Developers. + +If you are more interested in stable releases of our add-ons: + + + +{% endif %} +{% if channel == "beta" %} +## WARNING! THIS IS A BETA VERSION! + +This Hass.io Add-ons repository contains beta releases of add-ons. + +- They might stop working at any time. +- They could have a negative impact on your system. + +This repository was created for: + +- Anybody willing to test. +- Anybody interested in trying out upcoming add-ons or add-on features. + +If you are more interested in stable releases of our add-ons: + + + +{% endif %} +[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg +[buymeacoffee]: https://www.buymeacoffee.com/frenck +[discord-shield]: https://img.shields.io/discord/478094546522079232.svg +[discord]: https://discord.me/hassioaddons +[docs]: {{ repo }}/blob/{{ version }}/README.md +[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg +[forum]: https://community.home-assistant.io/?u=frenck +[maintenance-shield]: https://img.shields.io/maintenance/yes/2018.svg +[patreon-shield]: https://www.frenck.nl/images/patreon.png +[patreon]: https://www.patreon.com/frenck +[project-stage-shield]: https://img.shields.io/badge/project%20stage-production%20ready-brightgreen.svg +[release-shield]: https://img.shields.io/badge/version-{{ version }}-blue.svg +[release]: {{ repo }}/tree/{{ version }} diff --git a/traccar/Dockerfile b/traccar/Dockerfile new file mode 100755 index 0000000..1b03721 --- /dev/null +++ b/traccar/Dockerfile @@ -0,0 +1,50 @@ +ARG BUILD_FROM=hassioaddons/base:2.3.0 +# hadolint ignore=DL3006 +FROM ${BUILD_FROM} + +# Set shell +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Copy root filesystem +COPY rootfs / + +# Set working dir +WORKDIR /opt/traccar + +# Setup base +RUN \ + apk add --no-cache \ + nginx=1.14.0-r1 \ + openjdk8-jre=8.181.13-r0 \ + \ + && curl -J -L -o /tmp/traccar.zip \ + "https://github.com/traccar/traccar/releases/download/v4.1/traccar-other-4.1.zip" \ + \ + && mkdir -p /opt/traccar \ + && unzip -d /opt/traccar /tmp/traccar.zip \ + \ + && rm -fr /tmp/* + +# Build arugments +ARG BUILD_ARCH +ARG BUILD_DATE +ARG BUILD_REF +ARG BUILD_VERSION + +# Labels +LABEL \ + io.hass.name="Traccar" \ + io.hass.description="Modern GPS Tracking Platform." \ + io.hass.arch="${BUILD_ARCH}" \ + io.hass.type="addon" \ + io.hass.version=${BUILD_VERSION} \ + maintainer="Franck Nijhof " \ + org.label-schema.description="Modern GPS Tracking Platform." \ + org.label-schema.build-date=${BUILD_DATE} \ + org.label-schema.name="Traccar" \ + org.label-schema.schema-version="1.0" \ + org.label-schema.url="https://community.home-assistant.io/?u=frenck" \ + org.label-schema.usage="https://github.com/hassio-addons/addon-traccar/tree/master/README.md" \ + org.label-schema.vcs-ref=${BUILD_REF} \ + org.label-schema.vcs-url="https://github.com/hassio-addons/addon-traccar" \ + org.label-schema.vendor="Community Hass.io Add-ons" diff --git a/traccar/build.json b/traccar/build.json new file mode 100644 index 0000000..13665d0 --- /dev/null +++ b/traccar/build.json @@ -0,0 +1,9 @@ +{ + "build_from": { + "aarch64": "hassioaddons/base-aarch64:2.3.0", + "amd64": "hassioaddons/base-amd64:2.3.0", + "armhf": "hassioaddons/base-armhf:2.3.0", + "i386": "hassioaddons/base-i386:2.3.0" + }, + "args": {} +} diff --git a/traccar/config.json b/traccar/config.json new file mode 100755 index 0000000..73eb47a --- /dev/null +++ b/traccar/config.json @@ -0,0 +1,41 @@ +{ + "name": "Traccar", + "version": "dev", + "slug": "traccar", + "description": "Modern GPS Tracking Platform", + "url": "https://community.home-assistant.io/?u=frenck", + "webui": "[PROTO:ssl]://[HOST]:[PORT:8082]", + "startup": "services", + "arch": [ + "aarch64", + "amd64", + "armhf", + "i386" + ], + "boot": "auto", + "hassio_api": true, + "hassio_role": "default", + "homeassistant_api": false, + "host_network": true, + "map": [ + "config:rw", + "ssl" + ], + "options": { + "log_level": "info", + "port": 8082, + "ssl": true, + "certfile": "fullchain.pem", + "keyfile": "privkey.pem" + }, + "schema": { + "log_level": "match(^(trace|debug|info|notice|warning|error|fatal)$)", + "port": "port", + "ssl": "bool", + "certfile": "str", + "keyfile": "str" + }, + "environment": { + "LOG_FORMAT": "{LEVEL}: {MESSAGE}" + } +} diff --git a/traccar/icon.png b/traccar/icon.png new file mode 100644 index 0000000..10be2c9 Binary files /dev/null and b/traccar/icon.png differ diff --git a/traccar/logo.png b/traccar/logo.png new file mode 100644 index 0000000..0d00ebe Binary files /dev/null and b/traccar/logo.png differ diff --git a/traccar/rootfs/etc/cont-init.d/10-requirements.sh b/traccar/rootfs/etc/cont-init.d/10-requirements.sh new file mode 100644 index 0000000..61e171c --- /dev/null +++ b/traccar/rootfs/etc/cont-init.d/10-requirements.sh @@ -0,0 +1,26 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: Traccar +# This files check if all user configuration requirements are met +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +# Check SSL requirements, if enabled +if hass.config.true 'ssl'; then + if ! hass.config.has_value 'certfile'; then + hass.die 'SSL is enabled, but no certfile was specified' + fi + + if ! hass.config.has_value 'keyfile'; then + hass.die 'SSL is enabled, but no keyfile was specified' + fi + + if ! hass.file_exists "/ssl/$(hass.config.get 'certfile')"; then + hass.die 'The configured certfile is not found' + fi + + if ! hass.file_exists "/ssl/$(hass.config.get 'keyfile')"; then + hass.die 'The configured keyfile is not found' + fi +fi diff --git a/traccar/rootfs/etc/cont-init.d/20-config.sh b/traccar/rootfs/etc/cont-init.d/20-config.sh new file mode 100644 index 0000000..f903313 --- /dev/null +++ b/traccar/rootfs/etc/cont-init.d/20-config.sh @@ -0,0 +1,11 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: Traccar +# Ensures the user configuration file is present +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +if ! hass.file_exists "/config/traccar.xml"; then + cp /etc/traccar/traccar.xml /config/traccar.xml +fi diff --git a/traccar/rootfs/etc/cont-init.d/30-nginx.sh b/traccar/rootfs/etc/cont-init.d/30-nginx.sh new file mode 100644 index 0000000..b4bdf64 --- /dev/null +++ b/traccar/rootfs/etc/cont-init.d/30-nginx.sh @@ -0,0 +1,25 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: Traccar +# Configures NGINX for use with the Traccar server +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +declare certfile +declare keyfile +declare port + +if hass.config.true 'ssl'; then + rm /etc/nginx/nginx.conf + mv /etc/nginx/nginx-ssl.conf /etc/nginx/nginx.conf + + certfile=$(hass.config.get 'certfile') + keyfile=$(hass.config.get 'keyfile') + + sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/nginx.conf + sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/nginx.conf +fi + +port=$(hass.config.get 'port') +sed -i "s/%%port%%/${port}/g" /etc/nginx/nginx.conf diff --git a/traccar/rootfs/etc/nginx/nginx-ssl.conf b/traccar/rootfs/etc/nginx/nginx-ssl.conf new file mode 100644 index 0000000..e5ddb2a --- /dev/null +++ b/traccar/rootfs/etc/nginx/nginx-ssl.conf @@ -0,0 +1,63 @@ +worker_processes 1; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + upstream traccar { + ip_hash; + server 127.0.0.1:18682; + } + + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + server { + server_name hassio.local; + listen %%port%% default_server ssl; + root /dev/null; + + ssl_certificate /ssl/%%certfile%%; + ssl_certificate_key /ssl/%%keyfile%%; + ssl_protocols TLSv1.2; + ssl_prefer_server_ciphers on; + ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA; + ssl_ecdh_curve secp384r1; + ssl_session_timeout 10m; + ssl_session_cache shared:SSL:10m; + ssl_session_tickets off; + ssl_stapling on; + ssl_stapling_verify on; + + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Robots-Tag none; + + location / { + proxy_redirect off; + proxy_pass http://traccar; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $http_host; + proxy_set_header X-NginX-Proxy true; + if ($uri != '/') { + expires 30d; + } + } + } +} diff --git a/traccar/rootfs/etc/nginx/nginx.conf b/traccar/rootfs/etc/nginx/nginx.conf new file mode 100644 index 0000000..e70aaf6 --- /dev/null +++ b/traccar/rootfs/etc/nginx/nginx.conf @@ -0,0 +1,47 @@ +worker_processes 1; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + upstream traccar { + ip_hash; + server 127.0.0.1:18682; + } + + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + server { + server_name hassio.local; + listen %%port%% default_server; + root /dev/null; + + location / { + proxy_redirect off; + proxy_pass http://traccar; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $http_host; + proxy_set_header X-NginX-Proxy true; + if ($uri != '/') { + expires 30d; + } + } + } +} diff --git a/traccar/rootfs/etc/services.d/nginx/finish b/traccar/rootfs/etc/services.d/nginx/finish new file mode 100644 index 0000000..d7057cc --- /dev/null +++ b/traccar/rootfs/etc/services.d/nginx/finish @@ -0,0 +1,9 @@ +#!/usr/bin/execlineb -S0 +# ============================================================================== +# Community Hass.io Add-ons: Traccar +# Take down the S6 supervision tree when Nginx fails +# ============================================================================== +if -n { s6-test $# -ne 0 } +if -n { s6-test ${1} -eq 256 } + +s6-svscanctl -t /var/run/s6/services diff --git a/traccar/rootfs/etc/services.d/nginx/run b/traccar/rootfs/etc/services.d/nginx/run new file mode 100644 index 0000000..5c3ce34 --- /dev/null +++ b/traccar/rootfs/etc/services.d/nginx/run @@ -0,0 +1,9 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: Traccar +# Runs the Nginx daemon +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +exec nginx -g "daemon off;" diff --git a/traccar/rootfs/etc/services.d/traccar/finish b/traccar/rootfs/etc/services.d/traccar/finish new file mode 100644 index 0000000..5465a56 --- /dev/null +++ b/traccar/rootfs/etc/services.d/traccar/finish @@ -0,0 +1,9 @@ +#!/usr/bin/execlineb -S0 +# ============================================================================== +# Community Hass.io Add-ons: Traccar +# Take down the S6 supervision tree when the Traccar daemon fails +# ============================================================================== +if -n { s6-test $# -ne 0 } +if -n { s6-test ${1} -eq 256 } + +s6-svscanctl -t /var/run/s6/services diff --git a/traccar/rootfs/etc/services.d/traccar/run b/traccar/rootfs/etc/services.d/traccar/run new file mode 100644 index 0000000..6dce408 --- /dev/null +++ b/traccar/rootfs/etc/services.d/traccar/run @@ -0,0 +1,26 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: Traccar +# Runs the Traccar daemon +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +declare -a options + +# Memory settings +options+=(-Xms256m) +options+=(-Xmx512m) + +# Prefer IPv4, because of Hassio general issues with IPv6 +options+=("-Djava.net.preferIPv4Stack=true") + +# Run the JAR +options+=(-jar tracker-server.jar) + +# Configuration file +options+=(/config/traccar.xml) + +# Run the Traccar daemon +cd /opt/traccar +exec java "${options[@]}" diff --git a/traccar/rootfs/etc/traccar/hassio.xml b/traccar/rootfs/etc/traccar/hassio.xml new file mode 100644 index 0000000..1fc950e --- /dev/null +++ b/traccar/rootfs/etc/traccar/hassio.xml @@ -0,0 +1,256 @@ + + + + + + + true + 18682 + ./web + 127.0.0.1 + max-age=3600,public + + false + google + + true + info + /dev/stdout + + true + 86400 + + true + true + true + true + + ./media + + web,mail + + true + + true + true + ./schema/changelog-master.xml + org.h2.Driver + jdbc:h2:/data + sa + + + + SELECT * FROM tc_users + WHERE email = :email OR login = :email + + + + SELECT * FROM tc_positions WHERE deviceId = :deviceId AND fixTime BETWEEN :from AND :to ORDER BY fixTime + + + + SELECT tc_positions.* FROM tc_positions INNER JOIN tc_devices ON tc_positions.id = tc_devices.positionid; + + + + UPDATE tc_devices SET positionId = :id WHERE id = :deviceId + + + + SELECT * FROM tc_events WHERE deviceId = :deviceId AND serverTime BETWEEN :from AND :to ORDER BY serverTime + + + + DELETE FROM tc_positions WHERE serverTime < :serverTime AND id NOT IN (SELECT positionId FROM tc_devices WHERE positionId IS NOT NULL) + + + + DELETE FROM tc_events WHERE serverTime < :serverTime + + + + SELECT * FROM tc_statistics WHERE captureTime BETWEEN :from AND :to ORDER BY captureTime + + + 5001 + 5002 + 5003 + 5004 + 5005 + 5006 + false + 5007 + 5008 + 5009 + 5010 + 5011 + 5012 + 5013 + 5014 + 5015 + 5016 + 5017 + 5018 + 5019 + 5020 + 5021 + 5022 + 5023 + 5024 + 5025 + 5026 + 5027 + 5028 + 5029 + 5030 + 5031 + 5032 + 5033 + 5034 + 5035 + 5036 + 5037 + 5038 + 5039 + 5040 + 5041 + 5042 + 5043 + 5044 + 5045 + 5046 + 5047 + 5048 + 5049 + 5050 + 5051 + 5052 + 5053 + 5054 + 5055 + 5056 + 5057 + 5058 + 5059 + 5060 + 5061 + 5062 + 5063 + 5064 + 5065 + 5066 + 5067 + 5068 + 5069 + 5070 + 5071 + 5072 + 5073 + 5074 + 5075 + 5076 + 5077 + 5078 + 5079 + 5080 + 5081 + 5082 + 5083 + 5084 + 5085 + 5086 + 5087 + 5088 + 5089 + 5090 + 5091 + 5092 + 5093 + 5094 + 5095 + 5096 + 5097 + 5098 + 5099 + 5100 + 5101 + 5102 + 5103 + 5104 + 5105 + 5106 + 5107 + 5108 + 5109 + 5110 + 5111 + 5112 + 5113 + 5114 + 5115 + 5116 + 5117 + 5118 + 5119 + 5120 + 5121 + 5122 + 5123 + 5124 + 5125 + 5126 + 5127 + 5128 + 5129 + 5130 + 5131 + 5132 + 5133 + 5134 + 5135 + 5136 + 5137 + 5138 + 5139 + 5140 + 5141 + 5142 + 5143 + 5144 + 5145 + 5146 + 5147 + 5148 + 5149 + 5150 + 5151 + 5152 + 5153 + 5154 + 5155 + 5156 + 5157 + 5158 + 5159 + 5160 + 5161 + 5162 + 5163 + 5164 + 5165 + 5166 + 5167 + 5168 + 5169 + 5170 + 5171 + 5172 + 5173 + 5174 + 5175 + 5176 + 5177 + 5178 + 5179 + + diff --git a/traccar/rootfs/etc/traccar/traccar.xml b/traccar/rootfs/etc/traccar/traccar.xml new file mode 100644 index 0000000..63ddb7e --- /dev/null +++ b/traccar/rootfs/etc/traccar/traccar.xml @@ -0,0 +1,22 @@ + + + + + + + /etc/traccar/hassio.xml + + + + + +