ingress/gate: add consul dynamic routes

This commit is contained in:
wizzdom 2024-09-13 17:32:39 +01:00
parent 61c624fc89
commit dce054a721

View file

@ -8,7 +8,7 @@ job "gate-proxy" {
network { network {
port "mc" { port "mc" {
static = 4501 static = 25565
} }
} }
@ -30,7 +30,7 @@ job "gate-proxy" {
ports = ["mc"] ports = ["mc"]
volumes = [ volumes = [
"local/file.conf:/config.yaml" "local/config.yaml:/config.yaml"
] ]
} }
@ -40,7 +40,7 @@ job "gate-proxy" {
# settings are omitted and will be set by default. # settings are omitted and will be set by default.
# See config.yml for the full configuration options. # See config.yml for the full configuration options.
config: config:
bind: 0.0.0.0:4501 bind: 0.0.0.0:{{ env "NOMAD_PORT_mc" }}
forwarding: forwarding:
mode: legacy mode: legacy
@ -48,24 +48,18 @@ config:
lite: lite:
enabled: true enabled: true
routes: routes:
- host: regaus.rb.dcu.ie # Consul template to generate routes
backend: regaus-mc.service.consul:25566 # matches against all consul services ending in "-mc"
- host: mc.rb.dcu.ie # NOTE: each minecraft job must have both:
backend: vanilla-mc.service.consul:25567 # - a name ending in "-mc"
- host: olim909.rb.dcu.ie # - a port attached to the service
backend: olim909-mc.service.consul:25568 {{- range services }}
- host: olim909-geyser.rb.dcu.ie {{- if .Name | regexMatch ".*-mc$" }}
backend: olim909-mc.service.consul:19132 {{- range service .Name }}
- host: games.rb.dcu.ie - host: {{ .Name }}.rb.dcu.ie
backend: games-mc.service.consul:25569 backend: {{ .Name }}.service.consul:{{ .Port }}{{ end -}}{{ end -}}{{ end -}}
- host: fugitives.rb.dcu.ie
backend: fugitives-mc.service.consul:25570
- host: cjaran-mc.rb.dcu.ie
backend: cjaran-mc.service.consul:25571
- host: magma-mc.rb.dcu.ie
backend: minecraft-magma.service.consul:25572
EOH EOH
destination = "local/file.conf" destination = "local/config.yaml"
} }
} }
} }