diff --git a/portainer-business/data/docker/.gitkeep b/portainer-business/data/docker/.gitkeep new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/portainer-business/data/docker/.gitkeep @@ -0,0 +1 @@ + diff --git a/portainer-business/data/portainer/.gitkeep b/portainer-business/data/portainer/.gitkeep new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/portainer-business/data/portainer/.gitkeep @@ -0,0 +1 @@ + diff --git a/portainer-business/default-password b/portainer-business/default-password new file mode 100644 index 000000000..c616260b2 --- /dev/null +++ b/portainer-business/default-password @@ -0,0 +1 @@ +changeme \ No newline at end of file diff --git a/portainer-business/docker-compose.yml b/portainer-business/docker-compose.yml new file mode 100644 index 000000000..73cd0278f --- /dev/null +++ b/portainer-business/docker-compose.yml @@ -0,0 +1,40 @@ +services: + app_proxy: + environment: + APP_HOST: portainer-business_portainer_1 + APP_PORT: 9000 + PROXY_AUTH_ADD: "false" + + docker: + image: docker:27.2.0-dind@sha256:f9f72ad901a78f27be922b2d320bbc263174f12919c1b37e6a01f828fa904565 + privileged: true + network_mode: host + stop_grace_period: 1m + restart: on-failure + environment: + # Own bridge and range so containers here don't clash with the dind0 + # bridge (10.32.0.0/16) that the Portainer CE app and other dind apps share. + DOCKER_ENSURE_BRIDGE: "dind1:10.33.0.1/16" + # Keep Docker on the nftables backend selected by entrypoint.sh. + # An empty value disables legacy auto-selection; "false" enables it. + DOCKER_IPTABLES_LEGACY: "" + entrypoint: /entrypoint.sh + command: > + dockerd + --bridge dind1 + --data-root /data/data + --exec-root /data/exec + --host unix:///data/docker.sock + --pidfile /data/docker.pid + volumes: + - ${APP_DATA_DIR}/entrypoint.sh:/entrypoint.sh + - ${APP_DATA_DIR}/data/docker:/data + + portainer: + image: portainer/portainer-ee:2.45.3-alpine@sha256:4e706af52d7455c995b41ba8e05585ffa965e0a80adecb32d2fef14d68eb0f79 + command: --host unix:///var/run/docker.sock --admin-password-file=/default-password + restart: on-failure + volumes: + - ${APP_DATA_DIR}/default-password:/default-password + - ${APP_DATA_DIR}/data/portainer:/data + - ${APP_DATA_DIR}/data/docker:/var/run diff --git a/portainer-business/entrypoint.sh b/portainer-business/entrypoint.sh new file mode 100755 index 000000000..08740545c --- /dev/null +++ b/portainer-business/entrypoint.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +# This hack can be removed if https://github.com/docker-library/docker/pull/444 gets merged. + +# Remove docker pidfile if it exists to ensure Docker can start up after a bad shutdown +pidfile="/var/run/docker.pid" +if [[ -f "${pidfile}" ]] +then + rm -f "${pidfile}" +fi + +# Use nftables as the backend for iptables +for command in iptables iptables-restore iptables-restore-translate iptables-save iptables-translate +do + ln -sf /sbin/xtables-nft-multi /sbin/$command +done + +# Ensure that a bridge exists with the given name +ensure_bridge_exists() { + local name="${1}" + local ip_range="${2}" + + # Check if the bridge already exists + if ip link show "${name}" &>/dev/null + then + echo "Bridge '${name}' already exists. Skipping creation." + ip addr show "${name}" + return + fi + + echo "Bridge '${name}' does not exist. Creating..." + ip link add "${name}" type bridge + ip addr add "${ip_range}" dev "${name}" + ip link set "${name}" up + + echo "Bridge '${name}' is now up with IP range '${ip_range}'." + ip addr show "${name}" +} + +if [[ "${DOCKER_ENSURE_BRIDGE}" != "" ]] +then + bridge="${DOCKER_ENSURE_BRIDGE%%:*}" + ip_range="${DOCKER_ENSURE_BRIDGE#*:}" + ensure_bridge_exists "${bridge}" "${ip_range}" +fi + +exec dockerd-entrypoint.sh $@ diff --git a/portainer-business/hooks/pre-start b/portainer-business/hooks/pre-start new file mode 100755 index 000000000..bdc3121ab --- /dev/null +++ b/portainer-business/hooks/pre-start @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -euo pipefail + +APP_DATA_DIR="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)/data" + +DOCKER_DIR="${APP_DATA_DIR}/docker" + +# Remove stale Docker-in-Docker runtime state that can survive power loss, +# crashes, restarts, or updates and prevent the nested Docker daemon from +# starting. +# +# Keep ${DOCKER_DIR}/data intact. It is the nested Docker graph root and may +# contain user-managed Portainer containers, images, volumes, and stacks. +rm -f "${DOCKER_DIR}/docker.pid" +rm -f "${DOCKER_DIR}/docker.sock" +rm -rf "${DOCKER_DIR}/exec" diff --git a/portainer-business/umbrel-app.yml b/portainer-business/umbrel-app.yml new file mode 100644 index 000000000..b7405cb19 --- /dev/null +++ b/portainer-business/umbrel-app.yml @@ -0,0 +1,62 @@ +manifestVersion: 1.1 +id: portainer-business +category: developer +name: Portainer Business +version: "2.45.3" +tagline: Manage Docker containers on your Umbrel with Portainer Business Edition +description: >- + ⚠️ Portainer Business Edition needs a license key from Portainer. You'll be asked for it after you sign in for the + first time. Portainer offers a free license for up to 3 nodes at portainer.io/take-3. + + + ⚠️ Make sure to only use named Docker volumes for your stacks and containers. Data in bind-mounted volumes + will be lost when the Portainer app is restarted or updated. + + + ⚠️ Watch out for port conflicts between your custom Docker containers and your umbrelOS apps. + + + Portainer Business Edition is the commercial edition of Portainer. It adds features for teams and businesses on top + of the Community Edition, such as role-based access control, registry management, and support from Portainer. + If you don't need these features, install the free Portainer app instead. + + + 🛠️ Portainer on Umbrel is for power users, follow these best practices to avoid issues: + + + 1. Data persistence: Make sure to only use named Docker volumes for your stacks and containers. Data in bind-mounted + volumes will be lost when the Portainer app is restarted or updated. + + + 2. Port management: Watch out for potential port conflicts between your custom containers and umbrelOS' service containers, + apps you have installed from the Umbrel App Store or Community App Stores, and any apps you go to install in the future. + + + 3. Container restart policy: Set your containers to "unless-stopped" or "always" restart policies. This will allow your containers + to restart automatically when the Portainer app is restarted or updated. + + + 4. Web access to containers: Access your custom containers in your browser at umbrel.local:PORT_NUMBER. For example, for a container + with a web UI running on port 4545, navigate to umbrel.local:4545 to access it. +releaseNotes: "" + +developer: Portainer +website: https://www.portainer.io +dependencies: [] +repo: "" +support: https://www.portainer.io/resources/get-support + +port: 9015 +gallery: + - 1.webp + - 2.webp + - 3.webp +path: "" + +defaultUsername: "admin" +defaultPassword: "changeme" +permissions: + - GPU + +submitter: Umbrel +submission: https://github.com/getumbrel/umbrel-apps/pull/6365