From 1c0bd39d4228be3bc6a1d052da5d9e6e7b447184 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 25 Feb 2024 00:54:11 -0500 Subject: [PATCH] feat: ensure referenced images get updated by dependabot Dokku uses a few external images for various bits of functionality, but these must be manually updated every so often due to being referenced in code. By moving the references to Dockerfiles, we can take advantage of dependabot to issue automatic PRs when they are out of date. --- .github/dependabot.yml | 35 +++++++++++++++++++++ plugins/caddy-vhosts/Dockerfile | 1 + plugins/caddy-vhosts/internal-functions | 2 +- plugins/haproxy-vhosts/Dockerfile | 1 + plugins/haproxy-vhosts/internal-functions | 2 +- plugins/logs/Dockerfile | 1 + plugins/logs/functions.go | 13 +++++++- plugins/logs/logs.go | 7 +++-- plugins/logs/report.go | 2 +- plugins/logs/subcommands.go | 2 +- plugins/openresty-vhosts/Dockerfile | 1 + plugins/openresty-vhosts/internal-functions | 2 +- plugins/traefik-vhosts/Dockerfile | 1 + plugins/traefik-vhosts/internal-functions | 2 +- 14 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 plugins/caddy-vhosts/Dockerfile create mode 100644 plugins/haproxy-vhosts/Dockerfile create mode 100644 plugins/logs/Dockerfile create mode 100644 plugins/openresty-vhosts/Dockerfile create mode 100644 plugins/traefik-vhosts/Dockerfile diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ff939e1c5..5961e8dee 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -141,6 +141,41 @@ updates: open-pull-requests-limit: 2 labels: - "type: dependencies" + - package-ecosystem: "docker" + directory: "/plugins/caddy-vhosts" + schedule: + interval: daily + open-pull-requests-limit: 10 + labels: + - "type: dependencies" + - package-ecosystem: "docker" + directory: "/plugins/haproxy-vhosts" + schedule: + interval: daily + open-pull-requests-limit: 10 + labels: + - "type: dependencies" + - package-ecosystem: "docker" + directory: "/plugins/logs" + schedule: + interval: daily + open-pull-requests-limit: 10 + labels: + - "type: dependencies" + - package-ecosystem: "docker" + directory: "/plugins/openresty-vhosts" + schedule: + interval: daily + open-pull-requests-limit: 10 + labels: + - "type: dependencies" + - package-ecosystem: "docker" + directory: "/plugins/traefik-vhosts" + schedule: + interval: daily + open-pull-requests-limit: 10 + labels: + - "type: dependencies" - package-ecosystem: bundler directory: "/tests/apps/ruby" schedule: diff --git a/plugins/caddy-vhosts/Dockerfile b/plugins/caddy-vhosts/Dockerfile new file mode 100644 index 000000000..6be7ae93f --- /dev/null +++ b/plugins/caddy-vhosts/Dockerfile @@ -0,0 +1 @@ +FROM lucaslorentz/caddy-docker-proxy:2.8 \ No newline at end of file diff --git a/plugins/caddy-vhosts/internal-functions b/plugins/caddy-vhosts/internal-functions index b03a309d7..86727e364 100755 --- a/plugins/caddy-vhosts/internal-functions +++ b/plugins/caddy-vhosts/internal-functions @@ -46,7 +46,7 @@ fn-caddy-template-compose-file() { } fn-caddy-image() { - fn-plugin-property-get-default "caddy" "--global" "image" "lucaslorentz/caddy-docker-proxy:2.8" + fn-plugin-property-get-default "caddy" "--global" "image" "$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/caddy-vhosts/Dockerfile" | awk '{print $2}')" } fn-caddy-letsencrypt-email() { diff --git a/plugins/haproxy-vhosts/Dockerfile b/plugins/haproxy-vhosts/Dockerfile new file mode 100644 index 000000000..384757525 --- /dev/null +++ b/plugins/haproxy-vhosts/Dockerfile @@ -0,0 +1 @@ +FROM byjg/easy-haproxy:4.3.0 diff --git a/plugins/haproxy-vhosts/internal-functions b/plugins/haproxy-vhosts/internal-functions index 508869054..0e94364e6 100755 --- a/plugins/haproxy-vhosts/internal-functions +++ b/plugins/haproxy-vhosts/internal-functions @@ -44,7 +44,7 @@ fn-haproxy-template-compose-file() { } fn-haproxy-image() { - fn-plugin-property-get-default "haproxy" "--global" "image" "byjg/easy-haproxy:4.3.0" + fn-plugin-property-get-default "haproxy" "--global" "image" "$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/haproxy-vhosts/Dockerfile" | awk '{print $2}')" } fn-haproxy-log-level() { diff --git a/plugins/logs/Dockerfile b/plugins/logs/Dockerfile new file mode 100644 index 000000000..59c6a3cd9 --- /dev/null +++ b/plugins/logs/Dockerfile @@ -0,0 +1 @@ +FROM timberio/vector:0.35.X-debian diff --git a/plugins/logs/functions.go b/plugins/logs/functions.go index d6ecf5e75..d1acb75fc 100644 --- a/plugins/logs/functions.go +++ b/plugins/logs/functions.go @@ -121,6 +121,17 @@ func startVectorContainer(vectorImage string) error { return nil } +func getComputedVectorImage() string { + return common.PropertyGetDefault("logs", "--global", "vector-image", getDefaultVectorImage()) +} + +// getDefaultVectorImage returns the default image used for the vector container +func getDefaultVectorImage() string { + contents := strings.TrimSpace(VectorDockerfile) + parts := strings.SplitN(contents, " ", 2) + return parts[1] +} + func stopVectorContainer() error { if !common.IsComposeInstalled() { return errors.New("Required docker compose plugin is not installed") @@ -159,7 +170,7 @@ func stopVectorContainer() error { data := vectorTemplateData{ DokkuLibRoot: dokkuLibRoot, DokkuLogsDir: dokkuLogsDir, - VectorImage: VectorImage, + VectorImage: getComputedVectorImage(), } if err := tmpl.Execute(tmpFile, data); err != nil { diff --git a/plugins/logs/logs.go b/plugins/logs/logs.go index 896e6078b..d0122957e 100644 --- a/plugins/logs/logs.go +++ b/plugins/logs/logs.go @@ -25,8 +25,11 @@ var ( } ) -// VectorImage contains the default vector image to run -const VectorImage = "timberio/vector:0.35.X-debian" +// VectorDockerfile is the contents of the default Dockerfile +// containing the version of vector Dokku uses +// +//go:embed Dockerfile +var VectorDockerfile string // VectorDefaultSink contains the default sink in use for vector log shipping const VectorDefaultSink = "blackhole://?print_interval_secs=1" diff --git a/plugins/logs/report.go b/plugins/logs/report.go index 9a84eb856..ed3d7d227 100644 --- a/plugins/logs/report.go +++ b/plugins/logs/report.go @@ -44,7 +44,7 @@ func reportGlobalMaxSize(appName string) string { } func reportVectorGlobalImage(appName string) string { - return common.PropertyGetDefault("logs", "--global", "vector-image", VectorImage) + return getComputedVectorImage() } func reportGlobalVectorSink(appName string) string { diff --git a/plugins/logs/subcommands.go b/plugins/logs/subcommands.go index 26c6a1f7a..20737c7f6 100644 --- a/plugins/logs/subcommands.go +++ b/plugins/logs/subcommands.go @@ -104,7 +104,7 @@ func CommandVectorStart(vectorImage string) error { } if vectorImage == "" { - vectorImage = common.PropertyGetDefault("logs", "--global", "vector-image", VectorImage) + vectorImage = common.PropertyGetDefault("logs", "--global", "vector-image", getComputedVectorImage()) } common.LogVerbose("Starting vector container") diff --git a/plugins/openresty-vhosts/Dockerfile b/plugins/openresty-vhosts/Dockerfile new file mode 100644 index 000000000..c33d9ac44 --- /dev/null +++ b/plugins/openresty-vhosts/Dockerfile @@ -0,0 +1 @@ +FROM dokku/openresty-docker-proxy:0.6.0 diff --git a/plugins/openresty-vhosts/internal-functions b/plugins/openresty-vhosts/internal-functions index ade179c48..7204d0c8f 100755 --- a/plugins/openresty-vhosts/internal-functions +++ b/plugins/openresty-vhosts/internal-functions @@ -112,7 +112,7 @@ fn-openresty-hsts-is-enabled() { } fn-openresty-image() { - fn-plugin-property-get-default "openresty" "--global" "image" "dokku/openresty-docker-proxy:0.6.0" + fn-plugin-property-get-default "openresty" "--global" "image" "$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/openresty-vhosts/Dockerfile" | awk '{print $2}')" } fn-openresty-letsencrypt-email() { diff --git a/plugins/traefik-vhosts/Dockerfile b/plugins/traefik-vhosts/Dockerfile new file mode 100644 index 000000000..9099fdcba --- /dev/null +++ b/plugins/traefik-vhosts/Dockerfile @@ -0,0 +1 @@ +FROM traefik:v2.10 diff --git a/plugins/traefik-vhosts/internal-functions b/plugins/traefik-vhosts/internal-functions index 51af09ef1..f2e7e4134 100755 --- a/plugins/traefik-vhosts/internal-functions +++ b/plugins/traefik-vhosts/internal-functions @@ -76,7 +76,7 @@ fn-traefik-dashboard-enabled() { } fn-traefik-image() { - fn-plugin-property-get-default "traefik" "--global" "image" "traefik:v2.10" + fn-plugin-property-get-default "traefik" "--global" "image" "$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/traefik-vhosts/Dockerfile" | awk '{print $2}')" } fn-traefik-letsencrypt-email() {