forked from CGamesPlay/infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregistry.nomad
76 lines (65 loc) · 1.47 KB
/
registry.nomad
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
[[/* This is jobspec should be rendered with levant. */]]
job "registry" {
datacenters = ["nbg1"]
type = "service"
priority = 60
group "main" {
network {
port "http" {
to = 5000
}
}
service {
name = "${NOMAD_JOB_NAME}"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.certresolver=le",
]
check {
type = "http"
path = "/"
interval = "30s"
timeout = "2s"
}
}
task "server" {
driver = "docker"
config {
image = "registry:2"
ports = ["http"]
volumes = [
"/opt/registry:/var/lib/registry",
"local/config.yml:/etc/docker/registry/config.yml",
"local/htpasswd:/etc/docker/registry/htpasswd"
]
}
template {
destination = "local/config.yml"
data = <<-EOF
version: 0.1
storage:
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true
http:
addr: 0.0.0.0:5000
auth:
htpasswd:
realm: {{ env "NOMAD_JOB_NAME" }}.{{ key "traefik/config/domain" }}
path: /etc/docker/registry/htpasswd
EOF
}
template {
destination = "local/htpasswd"
data = <<-EOF
[[ fileContents "htpasswd" ]]
EOF
}
resources {
memory = 32
}
}
}
}