From 3245a8d3227c16f731bf1c4b69c7a5cff6848509 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 7 Sep 2022 10:49:49 -0400 Subject: [PATCH 1/7] fix: add docker-compose-plugin to debian packaging This might break installation on github actions - which only uses moby-engine - but we'll see as soon as CI runs since the install will fail. --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index dd9f1f2ff..baa7708c2 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Version: 0.28.4 Section: web Priority: optional Architecture: amd64 -Depends: apache2-utils, locales, git, cpio, curl, man-db, netcat, sshcommand (>= 0.12.0), docker-engine-cs (>= 17.05.0) | docker-engine (>= 17.05.0) | docker-io (>= 17.05.0) | docker.io (>= 17.05.0) | docker-ce (>= 17.05.0) | docker-ee (>= 17.05.0) | moby-engine, docker-image-labeler (>= 0.2.2), lambda-builder, net-tools, netrc, software-properties-common, parallel, procfile-util (>= 0.11.0), python-software-properties | python3-software-properties, rsync, rsyslog, dos2unix, jq, unzip +Depends: apache2-utils, locales, git, cpio, curl, man-db, netcat, sshcommand (>= 0.12.0), docker-engine-cs (>= 17.05.0) | docker-engine (>= 17.05.0) | docker-io (>= 17.05.0) | docker.io (>= 17.05.0) | docker-ce (>= 17.05.0) | docker-ee (>= 17.05.0) | moby-engine, docker-compose-plugin, docker-image-labeler (>= 0.2.2), lambda-builder, net-tools, netrc, software-properties-common, parallel, procfile-util (>= 0.11.0), python-software-properties | python3-software-properties, rsync, rsyslog, dos2unix, jq, unzip Recommends: herokuish (>= 0.3.4), bash-completion, dokku-update, dokku-event-listener Pre-Depends: gliderlabs-sigil, nginx (>= 1.8.0) | openresty, dnsutils, cgroupfs-mount | cgroup-lite, plugn (>= 0.3.0), sudo, python3, debconf Maintainer: Jose Diaz-Gonzalez From 9bd927a598df4cafd353b9d7932e6bec9b8a277f Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 7 Sep 2022 10:50:20 -0400 Subject: [PATCH 2/7] docs: fix compose install link The old link broke. Might be worth running some sort of linter for broken links in our documentation. --- docs/networking/proxies/caddy.md | 2 +- docs/networking/proxies/traefik.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/networking/proxies/caddy.md b/docs/networking/proxies/caddy.md index 672aa93c2..0eaf00eb6 100644 --- a/docs/networking/proxies/caddy.md +++ b/docs/networking/proxies/caddy.md @@ -15,7 +15,7 @@ caddy:stop # Stops the caddy server ## Requirements -Using the `caddy` plugin integration requires the `docker-compose-plugin` for Docker. See [this document](https://docs.docker.com/compose/install/compose-plugin/) from the Docker documentation for more information on the installation process for the `docker-compose-plugin`. +Using the `caddy` plugin integration requires the `docker-compose-plugin` for Docker. See [this document](https://docs.docker.com/compose/install/) from the Docker documentation for more information on the installation process for the `docker-compose-plugin`. ## Usage diff --git a/docs/networking/proxies/traefik.md b/docs/networking/proxies/traefik.md index 0ee731bd8..486c0b299 100644 --- a/docs/networking/proxies/traefik.md +++ b/docs/networking/proxies/traefik.md @@ -15,7 +15,7 @@ traefik:stop # Stops the traefik server ## Requirements -Using the `traefik` plugin integration requires the `docker-compose-plugin` for Docker. See [this document](https://docs.docker.com/compose/install/compose-plugin/) from the Docker documentation for more information on the installation process for the `docker-compose-plugin`. +Using the `traefik` plugin integration requires the `docker-compose-plugin` for Docker. See [this document](https://docs.docker.com/compose/install/) from the Docker documentation for more information on the installation process for the `docker-compose-plugin`. ## Usage From 3ff5e0e3a6596754bb9f4e107d1dda51bb6281b9 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 7 Sep 2022 10:53:49 -0400 Subject: [PATCH 3/7] fix: error out if commands using compose are executed Refs #5335 --- plugins/caddy-vhosts/command-functions | 12 ++++++++++++ plugins/common/functions | 12 ++++++++++++ plugins/traefik-vhosts/command-functions | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/plugins/caddy-vhosts/command-functions b/plugins/caddy-vhosts/command-functions index 9e4347da5..d7409da1e 100755 --- a/plugins/caddy-vhosts/command-functions +++ b/plugins/caddy-vhosts/command-functions @@ -108,6 +108,10 @@ cmd-caddy-show-config() { declare cmd="caddy:show-config" [[ "$1" == "$cmd" ]] && shift 1 + if ! fn-is-compose-installed; then + dokku_log_fail "Required docker compose plugin is not installed" + fi + local TMP_COMPOSE_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX") trap "rm -rf '$TMP_COMPOSE_FILE' >/dev/null" RETURN INT TERM EXIT @@ -120,6 +124,10 @@ cmd-caddy-start() { declare cmd="caddy:start" [[ "$1" == "$cmd" ]] && shift 1 + if ! fn-is-compose-installed; then + dokku_log_fail "Required docker compose plugin is not installed" + fi + local TMP_COMPOSE_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX") trap "rm -rf '$TMP_COMPOSE_FILE' >/dev/null" RETURN INT TERM EXIT @@ -132,6 +140,10 @@ cmd-caddy-stop() { declare cmd="caddy:start" [[ "$1" == "$cmd" ]] && shift 1 + if ! fn-is-compose-installed; then + dokku_log_fail "Required docker compose plugin is not installed" + fi + local TMP_COMPOSE_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX") trap "rm -rf '$TMP_COMPOSE_FILE' >/dev/null" RETURN INT TERM EXIT diff --git a/plugins/common/functions b/plugins/common/functions index e2abf8bbf..232a31c27 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -399,6 +399,18 @@ get_docker_version() { echo "$CLIENT_VERSION_STRING" } +fn-is-compose-installed() { + declare desc="check if the compose docker plugin is installed" + local COMPOSE_INSTALLED + COMPOSE_INSTALLED="$(docker info -f '{{range .ClientInfo.Plugins}}{{if eq .Name "compose"}}true{{end}}')" + + if [[ "$COMPOSE_INSTALLED" == "true" ]]; then + return 0 + fi + + return 1 +} + is_number() { declare desc="returns 0 if input is a number" local NUMBER=$1 diff --git a/plugins/traefik-vhosts/command-functions b/plugins/traefik-vhosts/command-functions index 423256a5c..1df4b90c8 100755 --- a/plugins/traefik-vhosts/command-functions +++ b/plugins/traefik-vhosts/command-functions @@ -111,6 +111,10 @@ cmd-traefik-show-config() { declare cmd="traefik:show-config" [[ "$1" == "$cmd" ]] && shift 1 + if ! fn-is-compose-installed; then + dokku_log_fail "Required docker compose plugin is not installed" + fi + local TMP_COMPOSE_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX") trap "rm -rf '$TMP_COMPOSE_FILE' >/dev/null" RETURN INT TERM EXIT @@ -123,6 +127,10 @@ cmd-traefik-start() { declare cmd="traefik:start" [[ "$1" == "$cmd" ]] && shift 1 + if ! fn-is-compose-installed; then + dokku_log_fail "Required docker compose plugin is not installed" + fi + local TMP_COMPOSE_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX") trap "rm -rf '$TMP_COMPOSE_FILE' >/dev/null" RETURN INT TERM EXIT @@ -137,6 +145,10 @@ cmd-traefik-stop() { declare cmd="traefik:start" [[ "$1" == "$cmd" ]] && shift 1 + if ! fn-is-compose-installed; then + dokku_log_fail "Required docker compose plugin is not installed" + fi + local TMP_COMPOSE_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX") trap "rm -rf '$TMP_COMPOSE_FILE' >/dev/null" RETURN INT TERM EXIT From ee1ab4582931fccd40dfc46c05026006dc886d78 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 5 Nov 2022 23:42:08 -0400 Subject: [PATCH 4/7] refactor: use local architecture version of golang when building the initial manpage file --- contrib/build-dokku.Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/build-dokku.Dockerfile b/contrib/build-dokku.Dockerfile index 89c0042b8..3de8a3178 100644 --- a/contrib/build-dokku.Dockerfile +++ b/contrib/build-dokku.Dockerfile @@ -7,8 +7,8 @@ RUN command -v fpm >/dev/null || sudo gem install fpm --no-ri --no-rdoc ARG GOLANG_VERSION -RUN wget -qO /tmp/go${GOLANG_VERSION}.linux-amd64.tar.gz https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz \ - && tar -C /usr/local -xzf /tmp/go${GOLANG_VERSION}.linux-amd64.tar.gz \ +RUN wget -qO /tmp/go${GOLANG_VERSION}.linux.tar.gz "https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-$(dpkg --print-architecture).tar.gz" \ + && tar -C /usr/local -xzf /tmp/go${GOLANG_VERSION}.linux.tar.gz \ && cp /usr/local/go/bin/* /usr/local/bin ARG WORKDIR=/go/src/github.com/dokku/dokku From a19cef9411bf4494b8821b0cd9f64802a0a27b72 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 5 Nov 2022 23:44:36 -0400 Subject: [PATCH 5/7] fix: install official docker package from docker upstream This ensures the docker version we ship to in the docker image can actually install the docker-compose-plugin. --- Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 748c4f34c..b6215dce8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,13 @@ COPY ./build/package/ /tmp SHELL ["/bin/bash", "-o", "pipefail", "-c"] # hadolint ignore=DL3005,DL3008 -RUN echo "dokku dokku/hostname string $DOKKU_HOSTNAME" | debconf-set-selections \ +RUN mkdir -p /etc/apt/keyrings \ + && mkdir -p /etc/apt/keyrings \ + && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \ + && apt-get update \ + && apt-get -y --no-install-recommends install docker-ce docker-ce-cli containerd.io docker-compose-plugin \ + && echo "dokku dokku/hostname string $DOKKU_HOSTNAME" | debconf-set-selections \ && echo "dokku dokku/skip_key_file boolean $DOKKU_SKIP_KEY_FILE" | debconf-set-selections \ && echo "dokku dokku/vhost_enable boolean $DOKKU_VHOST_ENABLE" | debconf-set-selections \ && curl -sSL https://packagecloud.io/dokku/dokku/gpgkey | apt-key add - \ From 41b971e0679ccf431b3bb16ee7ab4cd0aa051f34 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 6 Nov 2022 00:53:04 -0400 Subject: [PATCH 6/7] fix: add moby-compose as alternative for docker-compose-plugin This is necessary on github actions as they use some weird apt repository that provides docker under the moby name... --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index baa7708c2..43a6e22d2 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Version: 0.28.4 Section: web Priority: optional Architecture: amd64 -Depends: apache2-utils, locales, git, cpio, curl, man-db, netcat, sshcommand (>= 0.12.0), docker-engine-cs (>= 17.05.0) | docker-engine (>= 17.05.0) | docker-io (>= 17.05.0) | docker.io (>= 17.05.0) | docker-ce (>= 17.05.0) | docker-ee (>= 17.05.0) | moby-engine, docker-compose-plugin, docker-image-labeler (>= 0.2.2), lambda-builder, net-tools, netrc, software-properties-common, parallel, procfile-util (>= 0.11.0), python-software-properties | python3-software-properties, rsync, rsyslog, dos2unix, jq, unzip +Depends: apache2-utils, locales, git, cpio, curl, man-db, netcat, sshcommand (>= 0.12.0), docker-engine-cs (>= 17.05.0) | docker-engine (>= 17.05.0) | docker-io (>= 17.05.0) | docker.io (>= 17.05.0) | docker-ce (>= 17.05.0) | docker-ee (>= 17.05.0) | moby-engine, docker-compose-plugin | moby-compose, docker-image-labeler (>= 0.2.2), lambda-builder, net-tools, netrc, software-properties-common, parallel, procfile-util (>= 0.11.0), python-software-properties | python3-software-properties, rsync, rsyslog, dos2unix, jq, unzip Recommends: herokuish (>= 0.3.4), bash-completion, dokku-update, dokku-event-listener Pre-Depends: gliderlabs-sigil, nginx (>= 1.8.0) | openresty, dnsutils, cgroupfs-mount | cgroup-lite, plugn (>= 0.3.0), sudo, python3, debconf Maintainer: Jose Diaz-Gonzalez From 4a9bdd6dc278ad7b1e589a2a4ba80a94fbd7971a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 7 Nov 2022 10:07:48 -0500 Subject: [PATCH 7/7] fix: add missing {{end}} to docker format template --- plugins/common/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/common/functions b/plugins/common/functions index 232a31c27..1261774a6 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -402,7 +402,7 @@ get_docker_version() { fn-is-compose-installed() { declare desc="check if the compose docker plugin is installed" local COMPOSE_INSTALLED - COMPOSE_INSTALLED="$(docker info -f '{{range .ClientInfo.Plugins}}{{if eq .Name "compose"}}true{{end}}')" + COMPOSE_INSTALLED="$(docker info -f '{{range .ClientInfo.Plugins}}{{if eq .Name "compose"}}true{{end}}{{end}}')" if [[ "$COMPOSE_INSTALLED" == "true" ]]; then return 0