Skip to content

Commit f927dab

Browse files
authored
add image proxy (#102)
1 parent 7b769ce commit f927dab

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

jobs/services/imageproxy.hcl

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
job "imageproxy" {
2+
datacenters = ["aperture"]
3+
4+
type = "service"
5+
6+
group "web" {
7+
network {
8+
port "http" {
9+
to = 8080
10+
}
11+
port "redis" {
12+
to = 6379
13+
}
14+
}
15+
16+
service {
17+
name = "imageproxy"
18+
port = "http"
19+
20+
check {
21+
type = "http"
22+
path = "/"
23+
interval = "10s"
24+
timeout = "2s"
25+
}
26+
27+
tags = [
28+
"traefik.enable=true",
29+
"traefik.http.routers.imageproxy-api.rule=Host(`img.redbrick.dcu.ie`)",
30+
"traefik.http.routers.imageproxy-api.tls=true",
31+
"traefik.http.routers.imageproxy-api.tls.certresolver=lets-encrypt",
32+
]
33+
}
34+
35+
task "imageproxy" {
36+
driver = "docker"
37+
38+
config {
39+
image = "ghcr.io/willnorris/imageproxy:latest"
40+
ports = ["http"]
41+
}
42+
template {
43+
data = <<EOH
44+
IMAGEPROXY_BASEURL=https://img.redbrick.dcu.ie
45+
IMAGEPROXY_CACHE=redis://{{ env "NOMAD_ADDR_redis" }}
46+
IMAGEPROXY_REFERRERS=redbrick.dcu.ie,rb.dcu.ie,*.redbrick.dcu.ie,*.rb.dcu.ie
47+
# IMAGEPROXY_ALLOWHOSTS
48+
EOH
49+
destination = "local/.env"
50+
env = true
51+
}
52+
resources {
53+
cpu = 500
54+
memory = 1000
55+
}
56+
}
57+
task "redis" {
58+
driver = "docker"
59+
60+
config {
61+
image = "redis:latest"
62+
ports = ["redis"]
63+
}
64+
}
65+
}
66+
}
67+

0 commit comments

Comments
 (0)