restore $PORT support, remove explicit ports mapping
The MCP agent assigns its own host port and sets $PORT. The app must listen on $PORT for mc-proxy to reach it. Explicit Podman port mappings in the service definition are ignored by the agent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,10 +9,6 @@ kls = "Dockerfile"
|
|||||||
[[components]]
|
[[components]]
|
||||||
name = "kls"
|
name = "kls"
|
||||||
image = "mcr.svc.mcp.metacircular.net:8443/kls:v0.1.0"
|
image = "mcr.svc.mcp.metacircular.net:8443/kls:v0.1.0"
|
||||||
network = "mcpnet"
|
|
||||||
user = "0:0"
|
|
||||||
restart = "unless-stopped"
|
|
||||||
ports = ["127.0.0.1:48000:3030", "100.95.252.120:48000:3030"]
|
|
||||||
volumes = ["/srv/kls:/srv/kls"]
|
volumes = ["/srv/kls:/srv/kls"]
|
||||||
cmd = ["-f", "/srv/kls/kls.conf"]
|
cmd = ["-f", "/srv/kls/kls.conf"]
|
||||||
|
|
||||||
|
|||||||
14
main.go
14
main.go
@@ -6,6 +6,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
"git.wntrmute.dev/kyle/goutils/config"
|
"git.wntrmute.dev/kyle/goutils/config"
|
||||||
"git.wntrmute.dev/kyle/goutils/die"
|
"git.wntrmute.dev/kyle/goutils/die"
|
||||||
@@ -29,10 +30,15 @@ func main() {
|
|||||||
srv := &server{db: db}
|
srv := &server{db: db}
|
||||||
http.Handle("/", srv)
|
http.Handle("/", srv)
|
||||||
|
|
||||||
addr := net.JoinHostPort(
|
var addr string
|
||||||
config.Get("HTTP_ADDR"),
|
if port := os.Getenv("PORT"); port != "" {
|
||||||
config.GetDefault("HTTP_PORT", "8000"),
|
addr = ":" + port
|
||||||
)
|
} else {
|
||||||
|
addr = net.JoinHostPort(
|
||||||
|
config.Get("HTTP_ADDR"),
|
||||||
|
config.GetDefault("HTTP_PORT", "8000"),
|
||||||
|
)
|
||||||
|
}
|
||||||
log.Print("listening on ", addr)
|
log.Print("listening on ", addr)
|
||||||
log.Fatal(http.ListenAndServe(addr, nil))
|
log.Fatal(http.ListenAndServe(addr, nil))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user