diff --git a/manuscript/CHANGELOG.md b/manuscript/CHANGELOG.md index c2ed869..9245127 100644 --- a/manuscript/CHANGELOG.md +++ b/manuscript/CHANGELOG.md @@ -6,6 +6,7 @@ Sign up [here](http://eepurl.com/dfx95n) (double-opt-in) to receive email update ## Recently added recipes +* Added [OwnTracks](/recipies/owntracks/), personal mobile location platform (_17 Jun 2018_) * Added [NZBHydra2](/recipies/autopirate/nzbhydra2/) to [autopirate](/recipies/autopirate/start/) stack (_9 Jun 2018_) * Added a list of [sponsored projects](sponsored-projects/) which I regularly donate to, to keep the geeky ingredients fresh! (_8 Jun 2018_) * [Turtle Pool](/recipies/turtle-pool/) - A mining pool for the fun, friendly, no-BS, still-in-its-infancy cryptocurrency, "[TurtleCoin](http://turtlecoin.lol)" (_7 May 2018_) diff --git a/manuscript/recipies/munin.md b/manuscript/recipies/munin.md new file mode 100644 index 0000000..ec1b71a --- /dev/null +++ b/manuscript/recipies/munin.md @@ -0,0 +1,142 @@ +hero: Heroic Hero + +# Munin + +Intro + +![NAME Screenshot](../images/name.jpg) + +Details + +## 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. 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/munin: + +``` +mkdir /var/data/munin +cd /var/data/munin +mkdir -p {log,lib,run,cache} +``` + +### Prepare environment + +Create /var/data/config/munin/munin.env, and populate with the following variables +``` +OAUTH2_PROXY_CLIENT_ID= +OAUTH2_PROXY_CLIENT_SECRET= +OAUTH2_PROXY_COOKIE_SECRET= + +MUNIN_USER=odin +MUNIN_PASSWORD=lokiisadopted +SMTP_HOST=smtp.example.com +SMTP_PORT=587 +SMTP_USERNAME=smtp-username +SMTP_PASSWORD=smtp-password +SMTP_USE_TLS=false +SMTP_ALWAYS_SEND=false +SMTP_MESSAGE='[${var:group};${var:host}] -> ${var:graph_title} -> warnings: ${loop<,>:wfields ${var:label}=${var:value}} / criticals: ${loop<,>:cfields ${var:label}=${var:value}}' +ALERT_RECIPIENT=monitoring@example.com +ALERT_SENDER=alerts@example.com +NODES="node1:10.20.30.1 node2:10.20.30.22 node3:10.20.30.23" +SNMP_NODES="router1:10.0.0.254:9999" +``` + +### Setup Docker Swarm + +Create a docker swarm config file in docker-compose syntax (v3), something like this: + +!!! tip + I share (_with my [patreon patrons](https://www.patreon.com/funkypenguin)_) a private "_premix_" git repository, which includes necessary docker-compose and env files for all published recipes. This means that patrons can launch any recipe with just a ```git pull``` and a ```docker stack deploy``` 👍 + + +``` +version: '3' + +services: + + munin: + image: funkypenguin/munin-server + env_file: /var/data/config/munin/munin.env + networks: + - internal + volumes: + - /var/data/munin/log:/var/log/munin + - /var/data/munin/lib:/var/lib/munin + - /var/data/munin/run:/var/run/munin + - /var/data/munin/cache:/var/cache/munin + + proxy: + image: zappi/oauth2_proxy + env_file: /var/data/config/munin/munin.env + networks: + - traefik + - internal + deploy: + labels: + - traefik.frontend.rule=Host:munin.example.com + - traefik.docker.network=traefik + - traefik.port=4180 + command: | + -cookie-secure=false + -upstream=http://munin:8080 + -redirect-url=https://munin.example.com + -http-address=http://0.0.0.0:4180 + -email-domain=example.com + -provider=github + +networks: + traefik: + external: true + internal: + driver: overlay + ipam: + config: + - subnet: 172.16.20.0/24 +``` + +!!! note + Setup unique static subnets for every stack you deploy. This avoids IP/gateway conflicts which can otherwise occur when you're creating/removing stacks a lot. See [my list](/reference/networks/) here. + +## Node + +``` +docker stop munin-node +docker rm munin-node +docker run -d --name munin-node --restart=always \ + --privileged --net=host \ + -v /:/rootfs:ro \ + -v /sys:/sys:ro \ + -e ALLOW="cidr_allow 0.0.0.0/0" \ + -p 4949:4949 \ + --restart=always \ + funkypenguin/munin-node +``` + + + + +## Serving + +### Launch Wekan stack + +Launch the Wekan stack by running ```docker stack deploy wekan -c ``` + +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. + +### Tip your waiter (donate) 👏 + +Did you receive excellent service? Want to make your waiter happy? (_..and support development of current and future recipes!_) See the [support](/support/) page for (_free or paid)_ ways to say thank you! 👏 + +### Your comments? 💬 diff --git a/manuscript/recipies/owntracks.md b/manuscript/recipies/owntracks.md index 4ccd4df..498961f 100644 --- a/manuscript/recipies/owntracks.md +++ b/manuscript/recipies/owntracks.md @@ -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. -![NAME Screenshot](../images/name.jpg) +![OwnTracks Screenshot](../images/owntracks.png) -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 " + +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 ``` +Launch the OwnTracks stack by running ```docker stack deploy owntracks -c ``` 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) 👏 diff --git a/manuscript/reference/networks.md b/manuscript/reference/networks.md index ab8d635..e8f1c8b 100644 --- a/manuscript/reference/networks.md +++ b/manuscript/reference/networks.md @@ -29,6 +29,7 @@ Network | Range [Turtle Pool](https://geek-cookbook.funkypenguin.co.nz/recipies/turtle-pool/) | 172.16.21.0/24 [MiniFlux](https://geek-cookbook.funkypenguin.co.nz/recipies/miniflux/) | 172.16.22.0/24 [Gitlab Runner](https://geek-cookbook.funkypenguin.co.nz/recipies/gitlab-runner/) | 172.16.23.0/24 +[Munin](https://geek-cookbook.funkypenguin.co.nz/recipies/munin/) | 172.16.24.0/24 ## Chef's Notes diff --git a/mkdocs.yml b/mkdocs.yml index 27359bd..56847de 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -51,7 +51,7 @@ pages: - Lazy Librarian: recipies/autopirate/lazylibrarian.md - Headphones: recipies/autopirate/headphones.md - NZBHydra: recipies/autopirate/nzbhydra.md - - NZBHydra 2: recipies/autopirate/nzbhydra2.md + - NZBHydra 2: recipies/autopirate/nzbhydra2.md - Ombi: recipies/autopirate/ombi.md - Jackett: recipies/autopirate/jackett.md - End: recipies/autopirate/end.md @@ -59,6 +59,7 @@ pages: - Plex: recipies/plex.md - Emby: recipies/emby.md - Home Assistant: recipies/homeassistant.md + - OwnTracks: recipies/owntracks.md - CryptoMiner: - Start: recipies/cryptominer.md - Mining Rig: recipies/cryptominer/mining-rig.md @@ -92,7 +93,7 @@ pages: - OpenVPN : reference/openvpn.md - Troubleshooting: reference/troubleshooting.md - Support: support.md - - Sponsored Projects: sponsored-projects.md + - Sponsored Projects: sponsored-projects.md theme: name: 'material'