diff --git a/README.md b/README.md index 5fe59eb..5651f15 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Manages the local infrastructure of my home server. 1. docker: to actually run the services 2. cloudflare: to manage the DNS -3. mysql: unused +3. mysql: unused, but setup Self-learning project for terraform diff --git a/docker/data.tf b/docker/data.tf index a86febc..0db0821 100644 --- a/docker/data.tf +++ b/docker/data.tf @@ -28,4 +28,8 @@ data "docker_registry_image" "gitea" { data "docker_registry_image" "sickrage" { name = "linuxserver/sickrage:latest" +} + +data "docker_registry_image" "airsonic" { + name = "airsonic/airsonic:latest" } \ No newline at end of file diff --git a/docker/images.tf b/docker/images.tf index 2544d92..0530399 100644 --- a/docker/images.tf +++ b/docker/images.tf @@ -36,4 +36,9 @@ resource "docker_image" "gitea" { resource "docker_image" "sickrage" { name = "${data.docker_registry_image.sickrage.name}" pull_triggers = ["${data.docker_registry_image.sickrage.sha256_digest}"] +} + +resource "docker_image" "airsonic" { + name = "${data.docker_registry_image.airsonic.name}" + pull_triggers = ["${data.docker_registry_image.airsonic.sha256_digest}"] } \ No newline at end of file diff --git a/docker/main.tf b/docker/main.tf index b67d380..fdb026e 100644 --- a/docker/main.tf +++ b/docker/main.tf @@ -250,6 +250,46 @@ EOF } +resource "docker_container" "airsonic" { + name = "airsonic" + image = "${docker_image.airsonic.latest}" + + restart = "unless-stopped" + destroy_grace_seconds = 30 + must_run = true + user = "1004" + + volumes { + host_path = "/mnt/xwing/config/airsonic/data" + container_path = "/airsonic/data" + } + + volumes { + host_path = "/mnt/xwing/media/Music" + container_path = "/airsonic/music" + } + + volumes { + host_path = "/mnt/xwing/config/airsonic/playlists" + container_path = "/airsonic/playlists" + } + + volumes { + host_path = "/mnt/xwing/config/airsonic/podcasts" + container_path = "/airsonic/podcasts" + } + + labels { + "traefik.port" = 4040 + "traefik.enable" = "true" + } + + # ports { + # internal = 4040 + # external = 4040 + # } +} + resource "docker_container" "sickrage" { name = "sickrage" image = "${docker_image.sickrage.latest}"