From c6ebee47d7e08f9875eac4fc6a3456c5cc586cfd Mon Sep 17 00:00:00 2001 From: Nemo Date: Tue, 16 Feb 2021 19:58:53 +0530 Subject: [PATCH] Replace gonic with navidrome --- main.tf | 4 ++++ media/gonic.tf | 36 ------------------------------------ media/navidrome.tf | 45 +++++++++++++++++++++++++++++++++++++++++++++ media/variables.tf | 16 ++++++++++++++++ secrets.tf | 14 ++++++++++++++ 5 files changed, 79 insertions(+), 36 deletions(-) delete mode 100644 media/gonic.tf create mode 100644 media/navidrome.tf diff --git a/main.tf b/main.tf index 5cff27d..29ea359 100644 --- a/main.tf +++ b/main.tf @@ -68,6 +68,10 @@ module "media" { traefik-labels = "${var.traefik-common-labels}" ips = "${var.ips}" traefik-network-id = "${module.docker.traefik-network-id}" + lastfm_api_key = "${data.pass_password.navidrome-lastfm-api-key.password}" + lastfm_secret = "${data.pass_password.navidrome-lastfm-secret.password}" + spotify_id = "${data.pass_password.navidrome-spotify-id.password}" + spotify_secret = "${data.pass_password.navidrome-spotify-secret.password}" } module "monitoring" { diff --git a/media/gonic.tf b/media/gonic.tf deleted file mode 100644 index 54f2277..0000000 --- a/media/gonic.tf +++ /dev/null @@ -1,36 +0,0 @@ -module "gonic" { - source = "../modules/container" - image = "sentriz/gonic" - name = "gonic" - - resource { - memory = "512" - memory_swap = "512" - } - - web { - port = 80 - host = "gonic.bb8.fun" - expose = true - } - - 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)}" - - 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/navidrome.tf b/media/navidrome.tf new file mode 100644 index 0000000..c2191b9 --- /dev/null +++ b/media/navidrome.tf @@ -0,0 +1,45 @@ +module "navidrome" { + source = "../modules/container" + image = "deluan/navidrome" + name = "navidrome" + + user = 1004 + + resource { + memory = "1024" + memory_swap = "1024" + } + + web { + port = 4533 + host = "music.bb8.fun" + expose = true + } + + env = [ + "ND_SCANINTERVAL=1h", + "ND_LOGLEVEL=info", + "ND_SESSIONTIMEOUT=300h", + "ND_BASEURL=", + "ND_AUTOIMPORTPLAYLISTS=false", + # "ND_UIWELCOMEMESSAGE=Welcome to Scarif Music Archives", + "ND_LASTFM_APIKEY=${var.lastfm_api_key}", + "ND_LASTFM_SECRET=${var.lastfm_secret}", + "ND_SPOTIFY_ID=${var.spotify_id}", + "ND_SPOTIFY_SECRET=${var.spotify_secret}" + ] + + networks = "${list(docker_network.media.id, data.docker_network.bridge.id)}" + + volumes = [ + { + host_path = "/mnt/xwing/data/navidrome" + container_path = "/data" + }, + { + host_path = "/mnt/xwing/media/Music" + container_path = "/music" + read_only = true + } + ] +} diff --git a/media/variables.tf b/media/variables.tf index 1d66838..06eb255 100644 --- a/media/variables.tf +++ b/media/variables.tf @@ -18,3 +18,19 @@ variable "ips" { } variable "traefik-network-id" {} +variable "lastfm_api_key" { + description = "Navidrome Configuration for lastfm_api_key" + type = "string" +} +variable "lastfm_secret" { + description = "Navidrome Configuration for lastfm_secret" + type = "string" +} +variable "spotify_id" { + description = "Navidrome Configuration for spotify_id" + type = "string" +} +variable "spotify_secret" { + description = "Navidrome Configuration for spotify_secret" + type = "string" +} diff --git a/secrets.tf b/secrets.tf index ec96479..c45b699 100644 --- a/secrets.tf +++ b/secrets.tf @@ -153,3 +153,17 @@ data "pass_password" "klaxon-secret-key" { data "pass_password" "klaxon-sendgrid-password" { path = "klaxon-sendgrid-password" } + + +data "pass_password" "navidrome-lastfm-api-key" { + path = "navidrome-lastfm-api-key" +} +data "pass_password" "navidrome-lastfm-secret" { + path = "navidrome-lastfm-secret" +} +data "pass_password" "navidrome-spotify-id" { + path = "navidrome-spotify-id" +} +data "pass_password" "navidrome-spotify-secret" { + path = "navidrome-spotify-secret" +}