| 1 | amends "../../config/Service.pkl" |
| 2 | |
| 3 | import "../../config/site.pkl" as site |
| 4 | import "../ddns-updater/service.pkl" as dns |
| 5 | import "pkl:json" |
| 6 | |
| 7 | local network = new json.Parser {}.parse(read("network.json").text) |
| 8 | local host = read?("prop:hostname") ?? "r2.iroh.\(site.domain)" |
| 9 | |
| 10 | name = "Iroh relay" |
| 11 | launcher = false |
| 12 | stageIsolation = "fresh" |
| 13 | requirements { new dns.DnsCredentials {} } |
| 14 | |
| 15 | containers { |
| 16 | ["app"] { |
| 17 | build = "." |
| 18 | hostNetwork = true |
| 19 | readOnlyRoot = true |
| 20 | tmpfs { "/tmp" } |
| 21 | args { "relay" } |
| 22 | http { containerPort = 3340; hostname = host; loopback = true; checkPath = "/healthz" } |
| 23 | tcp { |
| 24 | new { |
| 25 | name = "quic" |
| 26 | containerPort = network.quic |
| 27 | hostPort = if (site.preview) null else network.quic |
| 28 | loopback = false |
| 29 | } |
| 30 | } |
| 31 | volumes { ["/tls"] { readOnly = true } } |
| 32 | envTemplate = """ |
| 33 | HTTP_PORT={{ env "NOMAD_PORT_app_http" }} |
| 34 | QUIC_PORT={{ env "NOMAD_PORT_app_quic" }} |
| 35 | """ |
| 36 | cpu = 200 |
| 37 | memory = 256 |
| 38 | } |
| 39 | ["certificates"] { |
| 40 | build = "." |
| 41 | hostNetwork = true |
| 42 | readOnlyRoot = true |
| 43 | tmpfs { "/tmp" } |
| 44 | lifecycle = "prestartSidecar" |
| 45 | args { "certificates" } |
| 46 | volumes { ["/tls"] {} } |
| 47 | env { |
| 48 | ["RELAY_HOST"] = host |
| 49 | ["OWNER_EMAIL"] = site.ownerEmail |
| 50 | ["DNS_TOKEN"] = "${secret.dns.api_token}" |
| 51 | } |
| 52 | cpu = 100 |
| 53 | memory = 256 |
| 54 | } |
| 55 | } |