feat: resolve nginx upstreams via coredns-docker
Stops nginx from routing to stale container IPs after host reboots, Docker upgrades without live-restore, or runtime container restarts. The bundled `nginx.conf.sigil` can use an nginx `resolver` directive against the local `coredns-docker` socket and a variable-based `proxy_pass` keyed on `<app>.<process-type>.docker`, so the upstream is resolved at request time honoring DNS TTL. `coredns-docker` becomes a hard `Depends:` of the dokku deb and is bundled in the Docker image under runit. Closes #8313.
This commit is contained in:
16 files changed
+419
-11
No files matched your search
@@ -150,6 +150,40 @@ func AppDisableCustomConfig(appName string) string {
|
||||
return common.PropertyGet("nginx", appName, "disable-custom-config")
|
||||
}
|
||||
|
||||
func AppDnsResolver(appName string) string {
|
||||
return common.PropertyGet("nginx", appName, "dns-resolver")
|
||||
}
|
||||
|
||||
func ComputedDnsResolver(appName string) string {
|
||||
appValue := AppDnsResolver(appName)
|
||||
if appValue != "" {
|
||||
return appValue
|
||||
}
|
||||
|
||||
return GlobalDnsResolver()
|
||||
}
|
||||
|
||||
func GlobalDnsResolver() string {
|
||||
return common.PropertyGetDefault("nginx", "--global", "dns-resolver", "127.0.0.1:1053")
|
||||
}
|
||||
|
||||
func AppDnsZone(appName string) string {
|
||||
return common.PropertyGet("nginx", appName, "dns-zone")
|
||||
}
|
||||
|
||||
func ComputedDnsZone(appName string) string {
|
||||
appValue := AppDnsZone(appName)
|
||||
if appValue != "" {
|
||||
return appValue
|
||||
}
|
||||
|
||||
return GlobalDnsZone()
|
||||
}
|
||||
|
||||
func GlobalDnsZone() string {
|
||||
return common.PropertyGetDefault("nginx", "--global", "dns-zone", "docker")
|
||||
}
|
||||
|
||||
func ComputedDisableCustomConfig(appName string) string {
|
||||
appValue := AppDisableCustomConfig(appName)
|
||||
if appValue != "" {
|
||||
|
||||
Reference in new issue
Block a user