From 40968e258fb4f96e5125adc504589a88a1f4b1b0 Mon Sep 17 00:00:00 2001
From: Nemo <me@captnemo.in>
Date: Sun, 18 Feb 2018 02:16:56 +0530
Subject: [PATCH] Minor updates

---
 README.md                | 15 ++++++++++++---
 docker/couchpotato.tf    | 40 ----------------------------------------
 docker/data.tf           |  4 ----
 docker/images.tf         |  5 -----
 media/daapd.tf           |  2 +-
 media/jackett.tf         | 36 ++++++++++++++++++++++++++++++++++++
 media/ombi.tf            |  2 +-
 media/radarr.tf          |  2 +-
 media/sonarr.tf          |  2 +-
 docker/conf/traefik.toml | 25 +++++++++++++++----------
 10 files changed, 64 insertions(+), 69 deletions(-)

diff --git a/README.md b/README.md
index 7142736..640549e 100644
--- a/README.md
+++ a/README.md
@@ -15,15 +15,20 @@
 
 # modules
 
-1. docker: to actually run the services.
+1. docker: to actually run the services. Catch-all for miscellaneous containers
 2. cloudflare: to manage the DNS.
 3. mysql: to create mysql users and databases.
+4. media: Media related containers (Jackett, Ombi, Radarr, Sonarr, Daapd)
+5. Monitoring: Monitoring related resources (Cadvisor, Grafana, NodeExporter, Prometheus, Transmission-Exporter)
+6. Gitea: Just git.captnemo.in
+7. tt-rss: Tiny-Tiny RSS Web reader
+8. Radicale: CardDav/CalDav webserver
 
 Self-learning project for terraform/docker.
 
 # Planned
 
-1. Setup DigitalOcean
+1. ~Setup DigitalOcean~
 2. Add DO infrastructure via ansible
 3. ~Add traefik for proper proxying~
 4. Maybe add docker swarm (or k8s?) across both the servers. Might setup the k8s API on the Raspberry Pi.
