aboutsummaryrefslogtreecommitdiff
path: root/app/bagage/deploy/bagage.hcl
blob: 805860bd052fb1adfae52d7a91d912ac465d26b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
job "bagage" {
  datacenters = ["dc1"]
  type = "service"
  priority = 90

  constraint {
    attribute = "${attr.cpu.arch}"
    value     = "amd64"
  }

  group "main" {
    count = 1

    network {
      port "web_port" { to = 8080 }
      port "ssh_port" { 
        static = 2222
        to = 2222
      }
    }

    task "server" {
      driver = "docker"
      config {
        image = "superboum/amd64_bagage:v11"
        readonly_rootfs = false
        volumes = [
          "secrets/id_rsa:/id_rsa"
        ]
        ports = [ "web_port", "ssh_port" ]
      }

      env {
        BAGAGE_LDAP_ENDPOINT = "bottin2.service.2.cluster.deuxfleurs.fr:389"
      }

      resources {
        memory = 500
      }

      template {
        data = "{{ key \"secrets/bagage/id_rsa\" }}"
        destination = "secrets/id_rsa"
      }

      service {
        name = "bagage-ssh"
        port = "ssh_port"
        address_mode = "host"
        tags = [
          "bagage",
          "(diplonat (tcp_port 2222))"
        ]
      }

      service {
        name = "bagage-webdav"
        tags = [
          "bagage",
          "traefik.enable=true",
          "traefik.frontend.entryPoints=https,http",
          "traefik.frontend.rule=Host:bagage.deuxfleurs.fr",
          "tricot bagage.deuxfleurs.fr",
        ]
        port = "web_port"
        address_mode = "host"
        check {
          type = "tcp"
          port = "web_port"
          address_mode = "host"
          interval = "60s"
          timeout = "5s"
          check_restart {
            limit = 3
            grace = "90s"
            ignore_warnings = false
          }
        }
      }
    }
  }
}