Skip to content

Commit faa7ebd

Browse files
authored
dietpi-software: Portainer: handle BE correctly (#7832)
1 parent f72e249 commit faa7ebd

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ v9.20
44
Enhancement:
55
- Orange Pi 5/Max/Ultra | Our images ship now with all USB-A ports and, depending on model, one USB-C port enabled in host mode, making them functional for USB devices. This is done with a device tree overlay "dwc3-host". Removing it from /boot/dietpiEnv.txt reverts the affected port(s), which share one controller, to their default OTG mode, in which case attached USB devices are not detected or even powered. For existing instances, add "dwc3-host" to the "overlays=" line in /boot/dietpiEnv.txt to apply this change. Many thanks to @DiegoBM and @pavel-kamaev for reporting this issue: https://github.com/MichaIng/DietPi/issues/7738
66
- DietPi-Banner | A workaround for ACLs applied at an NFSv4 mount target has been applied. If ACLs are applied e.g. recursively at the NFS server, they are translated and exposed as special NFSv4 ACLs at the client, which is incompatible with POSIX ACLs. The "cp -a/--archive" used to special handle /etc/debian_version tries and hence fails to preserve them. "rsync -a/--archive" does not imply ACLs, hence does not suffer from the issue. It may be able to handle them better using its "-A/--acls" flag. However, ACLs applied at the NFS server of course must not be applied at the restored OS anyway, hence we just skip the "cp -a" flag now. The default root:root 0644 mode is anyway what /etc/debian_version is intended to be, and an updated mtime does not hurt. Preserving ACLs and xattr for system backups would be actually a good feature, but at least doing this for backups to NFS mounts hence is risky. For this, we'd first need to implement an option to create and transfer a tarball of the backup at the client, and compression as logical addition with it. "tar" has an "--acls" option as well. Many thanks to @miloit for reporting the related error: https://github.com/MichaIng/DietPi/issues/7825
7+
- DietPi-Software | Portainer: On (re)installs, existing Portainer BE (Business Edition) instances are now detected and updated correctly. When entering a license key in Portainer CE (Community Edition), it upgrades itself to BE. dietpi-software however detected and updated CE instances only, causing a failure if it was upgraded to BE. Many thanks to @salieri for reporting this issue: https://dietpi.com/forum/t/24696
78

89
Bug fixes:
910
- Orange Pi 5 | Resolved an issue where USB and M.2 SSD boots took very long or failed, and reboots failed, at least in some cases. Credits go to @efectn from Armbian for switching from vendor U-Boot to mainline U-Boot, which solved all issues. Many thanks to @Renoria for reporting this issue: https://dietpi.com/forum/t/24613

dietpi/dietpi-software

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11935,16 +11935,18 @@ _EOF_
1193511935

1193611936
if To_Install 185 # Portainer
1193711937
then
11938-
# Check for existing Portainer container
11939-
local container=$(docker container ls -a | mawk '/portainer\/portainer(-ce)?( |$)/{print $1;exit}')
11938+
# Remove existing container and image, including CE, BE, and old v1, and store image repo in variable to preserve BE instances
11939+
local container=$(docker container ls -aqf 'ancestor=portainer/portainer' -f 'ancestor=portainer/portainer-ce' -f 'ancestor=portainer/portainer-ee') image repo
1194011940
[[ $container ]] && G_EXEC docker container rm -f "$container"
11941-
local image=$(docker image ls -a | mawk '/portainer\/portainer(-ce)?( |$)/{print $3;exit}')
11941+
read -r image repo < <(docker image ls -af 'reference=portainer/portainer' -f 'reference=portainer/portainer-ce' -f 'reference=portainer/portainer-ee' --format '{{.ID}} {{.Repository}}')
1194211942
[[ $image ]] && G_EXEC docker image rm "$image"
11943-
docker volume ls -q | grep -xq 'portainer_data' || G_EXEC docker volume create portainer_data
1194411943

11945-
# Deploy the Portainer container
11946-
G_DIETPI-NOTIFY 2 'Portainer will be deployed now. This could take a while...'
11947-
G_EXEC_OUTPUT=1 G_EXEC docker run -d -p '9002:9000' -p '9442:9443' --name=portainer --restart=always -v '/run/docker.sock:/var/run/docker.sock' -v '/etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt:ro' -v 'portainer_data:/data' 'portainer/portainer-ce'
11944+
# Create volume if it does not exist yet
11945+
[[ $(docker volume ls -qf 'name=^portainer_data$') ]] || G_EXEC docker volume create portainer_data
11946+
11947+
# Deploy new Portainer container, migrate v1 to CE and preserve BE
11948+
[[ $repo == 'portainer/portainer-ee' ]] || repo='portainer/portainer-ce'
11949+
G_EXEC_OUTPUT=1 G_EXEC docker run -d -p '9002:9000' -p '9442:9443' --name=portainer --restart=always -v '/run/docker.sock:/var/run/docker.sock' -v '/etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt:ro' -v 'portainer_data:/data' "$repo"
1194811950
fi
1194911951

1195011952
if To_Install 141 adsb-setup adsb-docker # ADS-B Feeder
@@ -14017,12 +14019,11 @@ _EOF_
1401714019
# Check if Docker is still installed
1401814020
if [[ -d '/mnt/dietpi_userdata/docker-data' ]]
1401914021
then
14020-
# Remove Portainer container, image & volume
14021-
local container=$(docker container ls -a | mawk '/portainer\/portainer(-ce)?( |$)/{print $1;exit}')
14022+
local container=$(docker container ls -aqf 'ancestor=portainer/portainer' -f 'ancestor=portainer/portainer-ce' -f 'ancestor=portainer/portainer-ee')
1402214023
[[ $container ]] && G_EXEC docker container rm -f "$container"
14023-
local image=$(docker image ls -a | mawk '/portainer\/portainer(-ce)?( |$)/{print $3;exit}')
14024+
local image=$(docker image ls -aqf 'reference=portainer/portainer' -f 'reference=portainer/portainer-ce' -f 'reference=portainer/portainer-ee')
1402414025
[[ $image ]] && G_EXEC docker image rm "$image"
14025-
docker volume ls -q | grep -xq 'portainer_data' && G_EXEC docker volume rm 'portainer_data'
14026+
[[ $(docker volume ls -qf 'name=^portainer_data$') ]] && G_EXEC docker volume rm 'portainer_data'
1402614027
fi
1402714028
fi
1402814029

0 commit comments

Comments
 (0)