fix(collabora): run as cool user

This commit is contained in:
Alexandre
2025-08-02 20:43:26 +02:00
parent 8c43f7b8bf
commit df5ad62c19
9 changed files with 411 additions and 0 deletions

View File

@@ -231,6 +231,17 @@ If you want to do add the repository manually, please follow the procedure highl
![smb][smb-badge]
![localdisks][localdisks-badge]
✓ ![image](https://api.iconify.design/mdi/file-document-edit-outline.svg) [Collabora](collabora/) : Collaborative office suite
  ![Version](https://img.shields.io/badge/dynamic/json?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fcollabora%2Fconfig.json)
![Update](https://img.shields.io/badge/dynamic/json?label=Updated&query=%24.last_update&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fcollabora%2Fupdater.json)
![aarch64][aarch64-badge]
![amd64][amd64-badge]
![armv7no][armv7no-badge]
![ingress][ingress-badge]
![smb][smb-badge]
![localdisks][localdisks-badge]
✓ ![image](https://api.iconify.design/mdi/book-open.svg) [Comixed](comixed/) : managing digital comics
  ![Version](https://img.shields.io/badge/dynamic/json?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fcomixed%2Fconfig.json)

10
collabora/CHANGELOG.md Normal file
View File

@@ -0,0 +1,10 @@
## 25.04.4.2.2 (03-08-2025)
- Run Collabora as the non-root `cool` user via ha_entrypoint to fix startup failure
- Set ha_entrypoint as container entrypoint and default to `/usr/bin/env`
## 25.04.4.2.1 (02-08-2025)
- Initial release
- Start Collabora Online via service and expose domain/credential options for Nextcloud integration
- Remove unused auto-app installer to prevent build failure

134
collabora/Dockerfile Normal file
View File

@@ -0,0 +1,134 @@
#============================#
# ALEXBELGIUM'S DOCKERFILE #
#============================#
# _.------.
# _.-` ('>.-`"""-.
# '.--'` _'` _ .--.)
# -' '-.-';` `
# ' - _.' ``'--.
# '---` .-'""`
# /`
#=== Home Assistant Addon ===#
#################
# 1 Build Image #
#################
ARG BUILD_FROM
ARG BUILD_VERSION
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
# Global LSIO modifications
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_lsio.sh" "/ha_lsio.sh"
ARG CONFIGLOCATION="/data"
RUN chmod 744 /ha_lsio.sh && if grep -qr "lsio" /etc; then /ha_lsio.sh "$CONFIGLOCATION"; fi && rm /ha_lsio.sh
##################
# 3 Install apps #
##################
# Copy local files
COPY rootfs/ /
# 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 00-local_mounts.sh 00-smb_mounts.sh"
# Automatic modules download
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_automodules.sh" "/ha_automodules.sh"
RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_automodules.sh
################
# 4 Entrypoint #
################
# Add entrypoint
ENV S6_STAGE2_HOOK=/ha_entrypoint.sh
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint.sh" "/ha_entrypoint.sh"
# Entrypoint modifications
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint_modif.sh" "/ha_entrypoint_modif.sh"
RUN chmod 777 /ha_entrypoint.sh /ha_entrypoint_modif.sh && /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh
# Standalone bashio command
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/bashio-standalone.sh" "/.bashio-standalone.sh"
RUN chmod 777 /.bashio-standalone.sh
WORKDIR /
ENTRYPOINT [ "/ha_entrypoint.sh" ]
CMD [ "/usr/bin/env" ]
############
# 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="9980" \
HEALTH_URL=""
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

46
collabora/README.md Normal file
View File

@@ -0,0 +1,46 @@
# Home assistant add-on: collabora
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
[![Donate][paypal-badge]](https://www.paypal.com/donate/?hosted_button_id=DZFULJZTP3UQA)
![Version](https://img.shields.io/badge/dynamic/json?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fcollabora%2Fconfig.json)
![Ingress](https://img.shields.io/badge/dynamic/json?label=Ingress&query=%24.ingress&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fcollabora%2Fconfig.json)
![Arch](https://img.shields.io/badge/dynamic/json?color=success&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fcollabora%2Fconfig.json)
## About
Collabora Online is a collaborative office suite based on LibreOffice technology.
## Installation
1. Click the Home Assistant My add-on store button below.
1. Click the "Install" button to install the add-on.
1. Start the add-on.
1. Check the logs of the add-on to see if everything went well.
<a href="https://my.home-assistant.io/redirect/supervisor_addon/?addon=local_collabora" target="_blank"><img src="https://my.home-assistant.io/badges/supervisor_addon.svg" alt="Open your Home Assistant instance and show the add add-on repository dialog"/></a>
## Configuration
Webui can be found at <http://homeassistant:9980> or through Ingress.
### Options
Configure the add-on to allow access from your Nextcloud instance:
- `domain`: Regex matching the Nextcloud host (for example `cloud\\.example\\.com`).
- `username` and `password`: Optional credentials for the Collabora admin console.
### 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)
- **Environment variables**: See [Add Environment Variables to your Addon](https://github.com/alexbelgium/hassio-addons/wiki/Add-Environment-variables-to-your-Addon)
## Support
Create an issue on GitHub
[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee%20(no%20paypal)-%23d32f2f?logo=buy-me-a-coffee&style=flat&logoColor=white
[paypal-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee%20with%20Paypal-0070BA?logo=paypal&style=flat&logoColor=white

66
collabora/apparmor.txt Normal file
View File

@@ -0,0 +1,66 @@
#include <tunables/global>
profile collabora_addon flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
capability,
file,
signal,
mount,
umount,
remount,
network udp,
network tcp,
network dgram,
network stream,
network inet,
network inet6,
network netlink raw,
network unix dgram,
capability setgid,
capability setuid,
capability sys_admin,
capability dac_read_search,
# capability dac_override,
# capability sys_rawio,
# 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,
# Files required
/dev/fuse mrwkl,
/dev/sda1 mrwkl,
/dev/sdb1 mrwkl,
/dev/nvme0 mrwkl,
/dev/nvme1 mrwkl,
/dev/mmcblk0p1 mrwkl,
/dev/* mrwkl,
/tmp/** mrkwl,
# 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,
}

9
collabora/build.json Normal file
View File

@@ -0,0 +1,9 @@
{
"build_from": {
"aarch64": "collabora/code:25.04.4.2.1",
"amd64": "collabora/code:25.04.4.2.1"
},
"codenotary": {
"signer": "alexandrep.github@gmail.com"
}
}

106
collabora/config.json Normal file
View File

@@ -0,0 +1,106 @@
{
"arch": [
"aarch64",
"amd64"
],
"codenotary": "alexandrep.github@gmail.com",
"description": "Collabora Online office suite",
"devices": [
"/dev/dri",
"/dev/dri/card0",
"/dev/dri/card1",
"/dev/dri/renderD128",
"/dev/vchiq",
"/dev/video10",
"/dev/video11",
"/dev/video12",
"/dev/video13",
"/dev/video14",
"/dev/video15",
"/dev/video16",
"/dev/ttyUSB0",
"/dev/sda",
"/dev/sdb",
"/dev/sdc",
"/dev/sdd",
"/dev/sde",
"/dev/sdf",
"/dev/sdg",
"/dev/nvme",
"/dev/nvme0",
"/dev/nvme0n1",
"/dev/nvme0n1p1",
"/dev/nvme0n1p2",
"/dev/nvme0n1p3",
"/dev/nvme1n1",
"/dev/nvme1n1p1",
"/dev/nvme1n1p2",
"/dev/nvme1n1p3",
"/dev/nvme2n1",
"/dev/nvme2n1p1",
"/dev/nvme2n1p2",
"/dev/nvme2n3p3",
"/dev/mmcblk",
"/dev/fuse",
"/dev/sda1",
"/dev/sdb1",
"/dev/sdc1",
"/dev/sdd1",
"/dev/sde1",
"/dev/sdf1",
"/dev/sdg1",
"/dev/sda2",
"/dev/sdb2",
"/dev/sdc2",
"/dev/sdd2",
"/dev/sde2",
"/dev/sdf2",
"/dev/sdg2",
"/dev/sda3",
"/dev/sdb3",
"/dev/sda4",
"/dev/sdb4",
"/dev/sda5",
"/dev/sda6",
"/dev/sda7",
"/dev/sda8",
"/dev/nvme0",
"/dev/nvme1",
"/dev/nvme2"
],
"image": "ghcr.io/alexbelgium/collabora-{arch}",
"ingress": true,
"ingress_port": 9980,
"ingress_stream": true,
"init": false,
"map": [
"addon_config:rw"
],
"name": "Collabora",
"options": {
"domain": "",
"username": "",
"password": "",
"PGID": 1000,
"PUID": 1000
},
"panel_admin": false,
"panel_icon": "mdi:file-document-edit-outline",
"ports": {
"9980/tcp": 9980
},
"ports_description": {
"9980/tcp": "Web interface (Not required for Ingress)"
},
"schema": {
"domain": "str?",
"username": "str?",
"password": "password?",
"PGID": "int",
"PUID": "int",
"TZ": "str?"
},
"slug": "collabora",
"url": "https://github.com/alexbelgium/hassio-addons",
"version": "25.04.4.2.2"
}

View File

@@ -0,0 +1,21 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -e
if bashio::config.has_value 'domain'; then
domain="$(bashio::config 'domain')"
export domain
fi
if bashio::config.has_value 'username'; then
username="$(bashio::config 'username')"
export username
fi
if bashio::config.has_value 'password'; then
password="$(bashio::config 'password')"
export password
fi
bashio::log.info "Starting Collabora Online..."
exec s6-setuidgid cool /usr/bin/entrypoint.sh coolwsd

8
collabora/updater.json Normal file
View File

@@ -0,0 +1,8 @@
{
"last_update": "02-08-2025",
"repository": "alexbelgium/hassio-addons",
"slug": "collabora",
"source": "github",
"upstream_repo": "CollaboraOnline/online",
"upstream_version": "25.04.4.2.1"
}