aboutsummaryrefslogblamecommitdiff
path: root/app/deployment/seafile.hcl
blob: 8e2480a0c7231354b05efc8696bb39be3c42bdfd (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12


                       
               







                                  







                                               





































                                                                                    


                       
                                            
                             




                                                                            







                                             
                   





                                             
                    








                                                                       

                               


                       

                                 














                                                    


                                                                              

                               


                        

                                 









                                   

                                                                          


                                               
                
                                                                            


                                                 
                
                                                                                  


                                                       
                

                                                                        

                

                                                                        

                

                                                                         
       


                                                              
                

                                                                    
       
 
                

                                                                    




       
job "seafile" {
  datacenters = ["dc1"]
  type = "service"
  priority = 10

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

  group "main" {
    count = 1

    network {
      port "seafile-frontend" { static = 8000 }
      port "seafile-seafhttp" { static = 8083 }
      port "seafile-dav" { static = 8084 }
      port "seafile-hack" { static = 8085 } 
    }

    task "hack" {
      driver = "docker"
      config {
        image = "alpine/socat:1.0.5"
        network_mode = "host"
        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 = 8085
        address_mode = "driver"
        name = "seafhttp"
        check {
          type = "tcp"
          port = 8085
          address_mode = "driver"
          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"
        
        ## 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 = 8000
        address_mode = "driver"
        name = "seahub"
        check {
          type = "tcp"
          port = 8000
          address_mode = "driver"
          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 = 8084
        address_mode = "driver"
        name = "seafdav"
        check {
          type = "tcp"
          port = 8084
          address_mode = "driver"
          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 ----
      # @FIXME should be put in the secret hierarchy in consul
      template {
        data = "{{ key \"configuration/seafile/conf/mykey.peer\" }}"
        destination = "secrets/ccnet/mykey.peer"
      }

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