From 247d522b7ee379e19bce92d80785999db5d99b79 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 22 Nov 2025 20:25:22 -0500 Subject: [PATCH] feat: enable live-restore by default when installing Dokku This will help users have more seamless upgrades in the future in cases where docker is restarted. --- debian/control | 4 ++-- debian/postinst | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 9fa5ff11d..82b6eeaa4 100644 --- a/debian/control +++ b/debian/control @@ -3,9 +3,9 @@ Version: 0.37.0 Section: web Priority: optional Architecture: amd64 -Depends: apache2-utils, locales, git, cpio, cron, curl, man-db, netcat, sshcommand, docker-engine-cs (>= 19.03.0) | docker-engine (>= 19.03.0) | docker-io (>= 19.03.0) | docker.io (>= 19.03.0) | docker-ce (>= 19.03.0) | docker-ee (>= 19.03.0) | moby-engine, docker-compose-plugin | moby-compose, docker-buildx-plugin | moby-buildx, docker-container-healthchecker, docker-image-labeler, lambda-builder, net-tools, netrc, parallel, procfile-util, rsync, dos2unix, jq, unzip, util-linux +Depends: apache2-utils, locales, git, cpio, cron, curl, man-db, netcat, sshcommand, docker-engine-cs (>= 19.03.0) | docker-engine (>= 19.03.0) | docker-io (>= 19.03.0) | docker.io (>= 19.03.0) | docker-ce (>= 19.03.0) | docker-ee (>= 19.03.0) | moby-engine, docker-compose-plugin | moby-compose, docker-buildx-plugin | moby-buildx, docker-container-healthchecker, docker-image-labeler, lambda-builder, net-tools, netrc, parallel, procfile-util, rsync, dos2unix, unzip, util-linux Recommends: herokuish, bash-completion, dokku-update, dokku-event-listener -Pre-Depends: gliderlabs-sigil, nginx (>= 1.8.0) | openresty, bind9-dnsutils, debconf, plugn, sudo, python3, rsyslog +Pre-Depends: gliderlabs-sigil, jq, nginx (>= 1.8.0) | openresty, bind9-dnsutils, debconf, plugn, sudo, python3, rsyslog Maintainer: Jose Diaz-Gonzalez Description: Docker-powered PaaS that helps build and manage the lifecycle of applications Dokku is an extensible, open source Platform as a Service diff --git a/debian/postinst b/debian/postinst index 6e6976f08..3abf72ddb 100755 --- a/debian/postinst +++ b/debian/postinst @@ -24,6 +24,39 @@ call-sshcommand() { fi } +setup-docker-live-restore() { + # skip if running in docker-based installation + if [[ "$DOKKU_INIT_SYSTEM" == "sv" ]]; then + return + fi + + # allow disabling via /etc/default/dokku + if [[ "$DOKKU_LIVE_RESTORE" == "false" ]]; then + return + fi + + live_restore="$(docker info --format '{{ .LiveRestoreEnabled }}' || true)" + if [ "$live_restore" = "true" ]; then + echo "Docker live-restore is already enabled" + return + fi + + echo "Enabling docker live-restore" + if [[ ! -f /etc/docker/daemon.json ]]; then + echo "{}" >/etc/docker/daemon.json + fi + + config="$(jq '. + {"live-restore": true}' /etc/docker/daemon.json)" + echo "$config" >/etc/docker/daemon.json + if command -v systemctl &>/dev/null; then + if ! systemctl reload docker; then + echo "Unable to reload docker, please reload manually" 1>&2 + fi + else + echo "Unable to reload docker, please reload manually" 1>&2 + fi +} + setup-user() { echo "Setting up dokku user" call-sshcommand create dokku /usr/bin/dokku @@ -135,6 +168,7 @@ case "$1" in dpkg-handling setup-plugins setup-sshcommand + setup-docker-live-restore ;; *)