diff --git a/manuscript/book.txt b/manuscript/book.txt index 7f53c90..e82abab 100644 --- a/manuscript/book.txt +++ b/manuscript/book.txt @@ -25,6 +25,8 @@ recipies/miniflux.md recipies/ghost.md recipies/piwik.md recipies/autopirate.md +recipies/nextcloud.md +recipies/portainer.md sections/reference.md reference/oauth_proxy.md diff --git a/manuscript/images/plex.jpg b/manuscript/images/plex.jpg new file mode 100644 index 0000000..aeb1dcb Binary files /dev/null and b/manuscript/images/plex.jpg differ diff --git a/manuscript/index.md b/manuscript/index.md index e37504e..e2d2179 100644 --- a/manuscript/index.md +++ b/manuscript/index.md @@ -22,6 +22,11 @@ I want your money. No, seriously (_but yes, I do want your money - see below_), If the above applies to you, then you're like me. I want everything I wrote above, so I ended up learning all this as I went along. I enjoy it, and I'm good at it. So I created this website, partly to make sure I documented my own setup properly. +### Get in touch 👋 + +* Tweet me up, I'm [@funkypenguin](https://twitter.com/funkypenguin)! 🐦 +* or better yet, come into the [kitchen](https://discourse.geek-kitchen.funkypenguin.co.nz/) (discussion forums) to say hi, ask a question, or suggest a new recipe! + ### Buy my book 📖 I'm also writing it as a formal book, on Leanpub (https://leanpub.com/geeks-cookbook). Buy it for $0.99 (which is really just a token gesture of support) - you can get it for free (in PDF, mobi, or epub format), or pay me what you think it's worth! diff --git a/manuscript/recipies/home-assistant.md b/manuscript/recipies/home-assistant.md new file mode 100644 index 0000000..12637a8 --- /dev/null +++ b/manuscript/recipies/home-assistant.md @@ -0,0 +1,119 @@ +# 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/owntracks.md b/manuscript/recipies/owntracks.md new file mode 100644 index 0000000..66535e1 --- /dev/null +++ b/manuscript/recipies/owntracks.md @@ -0,0 +1,117 @@ +# 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} +``` + +Note about mosquitto and chosen image: +https://github.com/owntracks/recorderd/issues/14 + +### 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/plex.md b/manuscript/recipies/plex.md new file mode 100644 index 0000000..a5579da --- /dev/null +++ b/manuscript/recipies/plex.md @@ -0,0 +1,101 @@ +hero: A recipe to manage your Media 🎥 📺 🎵 + +# Plex + +Plex is a client-server media player system and software suite comprising two main components (a media server and client applications) + +![Plex Screenshot](../images/plex.jpg) + +## 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. A 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 a directories to bind-mount into our container for Plex to store its library, so create /var/data/plex: + +``` +mkdir /var/data/plex +``` + +### Prepare environment + +Create plex.env, and populate with the following variables. Set PUID and GUID to the UID and GID of the user who owns your media files, on the local filesystem + +``` +EDGE=1 +VERSION=latest +PUID=42 +PGID=42 +``` + +### 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.0" + +services: + plex: + image: linuxserver/plex + env_file: plex.env + volumes: + - /var/data/config/plex:/config + - /var/data/media:/media + deploy: + labels: + - traefik.frontend.rule=Host:plex.example.com + - traefik.docker.network=traefik_public + - traefik.port=32400 + networks: + - traefik_public + - internal + ports: + - 32469:32469 + - 32400:32400 + - 32401:32401 + - 3005:3005 + - 8324:8324 + - 1900:1900/udp + - 32410:32410/udp + - 32412:32412/udp + - 32413:32413/udp + - 32414:32414/udp + +networks: + traefik_public: + external: true + internal: + driver: overlay + ipam: + config: + - subnet: 172.16.16.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 Plex stack + +Launch the Plex stack by running ```docker stack deploy plex -c ``` + +Log into your new instance at https://**YOUR-FQDN** (You'll need to setup a plex.tv login for remote access / discovery to work from certain clients) + +## Chef's Notes + +1. Plex uses port 32400 for remote access, using your plex.tv user/password to authenticate you. The inclusion of the traefik proxy in this recipe is simply to allow you to use the web client (as opposed to a client app) by connecting directly to your instance, as opposed to browsing your media via https://plex.tv/web + +## Your comments? diff --git a/manuscript/reference/networks.md b/manuscript/reference/networks.md index ae06cd5..0fcbbb9 100644 --- a/manuscript/reference/networks.md +++ b/manuscript/reference/networks.md @@ -20,5 +20,8 @@ Network | Range [Autopirate](https://geek-cookbook.funkypenguin.co.nz/recipies/autopirate/) | 172.16.11.0/24 [Nextcloud](https://geek-cookbook.funkypenguin.co.nz/recipies/nextcloud/) | 172.16.12.0/24 [Portainer](https://geek-cookbook.funkypenguin.co.nz/recipies/portainer/) | 172.16.13.0/24 +[Home-Assistant](https://geek-cookbook.funkypenguin.co.nz/recipies/home-assistant/) | 172.16.14.0/24 +[OwnTracks](https://geek-cookbook.funkypenguin.co.nz/recipies/owntracks/) | 172.16.15.0/24 +[Plex](https://geek-cookbook.funkypenguin.co.nz/recipies/plex/) | 172.16.16.0/24 ## Your comments? diff --git a/mkdocs.yml b/mkdocs.yml index 98fa188..acc4263 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -41,6 +41,7 @@ pages: - Gollum: recipies/gollum.md - AutoPirate: recipies/autopirate.md - NextCloud: recipies/nextcloud.md + - Plex: recipies/plex.md - Menu: - Ghost: recipies/ghost.md - GitLab: recipies/gitlab.md