mirror of
https://github.com/funkypenguin/geek-cookbook/
synced 2026-11-02 13:58:18 +00:00
Add Owntracks
This commit is contained in:
1 parent
6b7d11fc44
commit
2f6917cafc
5 files changed
+204
-58
No files matched your search
@@ -1,43 +1,43 @@
|
||||
# NAME
|
||||
# OwnTracks
|
||||
|
||||
Intro
|
||||
[OwnTracks](https://owntracks.org/) 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.
|
||||
|
||||

|
||||

|
||||
|
||||
Details
|
||||
Using a smartphone app, OwnTracks allows you to collect and analyse your own location data **without** sharing this data with a cloud provider (_i.e. Apple, Google_). Potential use cases are:
|
||||
|
||||
* Sharing family locations without relying on Apple Find-My-friends
|
||||
* Performing automated actions in [HomeAssistant](/recipies/homeassistant/) when you arrive/leave home
|
||||
|
||||
## Ingredients
|
||||
|
||||
1. [Docker swarm cluster](/ha-docker-swarm/design/) with [persistent shared storage](/ha-docker-swarm/shared-storage-ceph.md)
|
||||
2. [Traefik](/ha-docker-swarm/traefik) configured per design
|
||||
3. 3. DNS entry for the hostname you intend to use, pointed to your [keepalived](ha-docker-swarm/keepalived/) IP
|
||||
3. DNS entry for the hostname you intend to use, pointed to your [keepalived](ha-docker-swarm/keepalived/) IP
|
||||
|
||||
## Preparation
|
||||
|
||||
### Setup data locations
|
||||
|
||||
We'll need several directories to bind-mount into our container, so create them in /var/data/wekan:
|
||||
We'll need a directory so store OwnTracks' data , so create ```/var/data/owntracks```:
|
||||
|
||||
```
|
||||
mkdir /var/data/wekan
|
||||
cd /var/data/wekan
|
||||
mkdir -p {wekan-db,wekan-db-dump}
|
||||
mkdir /var/data/owntracks
|
||||
```
|
||||
|
||||
Note about mosquitto and chosen image:
|
||||
https://github.com/owntracks/recorderd/issues/14
|
||||
|
||||
### Prepare environment
|
||||
|
||||
Create wekan.env, and populate with the following variables
|
||||
Create owntracks.env, and populate with the following variables
|
||||
|
||||
```
|
||||
OAUTH2_PROXY_CLIENT_ID=
|
||||
OAUTH2_PROXY_CLIENT_SECRET=
|
||||
OAUTH2_PROXY_COOKIE_SECRET=
|
||||
MONGO_URL=mongodb://wekandb:27017/wekan
|
||||
ROOT_URL=https://wekan.example.com
|
||||
MAIL_URL=smtp://wekan@wekan.example.com:password@mail.example.com:587/
|
||||
MAIL_FROM="Wekan <wekan@wekan.example.com>"
|
||||
|
||||
OTR_USER=recorder
|
||||
OTR_PASSWD=yourpassword
|
||||
MQTTHOSTNAME=owntracks.example.com
|
||||
HOSTLIST=owntracks.example.com
|
||||
```
|
||||
|
||||
### Setup Docker Swarm
|
||||
@@ -49,52 +49,51 @@ Create a docker swarm config file in docker-compose syntax (v3), something like
|
||||
|
||||
|
||||
```
|
||||
version: '3'
|
||||
version: "3.0"
|
||||
|
||||
services:
|
||||
owntracks-app:
|
||||
image: funkypenguin/owntracks
|
||||
env_file : /var/data/config/owntracks/owntracks.env
|
||||
volumes:
|
||||
- /var/data/owntracks:/owntracks
|
||||
networks:
|
||||
- internal
|
||||
ports:
|
||||
- 1883:1883
|
||||
- 8883:8883
|
||||
- 8083:8083
|
||||
|
||||
wekandb:
|
||||
image: mongo:3.2.15
|
||||
command: mongod --smallfiles --oplogSize 128
|
||||
networks:
|
||||
- internal
|
||||
volumes:
|
||||
- /var/data/wekan/wekan-db:/data/db
|
||||
- /var/data/wekan/wekan-db-dump:/dump
|
||||
|
||||
proxy:
|
||||
image: zappi/oauth2_proxy
|
||||
env_file: /var/data/wekan/wekan.env
|
||||
networks:
|
||||
- traefik
|
||||
- internal
|
||||
deploy:
|
||||
labels:
|
||||
- traefik.frontend.rule=Host:wekan.example.com
|
||||
- traefik.docker.network=traefik
|
||||
- traefik.port=4180
|
||||
command: |
|
||||
-cookie-secure=false
|
||||
-upstream=http://wekan:80
|
||||
-redirect-url=https://wekan.example.com
|
||||
-http-address=http://0.0.0.0:4180
|
||||
-email-domain=example.com
|
||||
-provider=github
|
||||
|
||||
wekan:
|
||||
image: wekanteam/wekan:latest
|
||||
networks:
|
||||
- internal
|
||||
env_file: /var/data/wekan/wekan.env
|
||||
owntracks-proxy:
|
||||
image: zappi/oauth2_proxy
|
||||
env_file : /var/data/config/owntracks/owntracks.env
|
||||
networks:
|
||||
- internal
|
||||
- traefik_public
|
||||
deploy:
|
||||
labels:
|
||||
- traefik.frontend.rule=Host:owntracks.example.com
|
||||
- traefik.docker.network=traefik_public
|
||||
- traefik.port=4180
|
||||
volumes:
|
||||
- /var/data/config/owntracks/authenticated-emails.txt:/authenticated-emails.txt
|
||||
command: |
|
||||
-cookie-secure=false
|
||||
-upstream=http://owntracks-app:8083
|
||||
-redirect-url=https://owntracks.example.com
|
||||
-http-address=http://0.0.0.0:4180
|
||||
-email-domain=example.com
|
||||
-provider=github
|
||||
-authenticated-emails-file=/authenticated-emails.txt
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
traefik_public:
|
||||
external: true
|
||||
internal:
|
||||
driver: overlay
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.16.3.0/24
|
||||
- subnet: 172.16.15.0/24
|
||||
```
|
||||
|
||||
!!! note
|
||||
@@ -104,15 +103,17 @@ networks:
|
||||
|
||||
## Serving
|
||||
|
||||
### Launch Wekan stack
|
||||
### Launch OwnTracks stack
|
||||
|
||||
Launch the Wekan stack by running ```docker stack deploy wekan -c <path -to-docker-compose.yml>```
|
||||
Launch the OwnTracks stack by running ```docker stack deploy owntracks -c <path -to-docker-compose.yml>```
|
||||
|
||||
Log into your new instance at https://**YOUR-FQDN**, with user "root" and the password you specified in gitlab.env.
|
||||
|
||||
## Chef's Notes
|
||||
|
||||
1. If you wanted to expose the Wekan UI directly, you could remove the oauth2_proxy from the design, and move the traefik-related labels directly to the wekan container. You'd also need to add the traefik network to the wekan container.
|
||||
1. If you wanted to expose the OwnTracks Web UI directly, you could remove the oauth2_proxy from the design, and move the traefik-related labels directly to the wekan container. You'd also need to add the traefik network to the owntracks container.
|
||||
2. I'm using my own image rather than owntracks/recorderd, because of a [potentially swarm-breaking bug](https://github.com/owntracks/recorderd/issues/14) I found in the official container. If this gets resolved (_or if I was mistaken_) I'll update the recipe accordingly.
|
||||
3. By default, you'll get a fully accessible, unprotected MQTT broker. This may not be suitable for public exposure, so you'll want to look into securing mosquitto with TLS and ACLs.
|
||||
|
||||
### Tip your waiter (donate) 👏
|
||||
|
||||
|
||||
Reference in new issue
Block a user