aboutsummaryrefslogtreecommitdiff
path: root/cluster/prod/app/email/deploy/email-android7.hcl
blob: 0b4ef75f18a51dd1816753f09003178afa0a2f8d (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
job "email-android7" {
  datacenters = ["neptune", "bespin"]
  type = "service"
  priority = 100

  group "rsa-ecc-proxy" {
    network {
      port "smtps" {
        static = 465
        to = 465
      }
      port "imaps" {
        static = 993
        to = 993
      }
    } 
    task "imaps-proxy" {
      driver = "docker"
      config {
        image = "alpine/socat:1.7.4.4"
        readonly_rootfs = true
        ports = [ "imaps" ]
        network_mode = "host"
        args = [
          "openssl-listen:993,reuseaddr,fork,verify=0,bind=0.0.0.0,cert=/var/secrets/rsa.crt,key=/var/secrets/rsa.key",
          "openssl:imap.deuxfleurs.fr:993,verify=0",
        ]
        volumes = [
          "secrets/certs:/var/secrets"
        ]
      }

      template {
        data = "{{ key \"secrets/email/tls-tls-proxy/rsa.crt\" }}"
        destination = "secrets/certs/rsa.crt"
      }
      template {
        data = "{{ key \"secrets/email/tls-tls-proxy/rsa.key\" }}"
        destination = "secrets/certs/rsa.key"
      }

      resources {
        cpu = 50
        memory = 50
      }

      service {
        name = "imap-android7"
        port = "imaps"
        address_mode = "host"
        tags = [
          "rsa-ecc-proxy",
          "(diplonat (tcp_port 993))",
          "d53-a imap-android7.deuxfleurs.fr",
          # ipv6 is commented for now as socat does not listen on ipv6 now
          # "d53-aaaa imap-android7.deuxfleurs.fr"
        ]
        check {
          type = "tcp"
          port = "imaps"
          interval = "60s"
          timeout = "5s"
          check_restart {
            limit = 3
            grace = "90s"
            ignore_warnings = false
          }
        }
      }
    }
    task "smtps-proxy" {
      driver = "docker"
      config {
        image = "alpine/socat:1.7.4.4"
        readonly_rootfs = true
        network_mode = "host"
        ports = [ "smtps" ]
        args = [
          "openssl-listen:465,reuseaddr,fork,verify=0,bind=0.0.0.0,cert=/var/secrets/rsa.crt,key=/var/secrets/rsa.key",
          "openssl:smtp.deuxfleurs.fr:465,verify=0",
        ]
        volumes = [
          "secrets/certs:/var/secrets"
        ]
      }

      template {
        data = "{{ key \"secrets/email/tls-tls-proxy/rsa.crt\" }}"
        destination = "secrets/certs/rsa.crt"
      }
      template {
        data = "{{ key \"secrets/email/tls-tls-proxy/rsa.key\" }}"
        destination = "secrets/certs/rsa.key"
      }

      resources {
        cpu = 50
        memory = 50
      }

      service {
        name = "smtp-android7"
        port = "smtps"
        address_mode = "host"
        tags = [
          "rsa-ecc-proxy",
          "(diplonat (tcp_port 465))",
          "d53-a smtp-android7.deuxfleurs.fr",
          # ipv6 is commented for now as socat does not listen on ipv6 now
          # "d53-aaaa smtp-android7.deuxfleurs.fr"
        ]
        check {
          type = "tcp"
          port = "smtps"
          interval = "60s"
          timeout = "5s"
          check_restart {
            limit = 3
            grace = "90s"
            ignore_warnings = false
          }
        }
      }
    }
  }
}