From 735279b0c1093c0a3e7c0e5a4890ca967ec67029 Mon Sep 17 00:00:00 2001
From: Nemo <me@captnemo.in>
Date: Wed, 29 Jul 2020 22:49:35 +0530
Subject: [PATCH] Cleanup and comment unused stuff

---
 firefox-sync.tf                  |   5 +++++
 rss-bridge.tf                    |   2 +-
 stringer.tf                      |  10 +++++-----
 variables.tf                     |   2 +-
 docker/images.tf                 |   8 ++++----
 gitea/data.tf                    |   2 +-
 media/airsonic.tf                | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------
 media/bazarr.tf                  |  68 +++++++++++++++++++++++++++++++++++++++-----------------------------
 media/gonic.tf                   |  60 +++++++++++++++++++++++++++++++++++-------------------------
 media/jellyfin.tf                |  48 +-----------------------------------------------
 media/mylar.tf                   |  62 +++++++++++++++++++++++++++++++++++---------------------------
 monitoring/config/prometheus.yml |   6 +++---
 12 files changed, 181 insertions(+), 220 deletions(-)

diff --git a/firefox-sync.tf b/firefox-sync.tf
index 10eac08..5eb18e2 100644
--- a/firefox-sync.tf
+++ a/firefox-sync.tf
@@ -10,6 +10,11 @@
     host   = "firesync.${var.root-domain}"
   }
 
