aboutsummaryrefslogtreecommitdiff
path: root/app/deployment/seafile.hcl
blob: 3af7db34d6b16e00ff51753397842cfcd7dba3ff (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
job "seafile" {
  datacenters = ["dc1"]
  type = "service"
  priority = 10

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

  group "main" {
    count = 1

    network {
      port "seafile-frontend_port" { static = 8000 }
      port "seafile-seafhttp_port" { static = 8083 }
      port "seafile-dav_port" { static = 8084 }
      port "seafile-hack_port" { static = 8085 } 
      port "mariadb_port" { static = 3306 }
    }

    task "mariadb" {
      driver = "docker"
      config {
        image = "superboum/amd64_mariadb:v4"
        network_mode = "host"
        command = "tail"
        ports = [ "mariadb_port" ]
        args = [
          "-f", "/var/log/mysql/error.log",
        ]
        volumes = [
          "/mnt/glusterfs/mariadb/main/server:/var/lib/mysql",
        ]
      }

      template {
        data = file("../config/configuration/mariadb/main/env.tpl")
        destination = "secrets/env"
        env = true
      }

      resources {
        memory = 800
      }

      service {
        tags = ["mariadb"]
        port = "mariadb_port"
        address_mode = "host"
        name = "mariadb"
        check {
          type = "tcp"
          port = "mariadb_port"
          interval = "60s"
          timeout = "5s"
          check_restart {
            limit = 3
            grace = "90s"
            ignore_warnings = false
          }
        }
      }
    }


    task "hack" {
      driver = "docker"
      config {
        image = "alpine/socat:1.0.5"
        network_mode = "host"
        ports = [ "seafile-hack_port" ]
        command = "tcp6-listen:8085,fork,reuseaddr"
        args = [ "tcp-connect:127.0.0.1:8083" ]
      }
      resources {
        memory = 10
      }
      service {
        tags = [
          "seafile",
          "traefik.enable=true",
          "traefik.frontend.entryPoints=https,http",
          "traefik.frontend.rule=Host:cloud.deuxfleurs.fr;PathPrefixStrip:/seafhttp"

        ]
        port = "seafile-hack_port"
        address_mode = "host"
        name = "seafhttp"
        check {
          type = "tcp"
          port = "seafile-hack_port"
          interval = "60s"
          timeout = "5s"
          check_restart {
            limit = 3
            grace = "90s"
            ignore_warnings = false
          }
        }
      }

    }
       
    task "server" {
      driver = "docker"
      config {
        image = "superboum/amd64_seafile:v6"
        network_mode = "host"
        ports = [ "seafile-frontend_port", "seafile-dav_port", "seafile-seafhttp_port" ]
        
        ## cmd + args are used for running an instance attachable for update
        # command = "/bin/sleep"
        # args = ["999999"]

        mounts = [
          {
            type = "bind"
            source = "/mnt/glusterfs/seafile"
            target = "/mnt/seafile-data"
          }
        ]

        volumes = [
          "secrets/conf:/srv/webstore/conf",
          "secrets/ccnet:/srv/webstore/ccnet"
        ]
      }

      resources {
        memory = 600
      }

      service {
        tags = [
          "seafile",
          "traefik.enable=true",
          "traefik.frontend.entryPoints=https,http",
          "traefik.frontend.rule=Host:cloud.deuxfleurs.fr;PathPrefix:/"
        ]
        port = "seafile-frontend_port"
        address_mode = "host"
        name = "seahub"
        check {
          type = "tcp"
          port = "seafile-frontend_port"
          interval = "60s"
          timeout = "5s"
          check_restart {
            limit = 3
            grace = "90s"
            ignore_warnings = false
          }
        }
      }

      service {
        tags = [
          "seafile",
          "traefik.enable=true",
          "traefik.frontend.entryPoints=https,http",
          "traefik.frontend.rule=Host:cloud.deuxfleurs.fr;PathPrefix:/seafdav"

        ]
        port = "seafile-dav_port"
        address_mode = "host"
        name = "seafdav"
        check {
          type = "tcp"
          port = "seafile-dav_port"
          interval = "60s"
          timeout = "5s"
          check_restart {
            limit = 3
            grace = "90s"
            ignore_warnings = false
          }
        }
      }

      template {
        data = file("../config/configuration/seafile/conf/ccnet.conf.tpl")
        destination = "secrets/conf/ccnet.conf"
      }

      template {
        data = file("../config/configuration/seafile/conf/seafile.conf.tpl")
        destination = "secrets/conf/seafile.conf"
      }

      template {
        data = file("../config/configuration/seafile/conf/seahub_settings.py.tpl")
        destination = "secrets/conf/seahub_settings.py"
      }

      template {
        data = file("../config/configuration/seafile/ccnet/seafile.ini")
        destination = "secrets/ccnet/seafile.ini"
      }
      template {
        data = file("../config/configuration/seafile/conf/seafdav.conf")
        destination = "secrets/conf/seafdav.conf"
      }
      template {
        data = file("../config/configuration/seafile/conf/gunicorn.conf")
        destination = "secrets/conf/gunicorn.conf"
      }

      # ---- secrets ----
      template {
        data = "{{ key \"secrets/seafile/conf/mykey.peer\" }}"
        destination = "secrets/ccnet/mykey.peer"
      }

      template {
        data = "{{ key \"secrets/seafile/conf/mykey.peer\" }}"
        destination = "secrets/conf/mykey.peer"
      }
    }
  }
}