From 0792c36f64071df258753f642b66eae20cf2d6bc Mon Sep 17 00:00:00 2001
From: Nemo <me@captnemo.in>
Date: Sat, 26 Jan 2019 18:06:18 +0530
Subject: [PATCH] Adds Firefox Sync Server

---
 firefox-sync.tf | 30 ++++++++++++++++++++++++++++++
 variables.tf    |  2 ++
 media/sonarr.tf |  3 ++-
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/firefox-sync.tf b/firefox-sync.tf
new file mode 100644
index 0000000..2b1407a 100644
--- /dev/null
+++ a/firefox-sync.tf
@@ -1,0 +1,30 @@
+module "firefox-sync" {
+  name   = "firefox-sync"
+  source = "./modules/container"
+  image  = "mozilla/syncserver:latest"
+
+  // Default is port 80
+  web {
+    expose = true
+    port   = "5000"
+    host   = "firesync.${var.root-domain}"
+  }
+
+  volumes = [{
+    host_path      = "/mnt/xwing/data/firefox-sync"
+    container_path = "/data"
+  }]
+
+  env = [
+    "SYNCSERVER_PUBLIC_URL=https://firesync.${var.root-domain}",
+    "SYNCSERVER_SECRET=${var.syncserver_secret}",
+    "SYNCSERVER_SQLURI=sqlite:////data/sync.db",
+    "SYNCSERVER_BATCH_UPLOAD_ENABLED=true",
+    "SYNCSERVER_FORCE_WSGI_ENVIRON=true",
+    "PORT=5000",
+  ]
+
+  networks = [
+    "${list(module.docker.traefik-network-id)}",
+  ]
+}
diff --git a/variables.tf b/variables.tf
index b0d7774..1f50bdc 100644
--- a/variables.tf
+++ a/variables.tf
@@ -92,3 +92,5 @@
 variable "outline_slack_secret" {}
 variable "outline_slack_app_id" {}
 variable "outline_slack_verification_token" {}
+
+variable "syncserver_secret" {}
diff --git a/media/sonarr.tf b/media/sonarr.tf
index de723b7..70539e7 100644
--- a/media/sonarr.tf
+++ a/media/sonarr.tf
@@ -10,7 +10,8 @@
   }
 
   resource {
-    memory = 512
+    memory      = 512
+    memory_swap = 1024
   }
 
   volumes = [
--
rgit 0.1.5