@@ -40,7 +45,9 @@
 ## Media
 
 - [Emby](https://store.docker.com/community/images/emby/embyserver) Media Server
-- [CouchPotato](https://store.docker.com/community/images/linuxserver/couchpotato), auto-download movies
+- ~[CouchPotato](https://store.docker.com/community/images/linuxserver/couchpotato), auto-download movies~
+- [Radarr](https://store.docker.com/community/images/linuxserver/radarr), auto-download movies
+- [Sonarr](https://store.docker.com/community/images/linuxserver/sonarr), auto-download TV Shows
 - [Transmission](https://store.docker.com/community/images/linuxserver/transmission), to download torrents
 - [AirSonic](https://store.docker.com/community/images/airsonic/airsonic), for a music server
 - [Ubooquity](https://store.docker.com/community/images/linuxserver/ubooquity), EBooks server with OPDS support
@@ -58,7 +65,7 @@
 - [Radicale](https://store.docker.com/community/images/tomsquest/docker-radicale), for a CalDav/Carddav server
 - [Gitea](https://store.docker.com/community/images/gitea/gitea), git server
 
-6 out of the above images are from the excellent [LinuxServer.io](https://www.linuxserver.io), and they're doing great work :+1:
+Lots of the above images are from the excellent [LinuxServer.io](https://www.linuxserver.io), and they're doing great work :+1:
 
 ## Security Headers Note
 
diff --git a/docker/couchpotato.tf b/docker/couchpotato.tf
deleted file mode 100644
index f2011c7..0000000 100644
--- a/docker/couchpotato.tf
+++ /dev/null
@@ -1,40 +1,0 @@
-resource "docker_container" "couchpotato" {
-  name  = "couchpotato"
-  image = "${docker_image.couchpotato.latest}"
-
-  volumes {
-    host_path      = "/mnt/xwing/config/couchpotato"
-    container_path = "/config"
-  }
-
-  volumes {
-    host_path      = "/mnt/xwing/media/DL"
-    container_path = "/downloads"
-  }
-
-  volumes {
-    host_path      = "/mnt/xwing/media/Movies"
-    container_path = "/movies"
-  }
-
-  labels = "${merge(
-    local.traefik_common_labels,
-    map(
-      "traefik.frontend.auth.basic", "${var.basic_auth}",
-      "traefik.port", 5050,
-    ))}"
-
-  memory                = 256
-  restart               = "unless-stopped"
-  destroy_grace_seconds = 10
-  must_run              = true
-
-  # Running as lounge:tatooine
-  env = [
-    "PUID=1004",
-    "PGID=1003",
-    "TZ=Asia/Kolkata",
-  ]
-
-  links = ["{docker_container.transmission.name}"]
-}
diff --git a/docker/data.tf b/docker/data.tf
index 37d2827..8a4e1a5 100644
--- a/docker/data.tf
+++ a/docker/data.tf
@@ -16,10 +16,6 @@
   name = "linuxserver/transmission:latest"
 }
 
-data "docker_registry_image" "couchpotato" {
-  name = "linuxserver/couchpotato:latest"
-}
-
 data "docker_registry_image" "traefik" {
   name = "traefik:cancoillotte-alpine"
 }
diff --git a/docker/images.tf b/docker/images.tf
index 65bd4f3..0cc9e9f 100644
--- a/docker/images.tf
+++ a/docker/images.tf
@@ -13,11 +13,6 @@
   pull_triggers = ["${data.docker_registry_image.transmission.sha256_digest}"]
 }
 
-resource "docker_image" "couchpotato" {
-  name          = "${data.docker_registry_image.couchpotato.name}"
-  pull_triggers = ["${data.docker_registry_image.couchpotato.sha256_digest}"]
-}
-
 resource "docker_image" "traefik" {
   name          = "${data.docker_registry_image.traefik.name}"
   pull_triggers = ["${data.docker_registry_image.traefik.sha256_digest}"]
diff --git a/media/daapd.tf b/media/daapd.tf
index 6dee9fb..c92f3b6 100644
--- a/media/daapd.tf
+++ a/media/daapd.tf
@@ -7,7 +7,7 @@
   pull_triggers = ["${data.docker_registry_image.daapd.sha256_digest}"]
 }
 
-resource docker_container "daapd" {
+resource "docker_container" "daapd" {
   name  = "daapd"
   image = "${docker_image.daapd.latest}"
 
diff --git a/media/jackett.tf b/media/jackett.tf
new file mode 100644
index 0000000..30f6adb 100644
--- /dev/null
+++ a/media/jackett.tf
@@ -1,0 +1,36 @@
+data "docker_registry_image" "jackett" {
+  name = "linuxserver/jackett:latest"
+}
+
+resource "docker_image" "jackett" {
+  name          = "${data.docker_registry_image.jackett.name}"
+  pull_triggers = ["${data.docker_registry_image.jackett.sha256_digest}"]
+}
+
+resource docker_container "jackett" {
+  name  = "jackett"
+  image = "${docker_image.jackett.latest}"
+
+  labels = "${merge(
+    var.traefik-labels, map(
+      "traefik.port", 9117,
+      "traefik.frontend.rule","Host:jackett.${var.domain}"
+  ))}"
+
+  restart               = "unless-stopped"
+  destroy_grace_seconds = 10
+  must_run              = true
+
+  volumes {
+    host_path      = "/mnt/xwing/config/jackett"
+    container_path = "/config"
+  }
+
+  env = [
+    "PUID=1004",
+    "PGID=1003",
+    "TZ=Asia/Kolkata",
+  ]
+
+  # links = ["${var.links-emby}"]
+}
diff --git a/media/ombi.tf b/media/ombi.tf
index 18b9972..1c892ac 100644
--- a/media/ombi.tf
+++ a/media/ombi.tf
@@ -14,7 +14,7 @@
   labels = "${merge(
     var.traefik-labels, map(
       "traefik.port", 3579,
-      "traefik.frontend.rule","Host:rey.${var.domain}"
+      "traefik.frontend.rule","Host:ombi.${var.domain}"
   ))}"
 
   restart               = "unless-stopped"
diff --git a/media/radarr.tf b/media/radarr.tf
index c7e9c9d..5b29733 100644
--- a/media/radarr.tf
+++ a/media/radarr.tf
@@ -15,7 +15,7 @@
   labels = "${merge(
     var.traefik-labels, map(
       "traefik.port", 7878,
-      "traefik.frontend.rule","Host:git.${var.domain}"
+      "traefik.frontend.rule","Host:radarr.${var.domain}"
   ))}"
 
   memory                = 512
diff --git a/media/sonarr.tf b/media/sonarr.tf
index d58e411..6e88e32 100644
--- a/media/sonarr.tf
+++ a/media/sonarr.tf
@@ -14,7 +14,7 @@
   labels = "${merge(
     var.traefik-labels, map(
       "traefik.port", 8989,
-      "traefik.frontend.rule","Host:luke.${var.domain}"
+      "traefik.frontend.rule","Host:sonarr.${var.domain}"
   ))}"
 
   memory                = 512
diff --git a/docker/conf/traefik.toml b/docker/conf/traefik.toml
index 63a86c8..cb6a083 100644
--- a/docker/conf/traefik.toml
+++ a/docker/conf/traefik.toml
@@ -73,40 +73,41 @@
 onDemand   = false
 acmelogging = true
 
-# Waiting till Jan '18 to get wildcard SSL on LE
+# Get wildcard once possible
 
 [[acme.domains]]
 main = "bb8.fun"
 sans = [
+  "ads.bb8.fun",
   "airsonic.bb8.fun",
-  "airsonic.in.bb8.fun",
+  "apps.bb8.fun",
   "cadvisor.bb8.fun",
-  "couchpotato.bb8.fun",
   "debug.in.bb8.fun",
-  "ebooks.bb8.fun",
-  "ebooks.in.bb8.fun",
+  "dns.bb8.fun",
   "emby.bb8.fun",
   "emby.in.bb8.fun",
-  "flexget.bb8.fun",
-  "git.bb8.fun",
-  "gitea.bb8.fun",
+  "falcon.bb8.fun",
+  "ghost.bb8.fun",
   "grafana.bb8.fun",
   "headphones.bb8.fun",
   "home.bb8.fun",
-  "home.in.bb8.fun",
+  "info.bb8.fun",
+  "jackett.bb8.fun",
   "library.bb8.fun",
   "luke.bb8.fun",
   "monitoring.bb8.fun",
-  "muximux.bb8.fun",
-  "muximux.in.bb8.fun",
+  "ombi.bb8.fun",
   "pics.bb8.fun",
   "pics.in.bb8.fun",
+  "radarr.bb8.fun",
   "read.bb8.fun",
-  "read.in.bb8.fun",
   "rey.bb8.fun",
   "scan.bb8.fun",
+  "sonarr.bb8.fun",
   "tatooine.bb8.fun",
+  "tie.bb8.fun",
   "traefik.bb8.fun",
   "transmission.bb8.fun",
+  "wifi.bb8.fun",
   "wiki.bb8.fun"
 ]
--
rgit 0.1.5