diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 446794621b1..f9026f2883d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -33,6 +33,7 @@ updates: - "/Containers/domaincheck" - "/Containers/eurooffice" - "/Containers/fulltextsearch" + - "/Containers/harp" - "/Containers/imaginary" - "/Containers/mastercontainer" - "/Containers/nextcloud" diff --git a/Containers/harp/Dockerfile b/Containers/harp/Dockerfile new file mode 100644 index 00000000000..0a9318461e3 --- /dev/null +++ b/Containers/harp/Dockerfile @@ -0,0 +1,17 @@ +# syntax=docker/dockerfile:latest +FROM ghcr.io/nextcloud/nextcloud-appapi-harp:v0.4.3 + +# USER root is probably used + +LABEL com.centurylinklabs.watchtower.enable="false" \ + wud.watch="false" \ + dockhand.update="false" \ + org.opencontainers.image.title="Nextcloud AppAPI HARP for Nextcloud AIO" \ + org.opencontainers.image.description="Nextcloud AppAPI HARP for Nextcloud All-in-One" \ + org.opencontainers.image.url="https://github.com/nextcloud/all-in-one" \ + org.opencontainers.image.source="https://github.com/nextcloud/all-in-one" \ + org.opencontainers.image.vendor="Nextcloud" \ + org.opencontainers.image.documentation="https://github.com/nextcloud/all-in-one/blob/main/readme.md" + +# Copied from upstream +HEALTHCHECK --interval=10s --timeout=10s --retries=9 CMD /healthcheck.sh diff --git a/manual-install/update-yaml.sh b/manual-install/update-yaml.sh index 9d966a9d9ea..88e5b3ab80a 100644 --- a/manual-install/update-yaml.sh +++ b/manual-install/update-yaml.sh @@ -27,8 +27,6 @@ OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[] | select(.container_name == "next OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[] | select(.container_name == "nextcloud-aio-borgbackup"))')" OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[] | select(.container_name == "nextcloud-aio-docker-socket-proxy"))')" OUTPUT="$(echo "$OUTPUT" | jq '.services[] |= if has("depends_on") then .depends_on |= if contains(["nextcloud-aio-docker-socket-proxy"]) then del(.[index("nextcloud-aio-docker-socket-proxy")]) else . end else . end')" -OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[] | select(.container_name == "nextcloud-aio-harp"))')" -OUTPUT="$(echo "$OUTPUT" | jq '.services[] |= if has("depends_on") then .depends_on |= if contains(["nextcloud-aio-harp"]) then del(.[index("nextcloud-aio-harp")]) else . end else . end')" OUTPUT="$(echo "$OUTPUT" | jq '.services[] |= if has("depends_on") then .depends_on |= map({ (.): { "condition": "service_started", "required": false } }) else . end' | jq '.services[] |= if has("depends_on") then .depends_on |= reduce .[] as $item ({}; . + $item) else . end')" sudo snap install yq @@ -47,8 +45,6 @@ sed -i 's|- ip_binding: |- |' containers.yml sed -i '/AIO_TOKEN/d' containers.yml sed -i '/AIO_URL/d' containers.yml sed -i '/DOCKER_SOCKET_PROXY_ENABLED/d' containers.yml -sed -i '/HARP_ENABLED/d' containers.yml -sed -i '/HARP_HOST/d' containers.yml sed -i '/HP_SHARED_KEY/d' containers.yml sed -i '/ADDITIONAL_TRUSTED_PROXY/d' containers.yml sed -i '/TURN_DOMAIN/d' containers.yml @@ -96,6 +92,7 @@ sed -i 's|NEXTCLOUD_TRUSTED_CACERTS_DIR=|NEXTCLOUD_TRUSTED_CACERTS_DIR=/usr/loca sed -i 's|UPDATE_NEXTCLOUD_APPS=|UPDATE_NEXTCLOUD_APPS="no" # When setting to "yes" (with quotes), it will automatically update all installed Nextcloud apps upon container startup on saturdays.|' sample.conf sed -i 's|APACHE_PORT=|APACHE_PORT=443 # Changing this to a different value than 443 will allow you to run it behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else).|' sample.conf sed -i 's|APACHE_IP_BINDING=|APACHE_IP_BINDING=0.0.0.0 # This can be changed to e.g. 127.0.0.1 if you want to run AIO behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else) and if that is running on the same host and using localhost to connect|' sample.conf +sed -i 's|WATCHTOWER_DOCKER_SOCKET_PATH=|WATCHTOWER_DOCKER_SOCKET_PATH=/var/run/docker.sock # This can be changed depending on where the docker socket is located on your host|' sample.conf sed -i 's|TALK_PORT=|TALK_PORT=3478 # This allows to adjust the port that the talk container is using. It should be set to something higher than 1024! Otherwise it might not work!|' sample.conf sed -i 's|NC_DOMAIN=|NC_DOMAIN=yourdomain.com # TODO! Needs to be changed to the domain that you want to use for Nextcloud.|' sample.conf sed -i 's|NEXTCLOUD_PASSWORD=|NEXTCLOUD_PASSWORD= # TODO! This is the password of the initially created Nextcloud admin with username "admin".|' sample.conf diff --git a/nextcloud-aio-helm-chart/readme.md b/nextcloud-aio-helm-chart/readme.md index cb31e601ea6..583a5ec1396 100755 --- a/nextcloud-aio-helm-chart/readme.md +++ b/nextcloud-aio-helm-chart/readme.md @@ -36,6 +36,28 @@ helm install nextcloud-aio nextcloud-aio/nextcloud-aio-helm-chart -f values.yaml And after a while, everything should be set up. +## HaRP / AppAPI (ExApps) configuration + +When `HARP_ENABLED` is set to `"yes"`, the chart deploys the [HaRP](https://github.com/nextcloud/HaRP) container that AppAPI uses to run external apps (ExApps). Unlike the docker-based AIO installation, HaRP cannot use the docker backend inside Kubernetes, so the chart automatically enables HaRP's Kubernetes backend (`HP_K8S_ENABLED=true`) and lets HaRP create the ExApp deployments via the Kubernetes API. + +> [!IMPORTANT] +> HaRP needs permission to manage resources (deployments, services, persistent volume claims, …) in the namespace configured via `HARP_K8S_NAMESPACE`. The chart does **not** create this RBAC for you. You need to: +> 1. Make sure the namespace configured via `HARP_K8S_NAMESPACE` exists. +> 2. Create a `ServiceAccount` in that namespace and set its name in `HARP_SERVICE_ACCOUNT_NAME` so that it is mounted into the HaRP pod. +> 3. Grant that service account permission to manage resources in the namespace via a `Role`/`RoleBinding`. +> +> See the [HaRP repository](https://github.com/nextcloud/HaRP) for the required RBAC setup. If `HARP_SERVICE_ACCOUNT_NAME` is left empty, the namespace's `default` service account is used, which usually does not have the required permissions. + +The following values in `values.yaml` allow you to adjust the Kubernetes backend of HaRP: + +| Value | Default | Description | +| --- | --- | --- | +| `HARP_K8S_NAMESPACE` | `nextcloud-exapps` | The namespace that HaRP deploys ExApps into. It must already exist and the HaRP service account must be allowed to manage resources in it. | +| `HARP_K8S_STORAGE_CLASS` | _(empty)_ | The storage class used for ExApp persistent volume claims. Leave empty to use the cluster's default storage class. | +| `HARP_K8S_DEFAULT_STORAGE_SIZE` | `10Gi` | The default size of the persistent volume claims that HaRP creates for ExApps. | +| `HARP_K8S_HOST_ALIASES` | _(empty)_ | Optional host aliases that HaRP sets on the ExApp pods so that they can resolve the configured hostnames, e.g. when your Nextcloud domain is not resolvable by the cluster's DNS. Use a comma-separated list of `hostname:ip` pairs, e.g. `nextcloud.example.com:10.0.0.5,collabora.example.com:10.0.0.6`. Leave empty to not set any host aliases. | +| `HARP_SERVICE_ACCOUNT_NAME` | _(empty)_ | The service account that is mounted into the HaRP pod and used to authenticate against the Kubernetes API. You must create it yourself and grant it the RBAC permissions described above. Leave empty to use the namespace's `default` service account. | + ## How to update? Since the values of this helm chart may change in the future, it is highly recommended to strictly follow the following procedure whenever you want to upgrade it. 1. Stop all running pods diff --git a/nextcloud-aio-helm-chart/update-helm.sh b/nextcloud-aio-helm-chart/update-helm.sh index 8c99fc212b3..9e4d9a6a3cb 100755 --- a/nextcloud-aio-helm-chart/update-helm.sh +++ b/nextcloud-aio-helm-chart/update-helm.sh @@ -44,6 +44,7 @@ sed -i "s|- \${TALK_PORT}|- $TALK_PORT|" latest.yml sed -i "s|\${NEXTCLOUD_DATADIR}|$NEXTCLOUD_DATADIR|" latest.yml sed -i "s|\${ADDITIONAL_COLLABORA_OPTIONS}|ADDITIONAL_COLLABORA_OPTIONS_PLACEHOLDER|" latest.yml sed -i "/name: nextcloud-aio/,$ d" latest.yml +sed -i "/WATCHTOWER_DOCKER_SOCKET_PATH/d" latest.yml sed -i "/NEXTCLOUD_DATADIR/d" latest.yml sed -i "/\${NEXTCLOUD_MOUNT}/d" latest.yml sed -i "/^volumes:/a\ \ nextcloud_aio_nextcloud_trusted_cacerts:\n \ \ \ \ name: nextcloud_aio_nextcloud_trusted_cacerts" latest.yml @@ -343,6 +344,35 @@ EOL # shellcheck disable=SC1083 find ./ -name '*talk-deployment.yaml' -exec sed -i "/^.*\- env:/r /tmp/additional-talk.config" \{} \; +# Additional config for HaRP +# The manual-install (docker) only configures HaRP with the docker backend. In the +# helm chart HaRP needs to talk to the Kubernetes API instead, so we enable the +# Kubernetes backend here and expose its settings via values.yaml. +cat << EOL > /tmp/additional-harp.config + - name: HP_K8S_ENABLED + value: "true" + - name: HP_K8S_NAMESPACE + value: "{{ .Values.HARP_K8S_NAMESPACE }}" + - name: HP_K8S_STORAGE_CLASS + value: "{{ .Values.HARP_K8S_STORAGE_CLASS }}" + - name: HP_K8S_DEFAULT_STORAGE_SIZE + value: "{{ .Values.HARP_K8S_DEFAULT_STORAGE_SIZE }}" + - name: HP_K8S_HOST_ALIASES + value: "{{ .Values.HARP_K8S_HOST_ALIASES }}" +EOL +# shellcheck disable=SC1083 +find ./ -name '*harp-deployment.yaml' -exec sed -i "/^.*\- env:/r /tmp/additional-harp.config" \{} \; +# HaRP authenticates against the Kubernetes API with the service account that is +# mounted into its pod. Allow the service account name to be set via values.yaml +# so that the user can grant it the required RBAC permissions (see the readme). +cat << EOL > /tmp/additional-harp-sa.config + {{- if .Values.HARP_SERVICE_ACCOUNT_NAME }} + serviceAccountName: "{{ .Values.HARP_SERVICE_ACCOUNT_NAME }}" + {{- end }} +EOL +# shellcheck disable=SC1083 +find ./ -name '*harp-deployment.yaml' -exec sed -i "/^ spec:$/r /tmp/additional-harp-sa.config" \{} \; + cat << EOL > templates/nextcloud-aio-networkpolicy.yaml {{- if eq .Values.NETWORK_POLICY_ENABLED "yes" }} # https://github.com/ahmetb/kubernetes-network-policy-recipes/blob/master/04-deny-traffic-from-other-namespaces.md @@ -403,6 +433,7 @@ sed -i 's|= |: |' /tmp/sample.conf sed -i '/^NEXTCLOUD_DATADIR/d' /tmp/sample.conf sed -i '/^APACHE_IP_BINDING/d' /tmp/sample.conf sed -i '/^NEXTCLOUD_MOUNT/d' /tmp/sample.conf +sed -i "/WATCHTOWER_DOCKER_SOCKET_PATH/d" /tmp/sample.conf sed -i 's/ yes / "yes" /' /tmp/sample.conf sed -i 's/ no / "no" /' /tmp/sample.conf sed -i 's/"no" authentication/no authentication/' /tmp/sample.conf @@ -443,6 +474,11 @@ MAIL_FROM_ADDRESS: # (not set by default): Set the local-part for the 'f MAIL_DOMAIN: # (not set by default): Set a different domain for the emails than the domain where Nextcloud is installed. TALK_MAX_STREAM_BITRATE: "1048576" # This allows to adjust the max stream bitrate of the talk hpb TALK_MAX_SCREEN_BITRATE: "2097152" # This allows to adjust the max stream bitrate of the talk hpb +HARP_K8S_NAMESPACE: nextcloud-exapps # The Kubernetes namespace that HaRP deploys ExApps (AppAPI apps) into. The namespace must already exist and the HaRP service account must be allowed to manage resources in it. +HARP_K8S_STORAGE_CLASS: # The storage class that HaRP uses for ExApp persistent volume claims. Leave empty to use the cluster's default storage class. +HARP_K8S_DEFAULT_STORAGE_SIZE: 10Gi # The default size of the persistent volume claims that HaRP creates for ExApps. +HARP_K8S_HOST_ALIASES: # Optional. Additional host aliases that HaRP sets on the ExApp pods so that they can resolve the configured hostnames. Use a comma-separated list of hostname:ip pairs, e.g. 'nextcloud.example.com:10.0.0.5,collabora.example.com:10.0.0.6'. Leave empty to not set any host aliases. +HARP_SERVICE_ACCOUNT_NAME: # The name of the Kubernetes service account that is mounted into the HaRP pod and used to authenticate against the Kubernetes API. You need to create this service account yourself and grant it permission to manage resources (deployments, services, persistent volume claims, …) in the HARP_K8S_NAMESPACE namespace via a Role/RoleBinding. Leave empty to use the namespace's "default" service account. ADDITIONAL_CONFIG mv /tmp/sample.conf ../helm-chart/values.yaml diff --git a/php/containers.json b/php/containers.json index a63f5d16a82..8284777eb01 100644 --- a/php/containers.json +++ b/php/containers.json @@ -933,14 +933,22 @@ }, { "container_name": "nextcloud-aio-harp", - "image_tag": "release", + "image_tag": "%AIO_CHANNEL%", "display_name": "HaRP", - "image": "ghcr.io/nextcloud/nextcloud-appapi-harp", + "image": "ghcr.io/nextcloud-releases/aio-harp", "init": true, "internal_port": "8780", "expose": [ "8780" ], + "healthcheck": { + "start_period": "0s", + "test": "/healthcheck.sh", + "interval": "10s", + "timeout": "10s", + "start_interval": "5s", + "retries": 9 + }, "environment": [ "HP_SHARED_KEY=%HP_SHARED_KEY%", "NC_INSTANCE_URL=https://%NC_DOMAIN%", @@ -970,6 +978,9 @@ ], "cap_drop": [ "NET_RAW" + ], + "profiles": [ + "harp" ] }, {