From 0f7a8dd951e6dc165205b66c476bdee3a3ef9389 Mon Sep 17 00:00:00 2001 From: Nathan Fretz Date: Sun, 17 Sep 2023 22:59:07 -0700 Subject: [PATCH] App Submission: Portainer (#774) Co-authored-by: Luke Childs Co-authored-by: Mayank Chhabra --- portainer/default-password | 1 + portainer/docker-compose.yml | 36 +++++++++++++++++++++++ portainer/entrypoint.sh | 47 ++++++++++++++++++++++++++++++ portainer/umbrel-app.yml | 56 ++++++++++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+) create mode 100644 portainer/default-password create mode 100644 portainer/docker-compose.yml create mode 100755 portainer/entrypoint.sh create mode 100644 portainer/umbrel-app.yml diff --git a/portainer/default-password b/portainer/default-password new file mode 100644 index 0000000..c616260 --- /dev/null +++ b/portainer/default-password @@ -0,0 +1 @@ +changeme \ No newline at end of file diff --git a/portainer/docker-compose.yml b/portainer/docker-compose.yml new file mode 100644 index 0000000..e54d63e --- /dev/null +++ b/portainer/docker-compose.yml @@ -0,0 +1,36 @@ +version: "3.7" + +services: + app_proxy: + environment: + APP_HOST: portainer_portainer_1 + APP_PORT: 9000 + + docker: + image: docker:24.0.5-dind + privileged: true + network_mode: host + stop_grace_period: 1m + restart: on-failure + environment: + DOCKER_ENSURE_BRIDGE: "dind0:10.32.0.1/16" + entrypoint: /entrypoint.sh + command: > + dockerd + --bridge dind0 + --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-ce:2.19.0 + 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/entrypoint.sh b/portainer/entrypoint.sh new file mode 100755 index 0000000..0874054 --- /dev/null +++ b/portainer/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/umbrel-app.yml b/portainer/umbrel-app.yml new file mode 100644 index 0000000..0965100 --- /dev/null +++ b/portainer/umbrel-app.yml @@ -0,0 +1,56 @@ +manifestVersion: 1 +id: portainer +category: developer +name: Portainer +version: "2.19.0" +tagline: Run custom Docker containers on your Umbrel +description: >- + ⚠️ 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 is the ultimate Docker management solution that simplifies running Docker containers and Docker Compose + setups on your Umbrel, putting comprehensive control at your fingertips. + + + Portainer provides seamless container management, allowing you to efficiently monitor, start, stop, and + modify containers, networks, volumes, and images. You can also deploy multi-container applications using Docker Compose + with ease. + + + 🛠️ Portainer on Umbrel is for power users, follow these best practices to avoid issues: + + + 1. Data persistence: Make sure to only used 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:. For example, for a container + with a web UI running on port 4545, navigate to umbrel.local:4545 to access it. +website: https://portainer.io +dependencies: [] +repo: https://github.com/portainer/portainer +support: https://github.com/portainer/portainer/issues +port: 9000 +gallery: + - 1.jpg + - 2.jpg + - 3.jpg +path: "" +defaultUsername: "admin" +defaultPassword: "changeme" +releaseNotes: "" +developer: Portainer +submitter: Umbrel +submission: https://github.com/getumbrel/umbrel-apps/pull/774