mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-15 09:32:30 +02:00
* feat(portainer_be): add Portainer Business Edition add-on Adds a new `portainer_be` add-on based on the existing Portainer (CE) add-on, requested in #873. Business Edition has no public GitHub release tarball like CE, so the binary and web assets are pulled from the official multi-arch `portainer/portainer-ee` image via a multi-stage build and placed under /opt/portainer, mirroring CE's layout exactly. All runtime scripts, nginx/ingress config, options schema, SSL and password handling are unchanged from CE, so behaviour is identical apart from the edition. Users obtain a free (up to 3 nodes) Business Edition license key by registering with Portainer and enter it in the web UI on first launch. - config.yaml: slug portainer_be, BE image name, BE description/name - Dockerfile: multi-stage COPY from portainer/portainer-ee (no CE tarball) - updater.json: dockerhub source tracking portainer/portainer-ee - apparmor.txt: unique profile name (portainer_be_addon) - CHANGELOG/README/DOCS: BE-specific, documents the license-key step Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(portainer_be): address PR review feedback - nginx finish: move shebang to byte 0 (leading blank line prevented S6 from recognising the interpreter, so the finish hook could fail to tear down the supervision tree) [Codex P2] - ingress: tighten CSP to `frame-ancestors 'self'` to match the adjacent X-Frame-Options SAMEORIGIN; HA ingress embeds same-origin so the panel keeps working [CodeRabbit] - README: correct login note (password is the configured option value, never printed to logs); drop MD012 consecutive blank lines [CodeRabbit] - DOCS: fix "environement" -> "environment" typo [CodeRabbit] Skipped: nginx SSL "idempotency" finding — /etc/nginx lives in the read-only image layer and cont-init re-renders from the pristine template on every container start, so in-place sed edits never accumulate or need restoring. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * revert(portainer_be): keep CSP frame-ancestors * for ingress compatibility Reverts the frame-ancestors 'self' change from the previous commit. The wildcard is required for the Home Assistant ingress iframe to embed the Portainer UI; tightening it breaks the ingress panel. Matches the CE add-on. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
3
portainer_be/CHANGELOG.md
Normal file
3
portainer_be/CHANGELOG.md
Normal file
@@ -0,0 +1,3 @@
|
||||
## 2.43.0 (2026-07-27)
|
||||
- Initial release: Portainer Business Edition add-on, based on the Portainer (CE) add-on (#873)
|
||||
- Ships the `portainer/portainer-ee` binary and web assets; enter a free Business Edition license key in the web UI to unlock BE features (changelog: https://github.com/portainer/portainer/releases)
|
||||
37
portainer_be/DOCS.md
Normal file
37
portainer_be/DOCS.md
Normal file
@@ -0,0 +1,37 @@
|
||||
Portainer can be used to execute custom commands in a docker container. It is a lightweight management UI which allows you to easily manage a Docker host(s) or Docker swarm clusters.
|
||||
|
||||
This is the **Business Edition** variant, shipping the `portainer/portainer-ee` build. Business Edition is free for up to 3 nodes with a license key obtained by registering at <https://www.portainer.io/take-3>. Enter that key in the web UI on first launch; without one it runs a time-limited trial. All add-on options and behaviour are otherwise identical to the Community Edition add-on.
|
||||
|
||||
# Quick start
|
||||
- Add my repository using this link
|
||||
[![Add repository on my Home Assistant][repository-badge]][repository-url]
|
||||
- Install the Portainer Business Edition addon from my repo
|
||||
- On first launch, open the web UI and enter your Business Edition license key
|
||||
- In the configuration panel of the addon, you can change the password
|
||||
- In the main page of the addon, disable "Protection mode", then start the addon
|
||||
- Login (default name is `admin`, default password is `homeassistant`)
|
||||
- Click on `Primary` in the environment (at the center of the page)
|
||||
- Click on `Containers` in the left menu bar
|
||||
- Increase the number of items per page to see all your addons
|
||||
- Click on the symbol `>_` next to the name of your selected addon to open the console page
|
||||
- Either change the username, or more usually just click connect
|
||||
- Type your commands, you have full access to the terminal of this specific container (this does not affect other parts of your HA system)
|
||||
|
||||
# Impact on your system
|
||||
- There is no impact of installing, or running portainer
|
||||
- Installing manually a custom container will modify your HA status to an unsupported/unhealthy state. You will be blocked from upgrading Home Assistant and upgrading any Add-ons you may have. Stopping this custom container will reset the normal status
|
||||
|
||||
# Tips and tricks
|
||||
|
||||
## Reset database
|
||||
Just change the password in your addon options and the database will be reset
|
||||
|
||||
## Timeout of 60s
|
||||
The addon includes a very long timeout. However, if you use another layer of proxy such as the addon nginx proxy manager, it will default to a timeout of 60s. You'll have to adapt the proxy layer to increase timeout. More details here : https://github.com/portainer/portainer/issues/2953#issuecomment-1235795256
|
||||
|
||||
## Further reference
|
||||
- Here is a full guide on using it : https://codeopolis.com/posts/beginners-guide-to-portainer/
|
||||
- Old page on the HA community forum about portainer : https://community.home-assistant.io/t/home-assistant-community-add-on-portainer
|
||||
|
||||
[repository-badge]: https://img.shields.io/badge/Add%20repository%20to%20my-Home%20Assistant-41BDF5?logo=home-assistant&style=for-the-badge
|
||||
[repository-url]: https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Falexbelgium%2Fhassio-addons
|
||||
156
portainer_be/Dockerfile
Normal file
156
portainer_be/Dockerfile
Normal file
@@ -0,0 +1,156 @@
|
||||
#============================#
|
||||
# ALEXBELGIUM'S DOCKERFILE #
|
||||
#============================#
|
||||
# _.------.
|
||||
# _.-` ('>.-`"""-.
|
||||
# '.--'` _'` _ .--.)
|
||||
# -' '-.-';` `
|
||||
# ' - _.' ``'--.
|
||||
# '---` .-'""`
|
||||
# /`
|
||||
#=== Home Assistant Addon ===#
|
||||
|
||||
#################
|
||||
# 1 Build Image #
|
||||
#################
|
||||
|
||||
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:11.0.0
|
||||
# Portainer Business Edition (Enterprise) upstream version.
|
||||
# Business Edition has no public release tarball like CE does; its binary and
|
||||
# web assets ship only inside the official portainer/portainer-ee image, so we
|
||||
# pull them from there. The image is multi-arch (amd64/arm64), so buildx picks
|
||||
# the variant matching the target architecture automatically.
|
||||
ARG BUILD_UPSTREAM="2.43.0"
|
||||
FROM portainer/portainer-ee:${BUILD_UPSTREAM} AS portainer_be
|
||||
|
||||
ARG BUILD_FROM
|
||||
FROM ${BUILD_FROM}
|
||||
|
||||
##################
|
||||
# 2 Modify Image #
|
||||
##################
|
||||
|
||||
# Set S6 wait time
|
||||
ENV S6_CMD_WAIT_FOR_SERVICES=1 \
|
||||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
|
||||
S6_SERVICES_GRACETIME=0
|
||||
|
||||
|
||||
# Set shell
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
# Setup base
|
||||
ARG BUILD_UPSTREAM
|
||||
|
||||
# Install the Portainer BE binary and its web assets, mirroring the CE add-on
|
||||
# layout under /opt/portainer (the binary resolves ./public relative to itself,
|
||||
# so keeping them side by side needs no --assets flag at runtime).
|
||||
COPY --from=portainer_be /portainer /opt/portainer/portainer
|
||||
COPY --from=portainer_be /public /opt/portainer/public
|
||||
|
||||
##################
|
||||
# 3 Install apps #
|
||||
##################
|
||||
|
||||
# Add rootfs
|
||||
COPY rootfs/ /
|
||||
RUN find . -type f \( -name "*.sh" -o -name "run" -o -name "finish" \) -print -exec chmod +x {} \;
|
||||
|
||||
# Uses /bin for compatibility purposes
|
||||
# hadolint ignore=DL4005
|
||||
RUN if [ ! -f /bin/sh ] && [ -f /usr/bin/sh ]; then ln -s /usr/bin/sh /bin/sh; fi && \
|
||||
if [ ! -f /bin/bash ] && [ -f /usr/bin/bash ]; then ln -s /usr/bin/bash /bin/bash; fi
|
||||
|
||||
# Modules
|
||||
ARG MODULES="00-banner.sh 01-custom_script.sh"
|
||||
|
||||
# Automatic modules download
|
||||
COPY ha_automodules.sh /ha_automodules.sh
|
||||
RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_automodules.sh
|
||||
|
||||
# Manual apps
|
||||
ENV PACKAGES="nginx"
|
||||
|
||||
# Automatic apps & bashio
|
||||
COPY ha_autoapps.sh /ha_autoapps.sh
|
||||
RUN chmod 744 /ha_autoapps.sh && /ha_autoapps.sh "$PACKAGES" && rm /ha_autoapps.sh
|
||||
|
||||
################
|
||||
# 4 Entrypoint #
|
||||
################
|
||||
|
||||
# Add entrypoint
|
||||
ENV S6_STAGE2_HOOK=/ha_entrypoint.sh
|
||||
COPY ha_entrypoint.sh /ha_entrypoint.sh
|
||||
RUN chmod 777 /ha_entrypoint.sh
|
||||
|
||||
# Install bashio
|
||||
COPY bashio-standalone.sh /usr/local/lib/bashio-standalone.sh
|
||||
RUN chmod 0755 /usr/local/lib/bashio-standalone.sh
|
||||
|
||||
RUN chmod 777 /etc/services.d/*/*
|
||||
#
|
||||
#WORKDIR /
|
||||
#ENTRYPOINT [ "/usr/bin/env" ]
|
||||
#CMD [ "/ha_entrypoint.sh" ]
|
||||
#SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
############
|
||||
# 5 Labels #
|
||||
############
|
||||
|
||||
ARG BUILD_ARCH
|
||||
ARG BUILD_DATE
|
||||
ARG BUILD_DESCRIPTION
|
||||
ARG BUILD_NAME
|
||||
ARG BUILD_REF
|
||||
ARG BUILD_REPOSITORY
|
||||
ARG BUILD_VERSION
|
||||
ENV BUILD_VERSION="${BUILD_VERSION}"
|
||||
LABEL \
|
||||
io.hass.name="${BUILD_NAME}" \
|
||||
io.hass.description="${BUILD_DESCRIPTION}" \
|
||||
io.hass.arch="${BUILD_ARCH}" \
|
||||
io.hass.type="addon" \
|
||||
io.hass.version=${BUILD_VERSION} \
|
||||
maintainer="alexbelgium (https://github.com/alexbelgium)" \
|
||||
org.opencontainers.image.title="${BUILD_NAME}" \
|
||||
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
|
||||
org.opencontainers.image.vendor="Home Assistant Add-ons" \
|
||||
org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \
|
||||
org.opencontainers.image.licenses="MIT" \
|
||||
org.opencontainers.image.url="https://github.com/alexbelgium" \
|
||||
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
|
||||
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
|
||||
org.opencontainers.image.created=${BUILD_DATE} \
|
||||
org.opencontainers.image.revision=${BUILD_REF} \
|
||||
org.opencontainers.image.version=${BUILD_VERSION}
|
||||
|
||||
#################
|
||||
# 6 Healthcheck #
|
||||
#################
|
||||
|
||||
# Avoid spamming logs
|
||||
# hadolint ignore=SC2016
|
||||
RUN \
|
||||
# Handle Apache configuration
|
||||
if [ -d /etc/apache2/sites-available ]; then \
|
||||
for file in /etc/apache2/sites-*/*.conf; do \
|
||||
sed -i '/<VirtualHost/a \ \n # Match requests with the custom User-Agent "HealthCheck" \n SetEnvIf User-Agent "HealthCheck" dontlog \n # Exclude matching requests from access logs \n CustomLog ${APACHE_LOG_DIR}/access.log combined env=!dontlog' "$file"; \
|
||||
done; \
|
||||
fi && \
|
||||
\
|
||||
# Handle Nginx configuration
|
||||
if [ -f /etc/nginx/nginx.conf ]; then \
|
||||
awk '/http \{/{print; print "map $http_user_agent $dontlog {\n default 0;\n \"~*HealthCheck\" 1;\n}\naccess_log /var/log/nginx/access.log combined if=$dontlog;"; next}1' /etc/nginx/nginx.conf > /etc/nginx/nginx.conf.new && \
|
||||
mv /etc/nginx/nginx.conf.new /etc/nginx/nginx.conf; \
|
||||
fi
|
||||
|
||||
ENV HEALTH_PORT="9000" \
|
||||
HEALTH_URL="/api/system/status"
|
||||
HEALTHCHECK \
|
||||
--interval=5s \
|
||||
--retries=5 \
|
||||
--start-period=30s \
|
||||
--timeout=25s \
|
||||
CMD curl -A "HealthCheck: Docker/1.0" -s -f "http://127.0.0.1:${HEALTH_PORT}${HEALTH_URL}" &>/dev/null || exit 1
|
||||
110
portainer_be/README.md
Normal file
110
portainer_be/README.md
Normal file
@@ -0,0 +1,110 @@
|
||||
|
||||
# Home assistant add-on: Portainer Business Edition
|
||||
|
||||
I maintain this and other Home Assistant add-ons in my free time: keeping up with upstream changes, HA changes, and testing on real hardware takes a lot of time (and some money). I use around 5-10 of my >110 addons so regularly I install test machines (and purchase some test services such as vpn) that I don't use myself to troubleshoot and improve the addons
|
||||
|
||||
If this add-on saves you time or makes your setup easier, I would be very grateful for your support!
|
||||
|
||||
[![Buy me a coffee][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
|
||||
[![Donate via PayPal][paypal-badge]](https://www.paypal.com/donate/?hosted_button_id=DZFULJZTP3UQA)
|
||||
|
||||
## Addon informations
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
[](https://www.codacy.com/gh/alexbelgium/hassio-addons/dashboard?utm_source=github.com&utm_medium=referral&utm_content=alexbelgium/hassio-addons&utm_campaign=Badge_Grade)
|
||||
[](https://github.com/alexbelgium/hassio-addons/actions/workflows/weekly-supelinter.yaml)
|
||||
[](https://github.com/alexbelgium/hassio-addons/actions/workflows/onpush_builder.yaml)
|
||||
|
||||
[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&style=flat&logoColor=white
|
||||
[paypal-badge]: https://img.shields.io/badge/Donate%20via%20PayPal-0070BA?logo=paypal&style=flat&logoColor=white
|
||||
|
||||
This is the **Business Edition** variant of the [Portainer add-on](https://github.com/alexbelgium/hassio-addons/tree/master/portainer). It ships the `portainer/portainer-ee` build instead of the Community Edition. Business Edition is free for up to 3 nodes with a license key you obtain by registering at <https://www.portainer.io/take-3>; enter that key in the web UI on first launch. Without a key it runs in a time-limited trial.
|
||||
|
||||
Forked from : https://github.com/hassio-addons/addon-portainer
|
||||
Implemented changes : Business Edition image ; update to latest versions ; ingress ; ssl ; password setting through addon option ; allow manual override
|
||||
|
||||
_Thanks to everyone having starred my repo! To star it click on the image below, then it will be on top right. Thanks!_
|
||||
|
||||
[](https://github.com/alexbelgium/hassio-addons/stargazers)
|
||||
|
||||

|
||||
|
||||
## About
|
||||
|
||||
---
|
||||
|
||||
Portainer is an open-source lightweight management UI which allows you to
|
||||
easily manage your a Docker host(s) or Docker swarm clusters.
|
||||
|
||||
It has never been so easy to manage Docker. Portainer provides a detailed
|
||||
overview of Docker and allows you to manage containers, images, networks and
|
||||
volumes.
|
||||
|
||||
## RESTORE BACKUP
|
||||
|
||||
Open the addon options and set the password to "empty". Restart the addon, it will allow to restore portainer from a backup. You need to put your backup in an accessible folder such as /share to have it mounted in the addon
|
||||
|
||||
## WARNING
|
||||
|
||||
The Portainer add-on is really powerful and gives you virtually access to
|
||||
your whole system. While this add-on is created and maintained with care and
|
||||
with security in mind, in the wrong or inexperienced hands,
|
||||
it could damage your system.
|
||||
|
||||
## Installation
|
||||
|
||||
---
|
||||
|
||||
The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on.
|
||||
|
||||
1. Add my add-ons repository to your home assistant instance (in supervisor addons store at top right, or click button below if you have configured my HA)
|
||||
[](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Falexbelgium%2Fhassio-addons)
|
||||
1. Install this add-on.
|
||||
1. Click the `Save` button to store your configuration.
|
||||
1. Set the add-on options to your preferences
|
||||
1. Start the add-on.
|
||||
1. Check the logs of the add-on to see if everything went well.
|
||||
1. Open the webUI and adapt the software options
|
||||
|
||||
## Configuration
|
||||
|
||||
Webui can be found at <http://homeassistant:port> or in your sidebar using Ingress.
|
||||
The default username is "admin" and the password is the value you set in the add-on `password` option (default `homeassistant`).
|
||||
|
||||
### Options
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
|--------|------|---------|-------------|
|
||||
| `ssl` | bool | `false` | Enable HTTPS for web interface |
|
||||
| `certfile` | str | `fullchain.pem` | SSL certificate file (in `/ssl/`) |
|
||||
| `keyfile` | str | `privkey.pem` | SSL private key file (in `/ssl/`) |
|
||||
| `password` | str | `homeassistant` | Admin password (min 12 characters, leave blank to restore backup) |
|
||||
|
||||
### Example Configuration
|
||||
|
||||
```yaml
|
||||
ssl: true
|
||||
certfile: "fullchain.pem"
|
||||
keyfile: "privkey.pem"
|
||||
password: "your-secure-password-123"
|
||||
```
|
||||
|
||||
### Custom Scripts and Environment Variables
|
||||
|
||||
This addon supports custom scripts and environment variables through the `addon_config` mapping:
|
||||
|
||||
- **Custom scripts**: See [Running Custom Scripts in Addons](https://github.com/alexbelgium/hassio-addons/wiki/Running-custom-scripts-in-Addons)
|
||||
- **env_vars option**: Use the add-on `env_vars` option to pass extra environment variables (uppercase or lowercase names). See https://github.com/alexbelgium/hassio-addons/wiki/Add-Environment-variables-to-your-Addon-2 for details.
|
||||
|
||||
## Support
|
||||
|
||||
Create an issue on github
|
||||
|
||||
## Illustration
|
||||
|
||||
---
|
||||
|
||||

|
||||
62
portainer_be/apparmor.txt
Normal file
62
portainer_be/apparmor.txt
Normal file
@@ -0,0 +1,62 @@
|
||||
#include <tunables/global>
|
||||
|
||||
profile portainer_be_addon flags=(attach_disconnected,mediate_deleted) {
|
||||
#include <abstractions/base>
|
||||
|
||||
capability chown,
|
||||
capability dac_override,
|
||||
capability fowner,
|
||||
capability setgid,
|
||||
capability setuid,
|
||||
capability sys_chroot,
|
||||
file,
|
||||
signal,
|
||||
mount,
|
||||
umount,
|
||||
remount,
|
||||
network udp,
|
||||
network tcp,
|
||||
network dgram,
|
||||
network stream,
|
||||
network inet,
|
||||
network inet6,
|
||||
network netlink raw,
|
||||
network unix dgram,
|
||||
|
||||
|
||||
# S6-Overlay
|
||||
/init ix,
|
||||
/run/{s6,s6-rc*,service}/** ix,
|
||||
/package/** ix,
|
||||
/command/** ix,
|
||||
/run/{,**} rwk,
|
||||
/dev/tty rw,
|
||||
/bin/** ix,
|
||||
/usr/bin/** ix,
|
||||
/usr/lib/bashio/** ix,
|
||||
/etc/s6/** rix,
|
||||
/run/s6/** rix,
|
||||
/etc/services.d/** rwix,
|
||||
/etc/cont-init.d/** rwix,
|
||||
/etc/cont-finish.d/** rwix,
|
||||
/init rix,
|
||||
/var/run/** mrwkl,
|
||||
/var/run/ mrwkl,
|
||||
/dev/i2c-1 mrwkl,
|
||||
/dev/fuse mrwkl,
|
||||
/dev/sda1 mrwkl,
|
||||
/dev/sdb1 mrwkl,
|
||||
/dev/nvme0 mrwkl,
|
||||
/dev/nvme1 mrwkl,
|
||||
/dev/mmcblk0p1 mrwkl,
|
||||
|
||||
# Data access
|
||||
/data/** rw,
|
||||
|
||||
# suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
|
||||
ptrace (trace,read) peer=docker-default,
|
||||
|
||||
# docker daemon confinement requires explict allow rule for signal
|
||||
signal (receive) set=(kill,term) peer=/usr/bin/docker,
|
||||
|
||||
}
|
||||
6
portainer_be/build.json
Normal file
6
portainer_be/build.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"build_from": {
|
||||
"aarch64": "ghcr.io/hassio-addons/base/aarch64:16.0.0",
|
||||
"amd64": "ghcr.io/hassio-addons/base/amd64:16.0.0"
|
||||
}
|
||||
}
|
||||
45
portainer_be/config.yaml
Normal file
45
portainer_be/config.yaml
Normal file
@@ -0,0 +1,45 @@
|
||||
arch:
|
||||
- aarch64
|
||||
- amd64
|
||||
backup_exclude:
|
||||
- backups
|
||||
- docker_config/cli-plugins
|
||||
description: Manage your Docker environment with ease (Business Edition)
|
||||
docker_api: true
|
||||
hassio_api: true
|
||||
image: ghcr.io/alexbelgium/portainer_be-{arch}
|
||||
ingress: true
|
||||
ingress_port: 1337
|
||||
ingress_stream: true
|
||||
init: false
|
||||
map:
|
||||
- addon_config:rw
|
||||
- share:rw
|
||||
- ssl
|
||||
name: Portainer Business Edition
|
||||
options:
|
||||
env_vars: []
|
||||
certfile: fullchain.pem
|
||||
keyfile: privkey.pem
|
||||
password: homeassistant
|
||||
ssl: false
|
||||
panel_admin: false
|
||||
panel_icon: mdi:docker
|
||||
ports:
|
||||
8000/tcp: null
|
||||
9099/tcp: 9000
|
||||
ports_description:
|
||||
8000/tcp: Edge Agent Api (Enable when managing remote edge agents)
|
||||
9099/tcp: Web UI port
|
||||
schema:
|
||||
env_vars:
|
||||
- name: match(^[A-Za-z0-9_]+$)
|
||||
value: str?
|
||||
certfile: str
|
||||
keyfile: str
|
||||
password: str?
|
||||
ssl: bool
|
||||
slug: portainer_be
|
||||
udev: true
|
||||
url: https://github.com/alexbelgium/hassio-addons
|
||||
version: "2.43.0"
|
||||
BIN
portainer_be/icon.png
Normal file
BIN
portainer_be/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
portainer_be/logo.png
Normal file
BIN
portainer_be/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
35
portainer_be/rootfs/etc/cont-init.d/30-nginx.sh
Executable file
35
portainer_be/rootfs/etc/cont-init.d/30-nginx.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
|
||||
#################
|
||||
# NGINX SETTING #
|
||||
#################
|
||||
|
||||
#declare admin_port
|
||||
declare portainer_protocol=http
|
||||
|
||||
# Generate Ingress configuration
|
||||
if bashio::config.true 'ssl'; then
|
||||
bashio::config.require.ssl
|
||||
portainer_protocol=https
|
||||
sed -i "s|9000|9443|g" /etc/nginx/includes/upstream.conf
|
||||
sed -i "s|9000|9443|g" /etc/services.d/nginx/run
|
||||
sed -i "s|9099 default_server|9099 ssl|g" /etc/nginx/templates/ingress.gtpl
|
||||
sed -i '8 i ssl_certificate /ssl/{{ .certfile }};' /etc/nginx/templates/ingress.gtpl
|
||||
sed -i '8 i ssl_certificate_key /ssl/{{ .keyfile }};' /etc/nginx/templates/ingress.gtpl
|
||||
bashio::log.info "Ssl enabled, please use https for connection"
|
||||
else
|
||||
sed -i '/connection_upgrade/a\proxy_set_header Origin "";' /etc/nginx/templates/ingress.gtpl
|
||||
fi
|
||||
|
||||
bashio::var.json \
|
||||
interface "$(bashio::addon.ip_address)" \
|
||||
port "^$(bashio::addon.ingress_port)" \
|
||||
protocol "${portainer_protocol}" \
|
||||
certfile "$(bashio::config 'certfile')" \
|
||||
keyfile "$(bashio::config 'keyfile')" \
|
||||
ssl "^$(bashio::config 'ssl')" \
|
||||
| tempio \
|
||||
-template /etc/nginx/templates/ingress.gtpl \
|
||||
-out /etc/nginx/servers/ingress.conf
|
||||
8
portainer_be/rootfs/etc/cont-init.d/31-portainer.sh
Executable file
8
portainer_be/rootfs/etc/cont-init.d/31-portainer.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Portainer
|
||||
# Runs some initializations for Portainer
|
||||
# ==============================================================================
|
||||
bashio::require.unprotected
|
||||
96
portainer_be/rootfs/etc/nginx/includes/mime.types
Normal file
96
portainer_be/rootfs/etc/nginx/includes/mime.types
Normal file
@@ -0,0 +1,96 @@
|
||||
types {
|
||||
text/html html htm shtml;
|
||||
text/css css;
|
||||
text/xml xml;
|
||||
image/gif gif;
|
||||
image/jpeg jpeg jpg;
|
||||
application/javascript js;
|
||||
application/atom+xml atom;
|
||||
application/rss+xml rss;
|
||||
|
||||
text/mathml mml;
|
||||
text/plain txt;
|
||||
text/vnd.sun.j2me.app-descriptor jad;
|
||||
text/vnd.wap.wml wml;
|
||||
text/x-component htc;
|
||||
|
||||
image/png png;
|
||||
image/svg+xml svg svgz;
|
||||
image/tiff tif tiff;
|
||||
image/vnd.wap.wbmp wbmp;
|
||||
image/webp webp;
|
||||
image/x-icon ico;
|
||||
image/x-jng jng;
|
||||
image/x-ms-bmp bmp;
|
||||
|
||||
font/woff woff;
|
||||
font/woff2 woff2;
|
||||
|
||||
application/java-archive jar war ear;
|
||||
application/json json;
|
||||
application/mac-binhex40 hqx;
|
||||
application/msword doc;
|
||||
application/pdf pdf;
|
||||
application/postscript ps eps ai;
|
||||
application/rtf rtf;
|
||||
application/vnd.apple.mpegurl m3u8;
|
||||
application/vnd.google-earth.kml+xml kml;
|
||||
application/vnd.google-earth.kmz kmz;
|
||||
application/vnd.ms-excel xls;
|
||||
application/vnd.ms-fontobject eot;
|
||||
application/vnd.ms-powerpoint ppt;
|
||||
application/vnd.oasis.opendocument.graphics odg;
|
||||
application/vnd.oasis.opendocument.presentation odp;
|
||||
application/vnd.oasis.opendocument.spreadsheet ods;
|
||||
application/vnd.oasis.opendocument.text odt;
|
||||
application/vnd.openxmlformats-officedocument.presentationml.presentation
|
||||
pptx;
|
||||
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
||||
xlsx;
|
||||
application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
||||
docx;
|
||||
application/vnd.wap.wmlc wmlc;
|
||||
application/x-7z-compressed 7z;
|
||||
application/x-cocoa cco;
|
||||
application/x-java-archive-diff jardiff;
|
||||
application/x-java-jnlp-file jnlp;
|
||||
application/x-makeself run;
|
||||
application/x-perl pl pm;
|
||||
application/x-pilot prc pdb;
|
||||
application/x-rar-compressed rar;
|
||||
application/x-redhat-package-manager rpm;
|
||||
application/x-sea sea;
|
||||
application/x-shockwave-flash swf;
|
||||
application/x-stuffit sit;
|
||||
application/x-tcl tcl tk;
|
||||
application/x-x509-ca-cert der pem crt;
|
||||
application/x-xpinstall xpi;
|
||||
application/xhtml+xml xhtml;
|
||||
application/xspf+xml xspf;
|
||||
application/zip zip;
|
||||
|
||||
application/octet-stream bin exe dll;
|
||||
application/octet-stream deb;
|
||||
application/octet-stream dmg;
|
||||
application/octet-stream iso img;
|
||||
application/octet-stream msi msp msm;
|
||||
|
||||
audio/midi mid midi kar;
|
||||
audio/mpeg mp3;
|
||||
audio/ogg ogg;
|
||||
audio/x-m4a m4a;
|
||||
audio/x-realaudio ra;
|
||||
|
||||
video/3gpp 3gpp 3gp;
|
||||
video/mp2t ts;
|
||||
video/mp4 mp4;
|
||||
video/mpeg mpeg mpg;
|
||||
video/quicktime mov;
|
||||
video/webm webm;
|
||||
video/x-flv flv;
|
||||
video/x-m4v m4v;
|
||||
video/x-mng mng;
|
||||
video/x-ms-asf asx asf;
|
||||
video/x-ms-wmv wmv;
|
||||
video/x-msvideo avi;
|
||||
}
|
||||
14
portainer_be/rootfs/etc/nginx/includes/proxy_params.conf
Normal file
14
portainer_be/rootfs/etc/nginx/includes/proxy_params.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
proxy_connect_timeout 30m;
|
||||
proxy_http_version 1.1;
|
||||
proxy_ignore_client_abort off;
|
||||
proxy_read_timeout 30m;
|
||||
proxy_redirect off;
|
||||
proxy_send_timeout 30m;
|
||||
proxy_max_temp_file_size 0;
|
||||
|
||||
proxy_set_header Accept-Encoding "";
|
||||
proxy_set_header Origin $http_origin;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
1
portainer_be/rootfs/etc/nginx/includes/resolver.conf
Normal file
1
portainer_be/rootfs/etc/nginx/includes/resolver.conf
Normal file
@@ -0,0 +1 @@
|
||||
resolver 127.0.0.11 ipv6=off;
|
||||
@@ -0,0 +1,6 @@
|
||||
root /dev/null;
|
||||
server_name $hostname;
|
||||
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Robots-Tag none;
|
||||
9
portainer_be/rootfs/etc/nginx/includes/ssl_params.conf
Normal file
9
portainer_be/rootfs/etc/nginx/includes/ssl_params.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
ssl_protocols TLSv1.2;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA;
|
||||
ssl_ecdh_curve secp384r1;
|
||||
ssl_session_timeout 10m;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_tickets off;
|
||||
ssl_stapling on;
|
||||
ssl_stapling_verify on;
|
||||
3
portainer_be/rootfs/etc/nginx/includes/upstream.conf
Normal file
3
portainer_be/rootfs/etc/nginx/includes/upstream.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
upstream backend {
|
||||
server 127.0.0.1:9000;
|
||||
}
|
||||
56
portainer_be/rootfs/etc/nginx/nginx.conf
Normal file
56
portainer_be/rootfs/etc/nginx/nginx.conf
Normal file
@@ -0,0 +1,56 @@
|
||||
# Run nginx in foreground.
|
||||
daemon off;
|
||||
|
||||
# This is run inside Docker.
|
||||
user root;
|
||||
|
||||
# Pid storage location.
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
# Set number of worker processes.
|
||||
worker_processes 1;
|
||||
|
||||
# Enables the use of JIT for regular expressions to speed-up their processing.
|
||||
pcre_jit on;
|
||||
|
||||
# Write error log to Hass.io add-on log.
|
||||
error_log /proc/1/fd/1 error;
|
||||
|
||||
# Load allowed environment vars
|
||||
env HASSIO_TOKEN;
|
||||
|
||||
# Load dynamic modules.
|
||||
include /etc/nginx/modules/*.conf;
|
||||
|
||||
# Max num of simultaneous connections by a worker process.
|
||||
events {
|
||||
worker_connections 512;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/includes/mime.types;
|
||||
|
||||
log_format hassio '[$time_local] $status '
|
||||
'$http_x_forwarded_for($remote_addr) '
|
||||
'$request ($http_user_agent)';
|
||||
|
||||
access_log /proc/1/fd/1 hassio;
|
||||
client_max_body_size 4G;
|
||||
default_type application/octet-stream;
|
||||
gzip on;
|
||||
keepalive_timeout 65;
|
||||
sendfile on;
|
||||
server_tokens off;
|
||||
tcp_nodelay on;
|
||||
tcp_nopush on;
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
include /etc/nginx/includes/resolver.conf;
|
||||
include /etc/nginx/includes/upstream.conf;
|
||||
|
||||
include /etc/nginx/servers/*.conf;
|
||||
}
|
||||
1
portainer_be/rootfs/etc/nginx/servers/.gitkeep
Normal file
1
portainer_be/rootfs/etc/nginx/servers/.gitkeep
Normal file
@@ -0,0 +1 @@
|
||||
Without requirements or design, programming is the art of adding bugs to an empty text file. (Louis Srygley)
|
||||
24
portainer_be/rootfs/etc/nginx/templates/ingress.gtpl
Normal file
24
portainer_be/rootfs/etc/nginx/templates/ingress.gtpl
Normal file
@@ -0,0 +1,24 @@
|
||||
server {
|
||||
listen {{ .interface }}:{{ .port }} default_server;
|
||||
listen {{ .interface }}:9099 default_server;
|
||||
include /etc/nginx/includes/server_params.conf;
|
||||
include /etc/nginx/includes/proxy_params.conf;
|
||||
client_max_body_size 0;
|
||||
gzip off;
|
||||
|
||||
proxy_hide_header X-Frame-Options;
|
||||
proxy_hide_header Content-Security-Policy;
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header Content-Security-Policy "frame-ancestors *";
|
||||
|
||||
location / {
|
||||
proxy_pass {{ .protocol }}://backend/;
|
||||
resolver 127.0.0.11 valid=180s;
|
||||
|
||||
# These headers must be under location section, if they moved into proxy_params.conf, even if this is valid, they won't work
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-Host $http_host;
|
||||
}
|
||||
}
|
||||
8
portainer_be/rootfs/etc/services.d/nginx/finish
Normal file
8
portainer_be/rootfs/etc/services.d/nginx/finish
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree when Nginx fails
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
13
portainer_be/rootfs/etc/services.d/nginx/run
Executable file
13
portainer_be/rootfs/etc/services.d/nginx/run
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
# ==============================================================================
|
||||
|
||||
bashio::log.info "Waiting for port 9000 to open..."
|
||||
|
||||
# Wait for transmission to become available
|
||||
bashio::net.wait_for 9000 localhost 900
|
||||
|
||||
bashio::log.info "Starting NGinx..."
|
||||
|
||||
exec nginx
|
||||
9
portainer_be/rootfs/etc/services.d/portainer/finish
Normal file
9
portainer_be/rootfs/etc/services.d/portainer/finish
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Portainer
|
||||
# Take down the S6 supervision tree when Portainer fails
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
107
portainer_be/rootfs/etc/services.d/portainer/run
Executable file
107
portainer_be/rootfs/etc/services.d/portainer/run
Executable file
@@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
|
||||
bashio::log.info "Starting Portainer..."
|
||||
|
||||
##################
|
||||
# DEFINE OPTIONS #
|
||||
##################
|
||||
declare -a options
|
||||
options+=(--data /data)
|
||||
options+=(--bind 0.0.0.0:9000)
|
||||
#options+=(--templates /opt/portainer/templates.json)
|
||||
|
||||
docker_socket="/var/run/docker.sock"
|
||||
if [[ ! -S "$docker_socket" ]]; then
|
||||
fallback_socket="/run/docker.sock"
|
||||
if [[ -S "$fallback_socket" ]]; then
|
||||
docker_socket="$fallback_socket"
|
||||
bashio::log.info "Docker socket not found at /var/run/docker.sock, using /run/docker.sock."
|
||||
else
|
||||
bashio::log.error "Docker socket not found at /var/run/docker.sock or /run/docker.sock."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
options+=(--host "unix://${docker_socket}")
|
||||
|
||||
##############
|
||||
# SSL CONFIG #
|
||||
##############
|
||||
|
||||
bashio::config.require.ssl
|
||||
if bashio::config.true 'ssl'; then
|
||||
bashio::log.info "SSL enabled. If web UI doesn't work, disable SSL or check your certificate paths."
|
||||
CERTFILE="$(bashio::config 'certfile')"
|
||||
KEYFILE="$(bashio::config 'keyfile')"
|
||||
options+=(--sslcert /ssl/"$CERTFILE")
|
||||
options+=(--sslkey /ssl/"$KEYFILE")
|
||||
bashio::log.info "... SSL activated."
|
||||
fi
|
||||
|
||||
################
|
||||
# SET PASSWORD #
|
||||
################
|
||||
|
||||
# Set up the initial password
|
||||
PASSWORD_FILE="/data/portainer_password"
|
||||
HIDDEN_FILE="/data/hidden"
|
||||
if ! bashio::config.has_value 'password'; then
|
||||
PASSWORD="empty"
|
||||
else
|
||||
PASSWORD="$(bashio::config 'password')"
|
||||
fi
|
||||
|
||||
# Check current password
|
||||
CURRENTPASSWORD=""
|
||||
touch "$PASSWORD_FILE"
|
||||
CURRENTPASSWORD="$(cat "$PASSWORD_FILE")"
|
||||
|
||||
# Reset password if not first run
|
||||
if bashio::fs.file_exists "$HIDDEN_FILE"; then
|
||||
if [[ "$CURRENTPASSWORD" != "$PASSWORD" ]]; then
|
||||
BACKUPLOCATION="/share/portainer_$(date +%m-%d-%Y)_$RANDOM.backup"
|
||||
mv -f /data/portainer.db "$BACKUPLOCATION" || true
|
||||
rm "$HIDDEN_FILE" || true
|
||||
bashio::log.warning "... password changed, database reset. Previous version stored in $BACKUPLOCATION"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Define option
|
||||
echo -n "$PASSWORD" > "$PASSWORD_FILE"
|
||||
if [[ "$PASSWORD" = "empty" ]]; then
|
||||
bashio::log.info "... starting without predefined password."
|
||||
bashio::log.warning "If this is your first boot, you have a 5 minutes time period to perform the initial set-up."
|
||||
bashio::log.warning "If you don't do it, you would be faced with a 404 error and will need to restart the add-on to access the set-up page."
|
||||
else
|
||||
options+=(--admin-password-file "$PASSWORD_FILE")
|
||||
bashio::log.info "... password set according to add-on options."
|
||||
fi
|
||||
|
||||
###################
|
||||
# HIDE CONTAINERS #
|
||||
###################
|
||||
|
||||
# Hide Hassio containers by default, but only enforce on first run
|
||||
if ! bashio::fs.file_exists "$HIDDEN_FILE"; then
|
||||
options+=(--hide-label io.hass.type=supervisor)
|
||||
options+=(--hide-label io.hass.type=homeassistant)
|
||||
options+=(--hide-label io.hass.type=base)
|
||||
options+=(--hide-label io.hass.type=core)
|
||||
# options+=(--hide-label io.hass.type=addon)
|
||||
options+=(--hide-label io.hass.type=audio)
|
||||
options+=(--hide-label io.hass.type=cli)
|
||||
options+=(--hide-label io.hass.type=dns)
|
||||
options+=(--hide-label io.hass.type=multicast)
|
||||
options+=(--hide-label io.hass.type=observer)
|
||||
bashio::log.info "... non-addon containers hidden."
|
||||
touch "$HIDDEN_FILE"
|
||||
fi
|
||||
|
||||
####################
|
||||
# LAUNCH PORTAINER #
|
||||
####################
|
||||
bashio::log.info "... launching Portainer."
|
||||
|
||||
exec /opt/portainer/portainer "${options[@]}"
|
||||
9
portainer_be/updater.json
Normal file
9
portainer_be/updater.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"github_exclude": "-",
|
||||
"last_update": "2026-07-27",
|
||||
"repository": "alexbelgium/hassio-addons",
|
||||
"slug": "portainer_be",
|
||||
"source": "dockerhub",
|
||||
"upstream_repo": "portainer/portainer-ee",
|
||||
"upstream_version": "2.43.0"
|
||||
}
|
||||
Reference in New Issue
Block a user