From faf93653a508ed31a5eca153399c0624d477764e Mon Sep 17 00:00:00 2001
From: Maarten de Waard <maarten@greenhost.nl>
Date: Fri, 21 Oct 2022 16:35:26 +0200
Subject: [PATCH] update readme and docs in
 templates/nextcloud-onlyoffice-config.yaml

---
 README.md                                  | 36 ++++++++++------------
 templates/nextcloud-onlyoffice-config.yaml |  6 ++--
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/README.md b/README.md
index b5354d8a..fb7147cb 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,11 @@ secrets variables manually when you run helm install:
 - `onlyoffice.database.password`
 - `rabbitmq.rabbitmq.password`
 
+**NOTE:** The chart currently includes a ConfigMap with a name that is not
+dependent on the release name. This means that the chart cannot be installed
+more than once into the same namespace. If you need to install Nextcloud and
+Onlyoffice several times into the same cluster, use different namespaces.
+
 ### Install from the remote repo
 
 This is the way to go if you want to use the packaged chart as is. If you'd like to make changes before installing, refer to the next section.
@@ -41,19 +46,9 @@ helm repo add nextcloud-onlyoffice https://open.greenhost.net/api/v4/projects/1/
 Then install the chart:
 
 ```console
-helm install --wait -f values-local.yaml my-nextcloud nextcloud-onlyoffice/nextcloud-onlyoffice
+helm install -f values-local.yaml my-nextcloud nextcloud-onlyoffice/nextcloud-onlyoffice
 ```
 
-**The `--wait` is important!** We need that because of how [helm chart
-hooks](https://helm.sh/docs/topics/charts_hooks/) work:
-
-> Note that if the --wait flag is set, the library will wait until all resources
-> are in a ready state and will not run the post-install hook until they are
-> ready.
-
-The job in this chart needs the Nextcloud pod to be in a ready state before
-being executed.
-
 ### Install from a local repo
 
 Start by cloning the nextcloud helm chart repo:
@@ -78,18 +73,21 @@ helm dependency build
 
 Then install the chart:
 ```console
-helm install --wait -f values-local.yaml my-nextcloud .
+helm install -f values-local.yaml my-nextcloud .
 ```
 
-**The `--wait` is important!** We need that because of how [helm chart
-hooks](https://helm.sh/docs/topics/charts_hooks/) work:
+## Nextcloud configuration.
 
-> Note that if the --wait flag is set, the library will wait until all resources
-> are in a ready state and will not run the post-install hook until they are
-> ready.
+This chart adds a "postStart" command to the Nextcloud pod, that installs apps
+(see below) and applies a custom configuration to set up those apps and
+integration with ONLYOFFICE as well as the Stackspin OIDC provider.
 
-The job in this chart needs the Nextcloud pod to be in a ready state before
-being executed.
+Kubernetes postStart commands do not log to the pod log. Instead, the script
+creates its own log in `/var/www/html/data/postStart.log`. This means that even
+if you can't `exec` into the pod (because something is failing), you can see the
+logs inside the `data` folder in the PVC. Often, if the `postStart` command
+fails, you can also see the problem by running `kubectl describe pod <nextcloud
+pod>`.
 
 ## Apps
 
diff --git a/templates/nextcloud-onlyoffice-config.yaml b/templates/nextcloud-onlyoffice-config.yaml
index a52362c4..3bd9f492 100644
--- a/templates/nextcloud-onlyoffice-config.yaml
+++ b/templates/nextcloud-onlyoffice-config.yaml
@@ -12,8 +12,9 @@ metadata:
 data:
   setup-apps.sh: |
     #!/bin/bash
-    #
-    # This script gets executed by a post-install,post-upgrade helm hook, which
+
+    # This script gets executed as a postStart command inside the Nextcloud pod.
+    # The script:
     #
     #   * Installs all apps declared in the `apps` helm values array
     #     * Installs all apps
@@ -24,6 +25,7 @@ data:
     #   * Configures single-sign-on
     #   * Persists and loads the config.json config file
     #   * Updates database indices, columns, keys, etc needed after NC upgrade
+    #   * Writes a log to /var/www/html/data/postStart.log
     exec 1>/var/www/html/data/postStart.log
 
     # Copied from the NC docker entrypoint to run OCC commands
-- 
GitLab