From 19dc775c5c230a1ad3972ccf3ff3f702cfd19fcd Mon Sep 17 00:00:00 2001
From: Nemo <me@captnemo.in>
Date: Tue, 17 Apr 2018 00:45:43 +0530
Subject: [PATCH] Adds abstruse CI

---
 main.tf               |  6 ++++++
 abstruse/main.tf      | 33 +++++++++++++++++++++++++++++++++
 abstruse/variables.tf |  7 +++++++
 docker/data.tf        | 11 +++++++----
 4 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/main.tf b/main.tf
index 14bdff2..d6875d7 100644
--- a/main.tf
+++ a/main.tf
@@ -98,3 +98,9 @@
 module "digitalocean" {
   source = "digitalocean"
 }
+
+module "abstruse" {
+  source         = "abstruse"
+  domain         = "ci.bb8.fun"
+  traefik-labels = "${var.traefik-common-labels}"
+}
diff --git a/abstruse/main.tf b/abstruse/main.tf
new file mode 100644
index 0000000..1813069 100644
--- /dev/null
+++ a/abstruse/main.tf
@@ -1,0 +1,33 @@
+data "docker_registry_image" "abstruse" {
+  name = "bleenco/abstruse"
+}
+
+resource "docker_image" "abstruse" {
+  name          = "${data.docker_registry_image.abstruse.name}"
+  pull_triggers = ["${data.docker_registry_image.abstruse.sha256_digest}"]
+}
+
+resource "docker_container" "abstruse" {
+  name  = "abstruse"
+  image = "${docker_image.abstruse.latest}"
+
+  labels = "${merge(
+    var.traefik-labels, map(
+      "traefik.port", 6500,
+      "traefik.frontend.rule","Host:${var.domain}"
+  ))}"
+
+  volumes {
+    host_path      = "/var/run/docker.sock"
+    container_path = "/var/run/docker.sock"
+  }
+
+  volumes {
+    host_path      = "/mnt/xwing/config/abstruse"
+    container_path = "/root/.abstruse"
+  }
+
+  restart               = "unless-stopped"
+  destroy_grace_seconds = 60
+  must_run              = true
+}
diff --git a/abstruse/variables.tf b/abstruse/variables.tf
new file mode 100644
index 0000000..a214480 100644
--- /dev/null
+++ a/abstruse/variables.tf
@@ -1,0 +1,7 @@
+variable "domain" {
+  description = "domain to be used by traefik"
+}
+
+variable "traefik-labels" {
+  type = "map"
+}
diff --git a/docker/data.tf b/docker/data.tf
index adf2f83..7e2d53b 100644
--- a/docker/data.tf
+++ a/docker/data.tf
@@ -8,6 +8,12 @@
   name = "percona/percona-server-mongodb:3.4"
 }
 
+data "docker_registry_image" "traefik" {
+  # Critical and I like upgrading it
+  # for updating config for new features
+  name = "traefik:1.6"
+}
+
 # YOLO everything else
 data "docker_registry_image" "emby" {
   name = "emby/embyserver:latest"
@@ -15,11 +21,6 @@
 
 data "docker_registry_image" "transmission" {
   name = "linuxserver/transmission:latest"
-}
-
-data "docker_registry_image" "traefik" {
-  # Critical and I like upgrading it
-  name = "traefik:1.6"
 }
 
 data "docker_registry_image" "wikijs" {
--
rgit 0.1.5