diff --git a/docker/conf/traefik.toml b/docker/conf/traefik.toml index e4b332f..1f08dff 100644 --- a/docker/conf/traefik.toml +++ b/docker/conf/traefik.toml @@ -2,8 +2,8 @@ defaultEntryPoints = ["http", "https"] [entryPoints] [entryPoints.http] address = ":80" -[entryPoints.http.auth.basic] - users = ["tatooine:$2y$05$ZK3.EVeaBi.IQAzZbmchiuaI6mhdDktnoLsQ8iI0K2727OjLDMLFO"] + [entryPoints.http.redirect] + entryPoint = "https" [entryPoints.https] address = ":443" # This is required for ACME support @@ -16,6 +16,9 @@ defaultEntryPoints = ["http", "https"] [backends.ebooks.servers.default] url = "http://192.168.1.111:2202" +# This is currently not exposed +# Since I can't apply a authentication +# on this yet [backends.elibsrv] [backends.elibsrv.servers.default] url = "http://elibsrv.captnemo.in:90" @@ -28,6 +31,7 @@ defaultEntryPoints = ["http", "https"] [frontends.ebooks] backend = "ebooks" + passHostHeader = true [frontends.ebooks.routes.domain] rule = "Host:ebooks.in.bb8.fun,ebooks.bb8.fun" @@ -46,17 +50,32 @@ email = "acme@captnemo.in" storage = "/acme/acme.json" entryPoint = "https" dnsProvider = "cloudflare" -onHostRule = true -onDemand = true +onHostRule = false +onDemand = false # Waiting till december to get wildcard SSL on LE -# [[acme.domains]] -# main = "bb8.fun" -# sans = ["*.bb8.fun"] +[[acme.domains]] +main = "in.bb8.fun" +sans = ["emby.in.bb8.fun", "airsonic.in.bb8.fun", "muximux.in.bb8.fun", "home.in.bb8.fun"] -# [docker] -# domain = "in.bb8.fun,bb8.fun" -# watch = true -# exposedbydefault = false +[[acme.domains]] +main = "bb8.fun" +sans = [ + "transmission.bb8.fun", + "emby.bb8.fun", + "flexget.bb8.fun", + "couchpotato.bb8.fun", + "traefik.bb8.fun", + "airsonic.bb8.fun", + "headphones.bb8.fun", + "wiki.bb8.fun", + "muximux.bb8.fun", + "home.bb8.fun", + "ebooks.bb8.fun", +] +[docker] + domain = "bb8.fun" + watch = true + exposedbydefault = false diff --git a/docker/conf/wiki.yml b/docker/conf/wiki.yml index c5f4b3d..6f025ad 100644 --- a/docker/conf/wiki.yml +++ b/docker/conf/wiki.yml @@ -23,7 +23,7 @@ host: http://wiki.in.bb8.fun:8888 # --------------------------------------------------------------------- # To use process.env.PORT, comment the line below: -port: 3000 +port: 9999 # --------------------------------------------------------------------- # Data Directories @@ -78,7 +78,7 @@ sessionSecret: 83941e2642ff1feafa410f35497c4ac6bc28d3226ca438225319ae1c9e670cdb # Database Connection String # --------------------------------------------------------------------- -db: mongodb://mongo:27017/wiki +db: mongodb://192.168.1.111:27017/wiki # --------------------------------------------------------------------- # Git Connection Info @@ -138,4 +138,4 @@ theme: footer: blue-grey code: dark: true - colorize: true \ No newline at end of file + colorize: true diff --git a/docker/main.tf b/docker/main.tf index 1cba156..eb94600 100644 --- a/docker/main.tf +++ b/docker/main.tf @@ -3,6 +3,7 @@ resource docker_container "transmission" { image = "${docker_image.transmission.latest}" labels { + "traefik.frontend.auth.basic" = "${var.basic_auth}" "traefik.port" = 9091 "traefik.enable" = "true" } @@ -120,6 +121,9 @@ resource "docker_container" "emby" { } labels { + "traefik.frontend.rule" = "Host:emby.in.bb8.fun,emby.bb8.fun" + "traefik.frontend.passHostHeader" = "true" + "traefik.frontend.auth.basic" = "${var.basic_auth}" "traefik.port" = 8096 "traefik.enable" = "true" } @@ -159,6 +163,7 @@ resource "docker_container" "flexget" { } labels { + "traefik.frontend.auth.basic" = "${var.basic_auth}" "traefik.port" = 5050 "traefik.enable" = "true" } @@ -198,6 +203,7 @@ resource "docker_container" "couchpotato" { } labels { + "traefik.frontend.auth.basic" = "${var.basic_auth}" "traefik.port" = 5050 "traefik.enable" = "true" } @@ -295,6 +301,7 @@ resource "docker_container" "airsonic" { destroy_grace_seconds = 30 must_run = true user = "1004" + memory = 512 volumes { host_path = "/mnt/xwing/config/airsonic/data" @@ -317,6 +324,8 @@ resource "docker_container" "airsonic" { } labels { + "traefik.frontend.rule" = "Host:airsonic.in.bb8.fun,airsonic.bb8.fun" + "traefik.frontend.passHostHeader" = "false" "traefik.port" = 4040 "traefik.enable" = "true" } @@ -329,6 +338,7 @@ resource "docker_container" "sickrage" { restart = "unless-stopped" destroy_grace_seconds = 10 must_run = true + memory = 256 volumes { host_path = "/mnt/xwing/config/sickrage" @@ -346,6 +356,8 @@ resource "docker_container" "sickrage" { } labels { + "traefik.frontend.passHostHeader" = "false" + "traefik.frontend.auth.basic" = "${var.basic_auth}" "traefik.port" = 8081 "traefik.enable" = "true" } @@ -364,6 +376,7 @@ resource "docker_container" "headphones" { restart = "unless-stopped" destroy_grace_seconds = 10 must_run = true + memory = 128 volumes { host_path = "/mnt/xwing/config/headphones" @@ -381,6 +394,7 @@ resource "docker_container" "headphones" { } labels { + "traefik.frontend.auth.basic" = "${var.basic_auth}" "traefik.port" = 8181 "traefik.enable" = "true" } @@ -410,7 +424,12 @@ resource "docker_container" "wiki" { volumes { host_path = "/mnt/xwing/data/wiki/data" - container_path = "/data" + container_path = "/data" + } + + volumes { + host_path = "/mnt/xwing/logs/wiki" + container_path = "/logs" } volumes { @@ -419,15 +438,13 @@ resource "docker_container" "wiki" { } labels { - "traefik.port" = 3000 + "traefik.port" = 9999 "traefik.enable" = "true" } env = [ "WIKI_ADMIN_EMAIL=me@captnemo.in", ] - - links = ["mongo"] } resource "docker_container" "mongo" { @@ -437,17 +454,26 @@ resource "docker_container" "mongo" { restart = "unless-stopped" destroy_grace_seconds = 10 must_run = true + memory = 256 volumes { volume_name = "${docker_volume.mongo_data_volume.name}" container_path = "/data/db" host_path = "${docker_volume.mongo_data_volume.mountpoint}" } + + ports { + internal = 27017 + external = 27017 + ip = "192.168.1.111" + } + } resource "docker_container" "muximux" { name = "muximux" image = "${docker_image.muximux.latest}" + memory = 64 restart = "unless-stopped" destroy_grace_seconds = 10 @@ -460,6 +486,9 @@ resource "docker_container" "muximux" { } labels { + "traefik.frontend.rule" = "Host:home.in.bb8.fun,home.bb8.fun" + "traefik.frontend.passHostHeader" = "false" + "traefik.frontend.auth.basic" = "${var.basic_auth}" "traefik.port" = 80 "traefik.enable" = "true" } diff --git a/docker/variables.tf b/docker/variables.tf index 25b9d4a..c2d5feb 100644 --- a/docker/variables.tf +++ b/docker/variables.tf @@ -19,3 +19,8 @@ variable "cloudflare_email" { type = "string" description = "cloudflare email address" } + +# Bcrypt +variable "basic_auth" { + default = "tatooine:$2y$05$iPbatint3Gulbs6kUtyALO9Yq5sBJ..aiF82bcIziH4ytz9nFoPr6,reddit:$2y$05$ghKxSydYCpAT8r2VVMDmWO/BBecghGfLsRJUkr3ii7XxPyxBqp8Oy" +}