aboutsummaryrefslogtreecommitdiff
path: root/experimental/app/drone-ci-runner/deploy/runner-docker.hcl
blob: d7c6ef438573bec4a82c8549b6285d20e2e540fe (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
job "drone-runner" {
  datacenters = ["neptune"]
  type = "system"

  group "runner" {

    task "populate-nix-store" {
      lifecycle {
        hook = "prestart"
        sidecar = false
      }

      driver = "docker"
      config {
        image = "nixpkgs/nix:nixos-21.05"
        command = "sh"
        args = [
          "-c", "test -d /mnt/store || cp -rv /nix/{store,var} /mnt/"
        ]
        volumes = [
          "/var/lib/drone/nix:/mnt",
        ]
      }

      resources {
        memory = 100
        cpu = 100
      }
    }

    task "drone-runner" {
      driver = "docker"
      config {
        image = "drone/drone-runner-docker:1.8.1"

        volumes = [
          "/var/lib/drone/nix:/nix",
          "/var/run/docker.sock:/var/run/docker.sock"
        ]
      }

      template {
        data = <<EOH
DRONE_RPC_PROTO=https
DRONE_RPC_HOST=drone.deuxfleurs.fr
DRONE_RPC_SECRET={{ key "secrets/drone-ci/rpc_secret" | trimSpace }}
DRONE_RUNNER_CAPACITY=1
DRONE_DEBUG=true
DRONE_LOGS_TRACE=true
DRONE_RPC_DUMP_HTTP=true
DRONE_RPC_DUMP_HTTP_BODY=true
DRONE_RUNNER_NAME={{ env "attr.unique.hostname" }}
DRONE_RUNNER_LABELS=nix:1
EOH
        destination = "secrets/env"
        env = true
      }

      resources {
        memory = 200
        cpu = 100
      }
    }
  
    task "drone-gc" {
      driver = "docker"
      config {
        image = "drone/gc:latest"

        volumes = [
          "/var/run/docker.sock:/var/run/docker.sock"
        ]
      }

      template {
        data = <<EOH
GC_DEBUG=true
GC_CACHE=10gb
GC_INTERVAL=10m
EOH
        destination = "secrets/env"
        env = true
      }

      resources {
        memory = 100
        cpu = 100
      }
    }
  }
}