Hi all,
Stuck on the last part of my puzzle, I have a working nomad consul, where i need to run multiple docker jobs, with unique subdomains and they all use internally tcp port 1935.
When i configure one job with
network {
.....
mode = "bridge"
port "rtmp" {
static = 1935
to = 1935
}
}
I can stream to it, but i need to have the others jobs as mentioned each with a unique subdomain.
I cant have the next job using the static port as this results in the following error :
* Dimension “network: reserved port collision rtmp=1935” exhausted on 1 nodes
I understand that static restriction but if i use dynamic i cant stream to the docker container.
this is my job file:
job "owncast4" {
datacenters = ["dc1"]
type = "service"
group "echo4" {
# constraint {
# distinct_hosts = true
# }
network {
port "http" {
to = 8080
}
mode = "bridge"
port "rtmp" {
static = 1935
to = 1935
}
}
service {
name = "demo-webapp4"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.https4.tls=true",
"traefik.http.routers.https4.rule=Host(`app4.example`)",
"traefik.http.routers.https4.entrypoints=websecure",
"traefik.http.routers.https4.tls.certresolver=myresolver",
"traefik.tcp.routers.rtmp4.rule=HostSNI(`app4.example`)",
"traefik.tcp.routers.rtmp4.entrypoints=rtmp",
"traefik.tcp.services.rtmp4.loadbalancer.server.port=1935"
]
check {
type = "http"
path = "/"
interval = "2s"
timeout = "2s"
}
}
task "server" {
driver = "docker"
config {
image = "......"
ports = ["http", "rtmp"]
}
}
}
}
And im using this traefik job:
job "traefik" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "traefik" {
count = 1
network {
port "http" {
static = 80
}
port "api" {
static = 8081
}
# port "rtmp" {
# static = 1935
# }
}
service {
name = "traefik"
check {
name = "alive"
type = "tcp"
port = "http"
interval = "10s"
timeout = "2s"
}
}
task "traefik" {
driver = "docker"
config {
image = "traefik:v2.4"
network_mode = "host"
volumes = [
"local/traefik.toml:/etc/traefik/traefik.toml",
]
}
template {
data = <<EOF
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.traefik]
address = ":8081"
[entryPoints.websecure]
address = ":443"
[entryPoints.rtmp]
address = ":1935"
[entryPoints.web.http.redirections.entryPoint]
to = "websecure"
scheme = "https"
[certificatesResolvers.myresolver.acme]
email = "ex@ample"
storage = "acme.json"
[certificatesResolvers.myresolver.acme.httpChallenge]
# used during the challenge
entryPoint = "http"
[api]
dashboard = true
insecure = true
# Enable Consul Catalog configuration backend.
[providers.consulCatalog]
prefix = "traefik"
exposedByDefault = false
[providers.consulCatalog.endpoint]
address = "127.0.0.1:8500"
scheme = "http"
EOF
destination = "local/traefik.toml"
}
resources {
cpu = 100
memory = 128
}
}
}
}
Any help would be much appreciated as im nearly there : )