chore: drop unsupported operating systems

We will no longer support CentOS, Fedora, and Opensuse as installation targets. These are not actively maintained by anyone with commit rights and occasionally cause issues for users as they are not tested during the release process.

Rather than have subpar support for an untested operating system, we're removing support for them completely. Users of these operating systems should take a look migration to the docker-based installation method, which will always be tested and supported by the project.

Additionally, drop support for Debian 9 as it is now EOL.
This commit is contained in:
Jose Diaz-Gonzalez
2022-07-05 00:13:55 -04:00
parent 0835e7706f
commit 70fc35c317
23 changed files with 35 additions and 295 deletions

View File

@@ -31,7 +31,7 @@
> For problems affecting all applications, the report output for a broken application is useful for our debugging.
> In these cases, you may run `dokku report` without any arguments to display the top-level reporting information.
### How (deb/make/rpm) and where (AWS, VirtualBox, physical, etc.) was Dokku installed?
### How (deb/make) and where (AWS, VirtualBox, physical, etc.) was Dokku installed?
### Additional information

View File

@@ -41,7 +41,6 @@ include common.mk
include tests.mk
include package.mk
include deb.mk
include rpm.mk
include arch.mk
all:

View File

@@ -75,8 +75,7 @@ Support us with a monthly donation and help us continue our activities. [[Become
A fresh VM running any of the following operating systems:
- Ubuntu 18.04 / 20.04 / 22.04 x64 - Any currently supported release
- Debian 9+ x64
- CentOS 7 x64 *(experimental)*
- Debian 10+ x64
- Arch Linux x64 *(experimental)*
An SSH keypair that can be used for application deployment. If this exists before installation, it will be automatically imported into dokku.

11
Vagrantfile vendored
View File

@@ -87,22 +87,13 @@ Vagrant::configure("2") do |config|
vm.vm.provision :shell, :inline => "cd /root/dokku && make install-from-deb"
end
config.vm.define "dokku-rpm", autostart: false do |vm|
vm.vm.box = "centos/7"
vm.vm.synced_folder File.dirname(__FILE__), "/root/dokku"
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "cd /root/dokku && bash bootstrap.sh"
end
config.vm.define "build", autostart: false do |vm|
vm.vm.synced_folder File.dirname(__FILE__), "/root/dokku"
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "export DEBIAN_FRONTEND=noninteractive && apt-get update -qq >/dev/null && apt-get -qq -y --no-install-recommends install git >/dev/null && cd /root/dokku && #{make_cmd}"
vm.vm.provision :shell, :inline => "export IS_RELEASE=true && cd /root/dokku && make deb-all rpm-all"
vm.vm.provision :shell, :inline => "export IS_RELEASE=true && cd /root/dokku && make deb-all"
end
config.vm.define "build-arch", autostart: false do |vm|

View File

@@ -3,7 +3,7 @@ set -eo pipefail
[[ $TRACE ]] && set -x
# A script to bootstrap dokku.
# It expects to be run on Ubuntu 18.04/20.04, or CentOS 7 via 'sudo'
# It expects to be run on Ubuntu 18.04/20.04 via 'sudo`
# If installing a tag higher than 0.3.13, it may install dokku via a package (so long as the package is higher than 0.3.13)
# It checks out the dokku source code from GitHub into ~/dokku and then runs 'make install' from dokku source.
@@ -12,7 +12,7 @@ set -eo pipefail
# That's good because it prevents our output overlapping with wget's.
# It also means that we can't run a partially downloaded script.
SUPPORTED_VERSIONS="Debian [9, 10, 11], CentOS [7], Fedora (partial) [33, 34], Ubuntu [18.04, 20.04, 22.04]"
SUPPORTED_VERSIONS="Debian [10, 11], Ubuntu [18.04, 20.04, 22.04]"
log-fail() {
declare desc="log fail formatter"
@@ -139,9 +139,6 @@ install-dokku-from-package() {
debian | ubuntu)
install-dokku-from-deb-package "$@"
;;
centos | fedora | rhel)
install-dokku-from-rpm-package "$@"
;;
*)
log-fail "Unsupported Linux distribution. For manual installation instructions, consult https://dokku.com/docs/getting-started/advanced-installation/"
;;
@@ -163,7 +160,7 @@ install-dokku-from-deb-package() {
local NO_INSTALL_RECOMMENDS=${DOKKU_NO_INSTALL_RECOMMENDS:=""}
local OS_ID
if ! in-array "$DOKKU_DISTRO_VERSION" "18.04" "20.04" "22.04" "9" "10" "11"; then
if ! in-array "$DOKKU_DISTRO_VERSION" "18.04" "20.04" "22.04" "10" "11"; then
log-fail "Unsupported Linux distribution. Only the following versions are supported: $SUPPORTED_VERSIONS"
fi
@@ -231,35 +228,6 @@ install-dokku-from-deb-package() {
fi
}
install-dokku-from-rpm-package() {
local DOKKU_CHECKOUT="$1"
if ! in-array "$DOKKU_DISTRO_VERSION" "7"; then
log-fail "Unsupported Linux distribution. Only the following versions are supported: $SUPPORTED_VERSIONS"
fi
echo "--> Installing docker"
curl -fsSL https://get.docker.com/ | sh
echo "--> Installing epel for nginx packages to be available"
yum install -y epel-release
echo "--> Installing herokuish and dokku"
curl -s https://packagecloud.io/install/repositories/dokku/dokku/script.rpm.sh | bash
if [[ -n $DOKKU_CHECKOUT ]]; then
yum -y install herokuish "dokku-$DOKKU_CHECKOUT"
else
yum -y install herokuish dokku
fi
echo "--> Enabling docker and nginx on system startup"
systemctl enable docker
systemctl enable nginx
echo "--> Starting nginx"
systemctl start nginx
}
main() {
export DOKKU_DISTRO DOKKU_DISTRO_VERSION
# shellcheck disable=SC1091

View File

@@ -18,7 +18,7 @@ WORKDIR ${WORKDIR}
COPY Makefile ${WORKDIR}/
COPY *.mk ${WORKDIR}/
RUN make deb-setup rpm-setup sshcommand plugn
RUN make deb-setup sshcommand plugn
COPY . ${WORKDIR}
@@ -37,7 +37,7 @@ RUN PLUGIN_MAKE_TARGET=${PLUGIN_MAKE_TARGET} \
IS_RELEASE=${IS_RELEASE} \
SKIP_GO_CLEAN=true \
make version copyfiles \
&& make deb-dokku rpm-dokku
&& make deb-dokku
FROM builder as armhf

View File

@@ -134,7 +134,6 @@ fn-publish-package() {
local OS_ID ex
[[ "$IS_RELEASE" == "true" ]] && REPOSITORY=dokku/dokku
[[ "$RELEASE_TYPE" == "rpm" ]] && DIST=el/7
[[ "$RELEASE_TYPE" == "raspbian" ]] && DIST=raspbian
if [[ "$RELEASE_TYPE" == "raspbian" ]]; then
@@ -159,7 +158,7 @@ fn-publish-package() {
done
DIST=debian
OS_IDS=("stretch" "buster" "bullseye")
OS_IDS=("buster" "bullseye")
for OS_ID in "${OS_IDS[@]}"; do
log-info "(release-dokku) pushing ${RELEASE_TYPE} to packagecloud.com/${REPOSITORY}/${DIST}"
package_cloud push "${REPOSITORY}/${DIST}/${OS_ID}" "$PACKAGE_NAME"
@@ -408,18 +407,15 @@ main() {
fn-extract-package "$IS_RELEASE" "dokku_${NEXT_VERSION}_armhf.deb" || log-fail "Error extracting deb package"
fn-extract-package "$IS_RELEASE" "dokku_${NEXT_VERSION}_arm64.deb" || log-fail "Error extracting deb package"
fn-extract-package "$IS_RELEASE" "dokku_${NEXT_VERSION}_amd64.deb" || log-fail "Error extracting deb package"
fn-extract-package "$IS_RELEASE" "dokku-${NEXT_VERSION}-1.x86_64.rpm" || log-fail "Error extracting rpm package"
mkdir -p build/package
cp -f "build/dokku_${NEXT_VERSION}_amd64.deb" build/package/dokku-amd64.deb
cp -f "build/dokku_${NEXT_VERSION}_arm64.deb" build/package/dokku-arm64.deb
cp -f "build/dokku_${NEXT_VERSION}_armhf.deb" build/package/dokku-armhf.deb
cp -f "build/dokku-${NEXT_VERSION}-1.x86_64.rpm" build/package/dokku-amd64.rpm
if [[ "$RELEASE" != "build" ]]; then
fn-publish-package "$IS_RELEASE" "raspbian" "build/dokku_${NEXT_VERSION}_armhf.deb" || log-fail "Error publishing deb package"
fn-publish-package "$IS_RELEASE" "deb" "build/dokku_${NEXT_VERSION}_arm64.deb" || log-fail "Error publishing deb package"
fn-publish-package "$IS_RELEASE" "deb" "build/dokku_${NEXT_VERSION}_amd64.deb" || log-fail "Error publishing deb package"
fn-publish-package "$IS_RELEASE" "rpm" "build/dokku-${NEXT_VERSION}-1.x86_64.rpm" || log-fail "Error publishing rpm package"
fn-build-docker-image "$NEXT_VERSION" "$IS_RELEASE" || log-fail "Error building docker image"
fn-repo-push-tags "$IS_RELEASE"

View File

@@ -0,0 +1,18 @@
# 0.28.0 Migration Guide
## Removals
Support for the following operating systems has been removed:
- CentOS 7
- Debian 9 (Stretch)
- Fedora
- OpenSuse
Dokku will no longer provide packages for RPM based systems. Debian 9 users _may_ use new Debian packages, though support is not guaranteed.
All users are encouraged to install Dokku via the [Docker-based installation method](/docs/getting-started/install/docker.md), or switch to a supported operating system.
## Deprecations
Ubuntu 18.04 is now a deprecated installation target. The operating system will be considered EOL by Canonical in April 2023. Users are encouraged to upgrade to Ubuntu 22.04 or consider switching their instllation method to the [Docker-based installation method](/docs/getting-started/install/docker.md) to avoid any disruption in usage.

View File

@@ -441,7 +441,6 @@ DOKKU_SCHEDULER="$1"
```shell
#!/usr/bin/env bash
# Installs nginx for the current plugin
# Supports both opensuse and ubuntu
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
@@ -451,9 +450,8 @@ case "$DOKKU_DISTRO" in
debian|raspbian|ubuntu)
apt-get -qq -y --no-install-recommends install nginx
;;
opensuse)
zypper -q in -y nginx
*)
echo "Installation on $DOKKU_DISTRO not supported" 1>&2
;;
esac
```

View File

@@ -12,7 +12,6 @@ As well, you may wish to customize your installation in some other fashion. or e
- [Debian Package Installation Notes](/docs/getting-started/install/debian.md)
- [Docker-based Installation Notes](/docs/getting-started/install/docker.md)
- [RPM Package Installation Notes](/docs/getting-started/install/rpm.md)
- [Vagrant Installation Notes](/docs/getting-started/install/vagrant.md)
- [Advanced Install Customization](/docs/getting-started/advanced-installation.md)
- [Automated deployment via ansible](https://github.com/dokku/ansible-dokku)

View File

@@ -1,27 +0,0 @@
# RPM Package Installation Notes
> New as of 0.8.0 *(experimental)*
> **Warning:** Web installer is not available on CentOS. You will need to configure [SSH keys](/docs/deployment/user-management.md#adding-ssh-keys) and [virtual hosts](/docs/configuration/domains.md#customizing-hostnames) using dokku command line interface.
Dokku defaults to being installed via RPM package on CentOS 7. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of Dokku without the use of our `bootstrap.sh` Bash script. The following are the steps run by said script:
```shell
# Install docker
curl -fsSL https://get.docker.com/ | sh
# Install epel for nginx packages to be available
sudo yum install -y epel-release
# Install dokku
curl -s https://packagecloud.io/install/repositories/dokku/dokku/script.rpm.sh | sudo bash
sudo yum install -y herokuish dokku
sudo dokku plugin:install-dependencies --core
systemctl start nginx
# Enable docker and nginx on system startup
systemctl enable docker
systemctl enable nginx
```
The [devicemapper](https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/) is the default Docker storage driver on CentOS 7 and defaults to a configuration mode known as `loop-lvm`. This mode is designed to work out-of-the-box with no additional configuration. However, production deployments should not run under `loop-lvm` mode. The preferred configuration for production deployments is [`direct-lvm`](https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/#/configure-direct-lvm-mode-for-production).

View File

@@ -10,8 +10,7 @@ To start using Dokku, you'll need a system that meets the following minimum requ
- A fresh installation of any of the following operating systems:
- [Ubuntu 18.04/20.04/22.04](https://www.ubuntu.com/download)
- [Debian 9+ x64](https://www.debian.org/distrib/)
- [CentOS 7 x64](https://www.centos.org/download/) *(experimental)*
- [Debian 10+ x64](https://www.debian.org/distrib/)
- A server with one of the following architectures
- AMD64 (alternatively known as `x86_64`), commonly used for Intel cloud servers
- ARMV7 (alternatively known as `armhf`), commonly used for Raspberry PI

View File

@@ -9,13 +9,6 @@ While we hate to see you go, if you need to uninstall Dokku, the following may h
yay -Rsn dokku
```
## CentOS Uninstallation
```shell
# uninstall dokku
yum remove dokku herokuish
```
## Debian Uninstallation
```shell

View File

@@ -9,7 +9,6 @@ For any security related updates, please follow our [Twitter account](https://tw
Your operating system may occasionally provide security updates. We recommend setting unattended upgrades for your operating system. Here are some helpful links:
- [Arch Linux System Maintenance](https://wiki.archlinux.org/index.php/System_maintenance)
- [CentOS Automatic Security Updates](https://serversforhackers.com/c/automatic-security-updates-centos)
- [Debian Unattended Upgrades](https://wiki.debian.org/UnattendedUpgrades)
- [Ubuntu Unattended Upgrades](https://help.ubuntu.com/community/AutomaticSecurityUpdates)

View File

@@ -17,7 +17,7 @@ trigger-events-install() {
# shellcheck disable=SC2174
mkdir -m 775 -p "$DOKKU_LOGS_DIR"
case "$DOKKU_DISTRO" in
arch | debian | centos | fedora | raspbian | rhel)
arch | debian | raspbian)
chgrp dokku "$DOKKU_LOGS_DIR"
;;
*)
@@ -28,7 +28,7 @@ trigger-events-install() {
if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then
touch "$DOKKU_EVENTS_LOGFILE"
case "$DOKKU_DISTRO" in
arch | debian | centos | fedora | raspbian | rhel)
arch | debian | raspbian)
chgrp dokku "$DOKKU_EVENTS_LOGFILE"
;;
*)

View File

@@ -213,16 +213,8 @@ func SetPermissions(path string, fileMode os.FileMode) error {
func WriteSliceToFile(filename string, lines []string) error {
mode := os.FileMode(0600)
if strings.HasPrefix(filename, "/etc/sudoers.d/") {
// sudoers files should be either 0600 (rhel) or 0440 (debian)
defaultMode := map[string]bool{
"centos": true,
"fedora": true,
"rhel": true,
}
if !defaultMode[os.Getenv("DOKKU_DISTRO")] {
mode = os.FileMode(0440)
}
}
file, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, mode)
if err != nil {

View File

@@ -1,23 +1,12 @@
package cron
import (
"os"
"github.com/dokku/dokku/plugins/common"
)
// TriggerInstall installs a sudoers file so we can execute crontab via sudo
func TriggerInstall() error {
lines := []string{"%dokku ALL=(ALL) NOPASSWD:/usr/bin/crontab"}
notty := map[string]bool{
"centos": true,
"fedora": true,
"rhel": true,
}
if notty[os.Getenv("DOKKU_DISTRO")] {
lines = append(lines, "Defaults:dokku !requiretty")
}
return common.WriteSliceToFile("/etc/sudoers.d/dokku-cron", lines)
}

View File

@@ -62,10 +62,6 @@ trigger-nginx-vhosts-dependencies() {
nginx_install
;;
opensuse)
zypper -q in -y nginx bind-utils
;;
arch)
pacman -S --noconfirm --noprogressbar --needed nginx bind-tools
;;

View File

@@ -38,19 +38,9 @@ trigger-nginx-vhosts-install() {
fi
;;
opensuse)
echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service $NGINX_INIT_NAME reload, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
;;
arch)
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
;;
centos | fedora | rhel)
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
echo "Defaults:dokku !requiretty" >>"$NGINX_SUDOERS_FILE"
mode="0600"
;;
esac
chmod "$mode" "$NGINX_SUDOERS_FILE"

View File

@@ -115,11 +115,7 @@ fn-nginx-vhosts-nginx-init-cmd() {
fi
;;
opensuse)
sudo /sbin/service "$NGINX_INIT_NAME" "$CMD"
;;
arch | centos | fedora | rhel)
arch)
sudo /usr/bin/systemctl "$CMD" "$NGINX_INIT_NAME"
;;
esac

View File

@@ -12,17 +12,10 @@ trigger-storage-install() {
STORAGE_SUDOERS_FILE="/etc/sudoers.d/dokku-storage"
local mode="0440"
case "$DOKKU_DISTRO" in
arch | debian | opensuse | raspbian | ubuntu)
arch | debian | raspbian | ubuntu)
echo "%dokku ALL=(ALL) NOPASSWD:$PLUGIN_AVAILABLE_PATH/storage/bin/chown-storage-dir *" >"$STORAGE_SUDOERS_FILE"
echo "Defaults env_keep += \"DOKKU_LIB_ROOT\"" >>"$STORAGE_SUDOERS_FILE"
;;
centos | fedora | rhel)
echo "%dokku ALL=(ALL) NOPASSWD:$PLUGIN_AVAILABLE_PATH/storage/bin/chown-storage-dir *" >"$STORAGE_SUDOERS_FILE"
echo "Defaults:dokku !requiretty" >>"$STORAGE_SUDOERS_FILE"
echo "Defaults env_keep += \"DOKKU_LIB_ROOT\"" >>"$STORAGE_SUDOERS_FILE"
mode="0600"
;;
esac
chmod "$mode" "$STORAGE_SUDOERS_FILE"

57
rpm.mk
View File

@@ -1,57 +0,0 @@
RPM_ARCHITECTURE = x86_64
DOKKU_RPM_PACKAGE_NAME = dokku-$(DOKKU_VERSION)-1.$(RPM_ARCHITECTURE).rpm
.PHONY: rpm-all
rpm-all: rpm-setup rpm-dokku
mv /tmp/*.rpm .
@echo "Done"
rpm-setup:
@echo "-> Installing rpm build requirements"
@sudo apt-get update -qq >/dev/null
@sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get -qq -y --no-install-recommends install gcc git build-essential wget ruby-dev ruby1.9.1 rpm >/dev/null 2>&1
@command -v fpm >/dev/null || sudo gem install fpm --no-ri --no-rdoc
@ssh -o StrictHostKeyChecking=no git@github.com || true
rpm-dokku: /tmp/build-dokku/var/lib/dokku/GIT_REV
rm -f $(BUILD_DIRECTORY)/dokku_*_$(RPM_ARCHITECTURE).rpm
cat /tmp/build-dokku/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build-dokku/var/lib/dokku/STABLE_VERSION
ifneq (,$(findstring false,$(IS_RELEASE)))
sed -i.bak -e "s/^/`date +%s`-/" /tmp/build-dokku/var/lib/dokku/STABLE_VERSION && rm /tmp/build-dokku/var/lib/dokku/STABLE_VERSION.bak
endif
@echo "-> Creating rpm package"
VERSION=$$(cat /tmp/build-dokku/var/lib/dokku/STABLE_VERSION); \
sudo fpm -t rpm -s dir -C /tmp/build-dokku -n dokku \
--version "$$VERSION" \
--architecture $(RPM_ARCHITECTURE) \
--package "$(BUILD_DIRECTORY)/$(DOKKU_RPM_PACKAGE_NAME)" \
--depends '/usr/bin/docker' \
--depends 'bind-utils' \
--depends 'cpio' \
--depends 'curl' \
--depends 'dos2unix' \
--depends 'docker-image-labeler >= 0.2.2' \
--depends 'git' \
--depends 'gliderlabs-sigil' \
--depends 'jq' \
--depends 'man-db' \
--depends 'nc' \
--depends 'netrc' \
--depends 'nginx >= 1.8.0' \
--depends 'parallel' \
--depends 'plugn' \
--depends 'procfile-util >= 0.11.0' \
--depends 'rsync' \
--depends '/usr/bin/python3' \
--depends 'sshcommand >= 0.11.0' \
--depends 'sudo' \
--depends 'unzip' \
--after-install rpm/dokku.postinst \
--url "https://github.com/$(DOKKU_REPO_NAME)" \
--description $(DOKKU_DESCRIPTION) \
--license 'MIT License' \
.

View File

@@ -1,91 +0,0 @@
#!/usr/bin/env bash
set +o posix # rpm uses /bin/sh that forces bash in posix mode
set -eo pipefail; [[ $TRACE ]] && set -x
setup-user() {
echo "Setting up dokku user"
getent passwd dokku >/dev/null || useradd -m -s /bin/bash dokku
usermod -aG docker dokku
mkdir -p "$DOKKU_ROOT/.ssh" "$DOKKU_ROOT/.dokkurc"
touch "$DOKKU_ROOT/.ssh/authorized_keys"
chown -R dokku:dokku "$DOKKU_ROOT/.ssh" "${DOKKU_ROOT}/.dokkurc"
}
setup-storage() {
echo "Setting up storage directories"
mkdir -p "${DOKKU_LIB_ROOT}/data" "${DOKKU_LIB_ROOT}/data/storage"
chown dokku:dokku -R "${DOKKU_LIB_ROOT}/data"
}
setup-plugins() {
echo "Deleting invalid plugins"
if [ -f "${DOKKU_LIB_ROOT}/core-plugins/available/" ]; then
find "${DOKKU_LIB_ROOT}/core-plugins/available/" -type d -empty -delete
fi
if [ -f "${DOKKU_LIB_ROOT}/core-plugins/enabled/" ]; then
find "${DOKKU_LIB_ROOT}/core-plugins/enabled/" -type d -empty -delete
fi
if [ -f "${DOKKU_LIB_ROOT}/plugins/available/" ]; then
find "${DOKKU_LIB_ROOT}/plugins/available/" -type d -empty -delete
fi
if [ -f "${DOKKU_LIB_ROOT}/plugins/enabled/" ]; then
find "${DOKKU_LIB_ROOT}/plugins/enabled/" -type d -empty -delete
fi
echo "Setting up plugin directories"
# should be replaced by `plugn init`
mkdir -p "${DOKKU_LIB_ROOT}/core-plugins/available" "${DOKKU_LIB_ROOT}/plugins/available"
mkdir -p "${DOKKU_LIB_ROOT}/core-plugins/enabled" "${DOKKU_LIB_ROOT}/plugins/enabled"
touch "${DOKKU_LIB_ROOT}/core-plugins/config.toml" "${DOKKU_LIB_ROOT}/plugins/config.toml"
echo "Migrating old plugins"
find ${DOKKU_LIB_ROOT}/plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do
if [ "$plugin" = "available" ] || [ "$plugin" = "enabled" ]; then
continue
elif [ -f ${DOKKU_LIB_ROOT}/plugins/$plugin/.core ]; then
rm -rf ${DOKKU_LIB_ROOT}/plugins/$plugin
elif [ ! -d ${DOKKU_LIB_ROOT}/plugins/available/$plugin ]; then
mv ${DOKKU_LIB_ROOT}/plugins/$plugin ${DOKKU_LIB_ROOT}/plugins/available
fi
done
echo "Enabling all core plugins"
find "${DOKKU_LIB_ROOT}/core-plugins/available" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do
if [ ! -d "${DOKKU_LIB_ROOT}/plugins/available/$plugin" ]; then
ln -s "${DOKKU_LIB_ROOT}/core-plugins/available/$plugin" "${DOKKU_LIB_ROOT}/plugins/available/$plugin"
PLUGIN_PATH="${DOKKU_LIB_ROOT}/core-plugins" plugn enable "$plugin"
PLUGIN_PATH="${DOKKU_LIB_ROOT}/plugins" plugn enable "$plugin"
fi
done
find -L "${DOKKU_LIB_ROOT}" -type l -delete
chown dokku:dokku -R "${DOKKU_LIB_ROOT}/plugins" "${DOKKU_LIB_ROOT}/core-plugins"
echo "Install all core plugins"
dokku plugin:install --core
}
setup-sshcommand() {
echo "Ensure proper sshcommand path"
echo '/usr/bin/dokku' >"${DOKKU_ROOT}/.sshcommand"
if [[ -f .ssh/authorized_keys ]]; then
sed -i.bak 's#/usr/local/bin/dokku#/usr/bin/dokku#' "${DOKKU_ROOT}/.ssh/authorized_keys"
rm "${DOKKU_ROOT}/.ssh/authorized_keys"
fi
}
main() {
if [[ -r /etc/default/dokku ]]; then
# shellcheck disable=SC1091
source /etc/default/dokku
fi
readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}"
readonly DOKKU_LIB_ROOT="${DOKKU_LIB_PATH:-/var/lib/dokku}"
setup-user
setup-storage
setup-plugins
setup-sshcommand
}
main