aboutsummaryrefslogtreecommitdiff
path: root/cluster/prod/app/bagage/deploy/bagage.hcl
blob: 9951a8d459435ff9e119b82a115cf7c51a7d454a (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
84
85
86
87
88
89
90
job "bagage" {
  datacenters = ["scorpio", "neptune"]
  type = "service"
  priority = 90

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

  group "main" {
    count = 1

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

    task "server" {
      driver = "docker"
      config {
        image = "lxpz/amd64_bagage:20231016-3"
        readonly_rootfs = false
        network_mode = "host"
        volumes = [
          "secrets/id_rsa:/id_rsa"
        ]
        ports = [ "web_port", "ssh_port" ]
      }

      env {
        BAGAGE_LDAP_ENDPOINT = "bottin.service.prod.consul:389"
      }

      resources {
        memory = 200
        cpu = 100
      }

      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))",
          "d53-a sftp.deuxfleurs.fr",
          "d53-aaaa sftp.deuxfleurs.fr",
        ]
      }

      service {
        name = "bagage-webdav"
        tags = [
          "bagage",
          "tricot bagage.deuxfleurs.fr",
          "d53-cname bagage.deuxfleurs.fr",
          "d53-a sftp.deuxfleurs.fr",
          "d53-aaaa sftp.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
          }
        }
      }
    }
  }
}