+  resource {
+    memory      = "400"
+    memory_swap = "400"
+  }
+
   volumes = [{
     host_path      = "/mnt/xwing/data/firefox-sync"
     container_path = "/data"
diff --git a/rss-bridge.tf b/rss-bridge.tf
index cd2824e..226b114 100644
--- a/rss-bridge.tf
+++ a/rss-bridge.tf
@@ -1,8 +1,8 @@
 module "rss-bridge" {
   name   = "rss-bridge"
   source = "modules/container"
 
-  image = "rssbridge/rss-bridge:latest"
+  image = "captn3m0/rss-bridge:develop"
 
   resource {
     memory      = 256
diff --git a/stringer.tf b/stringer.tf
index 081a96f..28e1019 100644
--- a/stringer.tf
+++ a/stringer.tf
@@ -1,8 +1,8 @@
-module "stringer-db" {
-  source   = "modules/postgres"
-  name     = "stringer"
-  password = "${data.pass_password.stringer-db-password.password}"
-}
+# module "stringer-db" {
+#   source   = "modules/postgres"
+#   name     = "stringer"
+#   password = "${data.pass_password.stringer-db-password.password}"
+# }
 
 # module "stringer-container" {
 #   name   = "stringer"
diff --git a/variables.tf b/variables.tf
index 938927f..475bb36 100644
--- a/variables.tf
+++ a/variables.tf
@@ -22,7 +22,7 @@
     "traefik.frontend.headers.STSIncludeSubdomains" = "false"
 
     // X-Powered-By, Server headers
-    "traefik.frontend.headers.customResponseHeaders" = "X-Powered-By:Allomancy||X-Server:Blackbox"
+    "traefik.frontend.headers.customResponseHeaders" = "X-Powered-By:Allomancy||X-Server:Blackbox||X-Clacks-Overhead:GNU Terry Pratchett"
 
     // X-Frame-Options
     "traefik.frontend.headers.customFrameOptionsValue" = "ALLOW-FROM https://bb8.fun/"
diff --git a/docker/images.tf b/docker/images.tf
index 22d72cd..17a61f7 100644
--- a/docker/images.tf
+++ a/docker/images.tf
@@ -13,7 +13,7 @@
   pull_triggers = ["${data.docker_registry_image.ubooquity.sha256_digest}"]
 }
 
-resource "docker_image" "lychee" {
-  name          = "${data.docker_registry_image.lychee.name}"
-  pull_triggers = ["${data.docker_registry_image.lychee.sha256_digest}"]
-}
+# resource "docker_image" "lychee" {
+#   name          = "${data.docker_registry_image.lychee.name}"
+#   pull_triggers = ["${data.docker_registry_image.lychee.sha256_digest}"]
+# }
diff --git a/gitea/data.tf b/gitea/data.tf
index 6ae5c4d..a8c6298 100644
--- a/gitea/data.tf
+++ a/gitea/data.tf
@@ -1,7 +1,7 @@
 # https://github.com/go-gitea/gitea/releases
 data "docker_registry_image" "gitea" {
   # not bleeding, this is hemorrhaging edge
-  name = "gitea/gitea:1.10"
+  name = "gitea/gitea:1.11"
 }
 
 data "docker_registry_image" "redis" {
diff --git a/media/airsonic.tf b/media/airsonic.tf
index d45f0d4..90a36be 100644
--- a/media/airsonic.tf
+++ a/media/airsonic.tf
@@ -1,67 +1,67 @@
-module "airsonic" {
-  source = "../modules/container"
-  image  = "linuxserver/airsonic:latest"
-  name   = "airsonic"
-
-  resource {
-    memory      = "1024"
-    memory_swap = "1024"
-  }
-
-  web {
-    port   = 4040
-    host   = "airsonic.bb8.fun"
-    expose = true
-  }
-
-  networks = "${list(docker_network.media.id, data.docker_network.bridge.id)}"
-
-  env = [
-    "PUID=1004",
-    "PGID=1003",
-    "TZ=Asia/Kolkata",
-    "JAVA_OPTS=-Xmx512m -Dserver.use-forward-headers=true -Dserver.context-path=/",
-  ]
-
-  devices = [{
-    host_path      = "/dev/snd"
-    container_path = "/dev/snd"
-  }]
-
-  # files = [
-  #   "/usr/lib/jvm/java-1.8-openjdk/jre/lib/airsonic.properties",
-  #   "/usr/lib/jvm/java-1.8-openjdk/jre/lib/sound.properties",
-  # ]
-
-
-  # contents = [
-  #   "${data.template_file.airsonic-properties-file.rendered}",
-  #   "${file("${path.module}/conf/airsonic.sound.properties")}",
-  # ]
-
-  volumes = [
-    {
-      host_path      = "/mnt/xwing/config/airsonic2"
-      container_path = "/config"
-    },
-    {
-      host_path      = "/mnt/xwing/media/Music"
-      container_path = "/music"
-    },
-    {
-      host_path      = "/mnt/xwing/config/airsonic/playlists"
-      container_path = "/playlists"
-    },
-    {
-      host_path      = "/mnt/xwing/config/airsonic/podcasts"
-      container_path = "/podcasts"
-    },
-    {
-      host_path      = "/mnt/xwing/config/airsonic/jre"
-      container_path = "/usr/lib/jvm/java-1.8-openjdk/jre/lib/"
-    },
-  ]
-}
+# module "airsonic" {
+#   source = "../modules/container"
+#   image  = "linuxserver/airsonic:latest"
+#   name   = "airsonic"
+
+#   resource {
+#     memory      = "1024"
+#     memory_swap = "1024"
+#   }
+
+#   web {
+#     port   = 4040
+#     host   = "airsonic.bb8.fun"
+#     expose = true
+#   }
+
+#   networks = "${list(docker_network.media.id, data.docker_network.bridge.id)}"
+
+#   env = [
+#     "PUID=1004",
+#     "PGID=1003",
+#     "TZ=Asia/Kolkata",
+#     "JAVA_OPTS=-Xmx512m -Dserver.use-forward-headers=true -Dserver.context-path=/",
+#   ]
+
+#   devices = [{
+#     host_path      = "/dev/snd"
+#     container_path = "/dev/snd"
+#   }]
+
+#   # files = [
+#   #   "/usr/lib/jvm/java-1.8-openjdk/jre/lib/airsonic.properties",
+#   #   "/usr/lib/jvm/java-1.8-openjdk/jre/lib/sound.properties",
+#   # ]
+
+
+#   # contents = [
+#   #   "${data.template_file.airsonic-properties-file.rendered}",
+#   #   "${file("${path.module}/conf/airsonic.sound.properties")}",
+#   # ]
+
+#   volumes = [
+#     {
+#       host_path      = "/mnt/xwing/config/airsonic2"
+#       container_path = "/config"
+#     },
+#     {
+#       host_path      = "/mnt/xwing/media/Music"
+#       container_path = "/music"
+#     },
+#     {
+#       host_path      = "/mnt/xwing/config/airsonic/playlists"
+#       container_path = "/playlists"
+#     },
+#     {
+#       host_path      = "/mnt/xwing/config/airsonic/podcasts"
+#       container_path = "/podcasts"
+#     },
+#     {
+#       host_path      = "/mnt/xwing/config/airsonic/jre"
+#       container_path = "/usr/lib/jvm/java-1.8-openjdk/jre/lib/"
+#     },
+#   ]
+# }
 
 # data "template_file" "airsonic-properties-file" {
 #   template = "${file("${path.module}/conf/airsonic.properties.tpl")}"
diff --git a/media/bazarr.tf b/media/bazarr.tf
index ba1b3a2..c46820d 100644
--- a/media/bazarr.tf
+++ a/media/bazarr.tf
@@ -1,39 +1,39 @@
-module "bazarr-container" {
-  name   = "bazarr"
-  source = "../modules/container"
-  image  = "linuxserver/bazarr:latest"
+# module "bazarr-container" {
+#   name   = "bazarr"
+#   source = "../modules/container"
+#   image  = "linuxserver/bazarr:latest"
 
-  web {
-    expose = true
-    port   = 6767
-    host   = "bazarr.${var.domain}"
-  }
+#   web {
+#     expose = true
+#     port   = 6767
+#     host   = "bazarr.${var.domain}"
+#   }
 
-  resource {
-    memory      = 512
-    memory_swap = 1024
-  }
+#   resource {
+#     memory      = 512
+#     memory_swap = 1024
+#   }
 
-  volumes = [
-    {
-      host_path      = "/mnt/xwing/config/bazarr"
-      container_path = "/config"
-    },
-    {
-      host_path      = "/mnt/xwing/media/TV"
-      container_path = "/tv"
-    },
-    {
-      host_path      = "/mnt/xwing/media/Movies"
-      container_path = "/movies"
-    },
-  ]
+#   volumes = [
+#     {
+#       host_path      = "/mnt/xwing/config/bazarr"
+#       container_path = "/config"
+#     },
+#     {
+#       host_path      = "/mnt/xwing/media/TV"
+#       container_path = "/tv"
+#     },
+#     {
+#       host_path      = "/mnt/xwing/media/Movies"
+#       container_path = "/movies"
+#     },
+#   ]
 
-  env = [
-    "PUID=1004",
-    "PGID=1003",
-    "TZ=Asia/Kolkata",
-  ]
+#   env = [
+#     "PUID=1004",
+#     "PGID=1003",
+#     "TZ=Asia/Kolkata",
+#   ]
 
-  networks = "${list(docker_network.media.id, data.docker_network.bridge.id)}"
-}
+#   networks = "${list(docker_network.media.id, data.docker_network.bridge.id)}"
+# }
diff --git a/media/gonic.tf b/media/gonic.tf
index 7afabd2..a4101e5 100644
--- a/media/gonic.tf
+++ a/media/gonic.tf
@@ -1,34 +1,36 @@
-module "gonic" {
-  source = "../modules/container"
-  image  = "sentriz/gonic"
-  name   = "gonic"
+# module "gonic" {
+#   source = "../modules/container"
+#   image  = "sentriz/gonic"
+#   name   = "gonic"
 
-  resource {
-    memory      = "256"
-    memory_swap = "256"
-  }
+#   resource {
+#     memory      = "256"
+#     memory_swap = "256"
+#   }
 
-  web {
-    port   = 80
-    host   = "gonic.bb8.fun"
-    expose = true
-  }
+#   web {
+#     port   = 80
+#     host   = "gonic.bb8.fun"
+#     expose = true
+#   }
 
-  env = [
-    "GONIC_SCAN_INTERVAL=60"
-  ]
+#   env = [
+#     "GONIC_SCAN_INTERVAL=60",
+#     "GONIC_MUSIC_PATH=/music",
+#     "GONIC_DB_PATH=/data/gonic.db"
+#   ]
 
-  networks = "${list(docker_network.media.id, data.docker_network.bridge.id)}"
+#   networks = "${list(docker_network.media.id, data.docker_network.bridge.id)}"
 
-  volumes = [
-    {
-      host_path      = "/mnt/xwing/config/gonic"
-      container_path = "/data"
-    },
-    {
-      host_path      = "/mnt/xwing/media/Music"
-      container_path = "/music"
-      read_only      = true
-    }
-  ]
-}+#   volumes = [
+#     {
+#       host_path      = "/mnt/xwing/config/gonic"
+#       container_path = "/data"
+#     },
+#     {
+#       host_path      = "/mnt/xwing/media/Music"
+#       container_path = "/music"
+#       read_only      = true
+#     }
+#   ]
+# }
diff --git a/media/jellyfin.tf b/media/jellyfin.tf
index 0564136..792d600 100644
--- a/media/jellyfin.tf
+++ a/media/jellyfin.tf
@@ -1,47 +1,1 @@
-resource "docker_container" "jellyfin" {
-  name  = "jellyfin"
-  image = "${docker_image.jellyfin.latest}"
-
-  volumes {
-    host_path      = "/mnt/xwing/config/jellyfin"
-    container_path = "/config"
-  }
-
-  volumes {
-    host_path      = "/mnt/xwing/media"
-    container_path = "/media"
-  }
-
-  labels = "${merge(
-    var.traefik-labels,
-    map(
-      "traefik.frontend.rule", "Host:media.in.${var.domain},media.${var.domain}",
-      "traefik.frontend.passHostHeader", "true",
-      "traefik.port", 8096,
-    ))}"
-
-  networks = ["${docker_network.media.id}", "${var.traefik-network-id}"]
-
-  memory                = 2048
-  restart               = "unless-stopped"
-  destroy_grace_seconds = 10
-  must_run              = true
-
-  # Running as lounge:tatooine
-  env = [
-    "APP_USER=lounge",
-    "APP_UID=1004",
-    "APP_GID=1003",
-    "APP_CONFIG=/mnt/xwing/config",
-    "TZ=Asia/Kolkata",
-  ]
-}
-
-resource "docker_image" "jellyfin" {
-  name          = "${data.docker_registry_image.jellyfin.name}"
-  pull_triggers = ["${data.docker_registry_image.jellyfin.sha256_digest}"]
-}
-
-data "docker_registry_image" "jellyfin" {
-  name = "jellyfin/jellyfin:latest"
-}
+#
diff --git a/media/mylar.tf b/media/mylar.tf
index 7252240..f700d65 100644
--- a/media/mylar.tf
+++ a/media/mylar.tf
@@ -1,35 +1,35 @@
-module "mylar" {
-  name   = "mylar"
-  source = "../modules/container"
-  image  = "linuxserver/mylar:latest"
+# module "mylar" {
+#   name   = "mylar"
+#   source = "../modules/container"
+#   image  = "linuxserver/mylar:latest"
 
-  web {
-    expose = true
-    port   = 8090
-    host   = "mylar.${var.domain}"
-    auth   = true
-  }
+#   web {
+#     expose = true
+#     port   = 8090
+#     host   = "mylar.${var.domain}"
+#     auth   = true
+#   }
 
-  volumes = [
-    {
-      host_path      = "/mnt/xwing/media/EBooks/Comics"
-      container_path = "/comics"
-    },
-    {
-      host_path      = "/mnt/xwing/config/mylar"
-      container_path = "/config"
-    },
-    {
-      host_path      = "/mnt/xwing/media/DL"
-      container_path = "/downloads"
-    },
-  ]
+#   volumes = [
+#     {
+#       host_path      = "/mnt/xwing/media/EBooks/Comics"
+#       container_path = "/comics"
+#     },
+#     {
+#       host_path      = "/mnt/xwing/config/mylar"
+#       container_path = "/config"
+#     },
+#     {
+#       host_path      = "/mnt/xwing/media/DL"
+#       container_path = "/downloads"
+#     },
+#   ]
 
-  env = [
-    "PUID=1004",
-    "PGID=1003",
-    "TZ=Asia/Kolkata",
-  ]
+#   env = [
+#     "PUID=1004",
+#     "PGID=1003",
+#     "TZ=Asia/Kolkata",
+#   ]
 
-  networks = "${list(docker_network.media.id, data.docker_network.bridge.id)}"
-}
+#   networks = "${list(docker_network.media.id, data.docker_network.bridge.id)}"
+# }
diff --git a/monitoring/config/prometheus.yml b/monitoring/config/prometheus.yml
index 7b0175b..6999a8e 100644
--- a/monitoring/config/prometheus.yml
+++ a/monitoring/config/prometheus.yml
@@ -14,12 +14,12 @@
       - targets: ["nodeexporter:9100"]
 
   - job_name: "cadvisor"
-    scrape_interval: 5s
+    scrape_interval: 1m
     static_configs:
       - targets: ["cadvisor:8080"]
 
   - job_name: "speedtest"
-    scrape_interval: 15m
+    scrape_interval: 1h
     scrape_timeout: 2m
     static_configs:
       - targets: ["speedtest:9696"]
@@ -35,7 +35,7 @@
       - targets: ["192.168.1.111:1111"]
 
   - job_name: "act"
-    scrape_interval: 15m
+    scrape_interval: 1h
     scrape_timeout: 1m
     static_configs:
       - targets: ["act-exporter:3000"]
--
rgit 0.1.5