Browse Source

feat: Add syncthing

pull/3/head
Karan Sharma 1 year ago
parent
commit
1acfa2e9d3
  1. 55
      floyd/terraform/syncthing/container.tf
  2. 17
      floyd/terraform/syncthing/image.tf
  3. 5
      floyd/terraform/syncthing/network.tf
  4. 3
      floyd/terraform/syncthing/variables.tf
  5. 8
      floyd/terraform/syncthing/versions.tf

55
floyd/terraform/syncthing/container.tf

@ -0,0 +1,55 @@
# Referred to https://github.com/linuxserver/syncthing
# for config.
resource "docker_container" "syncthing" {
name = "syncthing"
image = docker_image.syncthing.latest
volumes {
host_path = "/data/syncthing/data"
container_path = "/data"
}
volumes {
host_path = "/data/syncthing/config"
container_path = "/config"
}
ports {
internal = 8384
external = 8384
ip = var.ips["tailscale_floyd"]
protocol = "tcp"
}
ports {
internal = 22000
external = 22000
ip = var.ips["tailscale_floyd"]
protocol = "tcp"
}
ports {
internal = 21027
external = 21027
ip = var.ips["tailscale_floyd"]
protocol = "udp"
}
networks_advanced {
name = docker_network.syncthing.name
}
networks_advanced {
name = "caddy"
}
env = [
"PUID=1000",
"PGID=1000",
"TZ=Asia/Kolkata",
]
restart = "unless-stopped"
destroy_grace_seconds = 30
must_run = true
}

17
floyd/terraform/syncthing/image.tf

@ -0,0 +1,17 @@
data "docker_registry_image" "syncthing" {
name = "linuxserver/syncthing:latest"
}
resource "docker_image" "syncthing" {
name = data.docker_registry_image.syncthing.name
pull_triggers = [data.docker_registry_image.syncthing.sha256_digest]
}
data "docker_registry_image" "mariadb" {
name = "linuxserver/mariadb:latest"
}
resource "docker_image" "mariadb" {
name = data.docker_registry_image.mariadb.name
pull_triggers = [data.docker_registry_image.mariadb.sha256_digest]
}

5
floyd/terraform/syncthing/network.tf

@ -0,0 +1,5 @@
resource "docker_network" "syncthing" {
name = "syncthing"
driver = "bridge"
internal = "false"
}

3
floyd/terraform/syncthing/variables.tf

@ -0,0 +1,3 @@
variable "ips" {
type = map
}

8
floyd/terraform/syncthing/versions.tf

@ -0,0 +1,8 @@
terraform {
required_providers {
docker = {
source = "terraform-providers/docker"
}
}
required_version = ">= 0.13"
}
Loading…
Cancel
Save