diff --git a/manuscript/CHANGELOG.md b/manuscript/CHANGELOG.md new file mode 100644 index 0000000..8f2461b --- /dev/null +++ b/manuscript/CHANGELOG.md @@ -0,0 +1,17 @@ +# CHANGELOG + +## Subscribe to updates + +[Sign up](http://eepurl.com/dfx95n) (double-opt-in) to receive email updates on new and improve recipes! + +## Recently added recipes + +* [Plex](/recipies/plex/) : Media management and playback platform to **play** all the media you acquired using [AutoPirate](/recipies/autopirate/) :grin: (_21 Dec 2017_) +* [Portainer](/recipies/portainer/) : Sexy management UI for your docker container/swarm (_16 Dec 2017_) +* [NextCloud](/recipies/nextcloud/) : A personal dropbox-style online storage platform with a large ecosystem of 3rd-party apps for Calendaring, Contacts, Document Editing, etc. (_16 Dec 2017_) +* [AutoPirate](/recipies/autopirate/) : A full stack of NZB/Torrent tools for discovering, managing your media. (_12 Dec 2017_) + + +## Recent improvements + +* [Kanboard](/recipies/kanboard/) recipe [improved](https://github.com/funkypenguin/geek-cookbook/commit/8597bcc6319b571c8138cd1b615e8c512e5f5bd5) with the inclusion of a cron container to run automated daily jobs (_22 Dec 2017_) diff --git a/manuscript/images/banner.png b/manuscript/images/banner.png new file mode 100644 index 0000000..81761d2 Binary files /dev/null and b/manuscript/images/banner.png differ diff --git a/manuscript/images/homeassistant.png b/manuscript/images/homeassistant.png new file mode 100644 index 0000000..1305cdd Binary files /dev/null and b/manuscript/images/homeassistant.png differ diff --git a/manuscript/recipies/home-assistant.md b/manuscript/recipies/home-assistant.md deleted file mode 100644 index 12637a8..0000000 --- a/manuscript/recipies/home-assistant.md +++ /dev/null @@ -1,119 +0,0 @@ -# NAME - -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. 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: - -``` -mkdir /var/data/wekan -cd /var/data/wekan -mkdir -p {wekan-db,wekan-db-dump} -``` - -### Websocket support ### - -https://github.com/bitly/oauth2_proxy/pull/486 - - -### Prepare environment - -Create wekan.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 " -``` - -### 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: - - 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 - -networks: - traefik: - external: true - internal: - driver: overlay - ipam: - config: - - subnet: 172.16.3.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. - - - -## 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. - -## Your comments? diff --git a/manuscript/recipies/homeassistant.md b/manuscript/recipies/homeassistant.md new file mode 100644 index 0000000..7f2b028 --- /dev/null +++ b/manuscript/recipies/homeassistant.md @@ -0,0 +1,135 @@ +# Home Assistant + +Home Assistant is a home automation platform written in Python, with extensive support for 3rd-party home-automation platforms including Xaomi, Phillips Hue, and a [bazillion](https://home-assistant.io/components/) others. + +![Home Assistant Screenshot](../images/homeassistant.png) + +This recipie combines the [extensibility](https://home-assistant.io/components/) of [Home Assistant](https://home-assistant.io/) with the flexibility of [InfluxDB](https://docs.influxdata.com/influxdb/v1.4/) (_for time series data store_) and [Grafana](https://grafana.com/) (_for **beautiful** visualisation of that data_). + +## 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/homeassistant: + +``` +mkdir /var/data/homeassistant +cd /var/data/homeassistant +mkdir -p {homeassistant,grafana,influxdb-backup} +``` + +Now create a directory for the influxdb realtime data: + + +``` +mkdir /var/data/runtime/homeassistant/influxdb +``` + +### Prepare environment + +Create /var/data/config/homeassistant/grafana.env, and populate with the following - this is to enable grafana to work with oauth2_proxy without requiring an additional level of authentication: +``` +GF_AUTH_BASIC_ENABLED=false +``` + +### 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: + influxdb: + image: influxdb + networks: + - internal + volumes: + - /var/data/homeassistant/influxdb:/var/lib/influxdb + - /etc/localtime:/etc/localtime:ro + + homeassistant: + image: homeassistant/homeassistant + dns_search: hq.example.com + volumes: + - /var/data/homeassistant/homeassistant:/config + - /etc/localtime:/etc/localtime:ro + deploy: + labels: + - traefik.frontend.rule=Host:homeassistant.example.com + - traefik.docker.network=traefik_public + - traefik.port=8123 + networks: + - traefik_public + - internal + ports: + - 8123:8123 + + grafana-app: + image: grafana/grafana + env_file : /var/data/config/homeassistant/grafana.env + volumes: + - /var/data/homeassistant/grafana:/var/lib/grafana + - /etc/localtime:/etc/localtime:ro + networks: + - internal + + grafana-proxy: + image: zappi/oauth2_proxy + env_file : /var/data/config/homeassistant/grafana.env + dns_search: hq.example.com + networks: + - internal + - traefik_public + deploy: + labels: + - traefik.frontend.rule=Host:grafana.example.com + - traefik.docker.network=traefik_public + - traefik.port=4180 + volumes: + - /var/data/config/homeassistant/authenticated-emails.txt:/authenticated-emails.txt + command: | + -cookie-secure=false + -upstream=http://grafana-app:3000 + -redirect-url=https://grafana.example.com + -http-address=http://0.0.0.0:4180 + -email-domain=example.com + -provider=github + -authenticated-emails-file=/authenticated-emails.txt + +networks: + traefik_public: + external: true + internal: + driver: overlay + ipam: + config: + - subnet: 172.16.13.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. + +## Serving + +### Launch Home Assistant stack + +Launch the Home Assistant stack by running ```docker stack deploy homeassistant -c ``` + +Log into your new instance at https://**YOUR-FQDN**, the password you created in configuration.yml as "frontend - api_key". Then setup a bunch of sensors, and log into https://grafana.**YOUR FQDN** and create some beautiful graphs :) + +## Chef's Notes + +1. I **tried** to protect Home Assistant using [oauth2_proxy](/reference/oauth_proxy), but HA is incompatible with the websockets implementation used by Home Assistant. Until this can be fixed, I suggest that geeks set frontend: api_key to a long and complex string, and rely on this to prevent malevolent internet miscreants from turning their lights on at 2am! + +## Your comments? diff --git a/mkdocs.yml b/mkdocs.yml index 09dc4c3..a1ab4ee 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -23,6 +23,7 @@ pages: - Home : index.md - Introduction: - README: README.md + - CHANGELOG: CHANGELOG.md - whoami: whoami.md - Essential: - Design: ha-docker-swarm/design.md @@ -42,6 +43,7 @@ pages: - AutoPirate: recipies/autopirate.md - NextCloud: recipies/nextcloud.md - Plex: recipies/plex.md + - Home Assistant: recipies/homeassistant.md - Menu: - Ghost: recipies/ghost.md - GitLab: recipies/gitlab.md