Skip to content
Snippets Groups Projects
Verified Commit 6733edb1 authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

process feedback on nextcloud postStart script

parent 051eb14d
No related branches found
No related tags found
1 merge request!300Resolve "Migrate jobs to postStartCommand"
Pipeline #31564 passed with stages
in 10 minutes and 13 seconds
......@@ -83,7 +83,7 @@ This chart adds a "postStart" command to the Nextcloud pod, that installs apps
integration with ONLYOFFICE as well as the Stackspin OIDC provider.
Kubernetes postStart commands do not log to the pod log. Instead, the script
creates its own log in `/var/www/html/tmp/postStart<date>.log`. This means that
creates its own log in `/var/www/tmp/postStart<date>.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
......
......@@ -57,14 +57,14 @@ data:
sleep $wait
done
echo "$occ now exists!!!"
echo "$occ now exists!"
count=0
# As soon as the $occ command exist, we know that we can run occ, but
# Nextcloud might still be initializing, a "lock file" will exist, wait
# until that's gone before running our own setup:
until run_as "php occ status --output json" | grep '"installed":true' || [ "$count" -gt "$limit" ]
# Nextcloud might still be initializing, we use `occ` to find out whether
# the installation process has finished, and then we continue.
until [[ $(run_as "php occ status --output json") =~ '"installed":true' ]] || [ "$count" -gt "$limit" ]
do
count=$((count+1))
wait=$((count*10))
......@@ -72,8 +72,12 @@ data:
sleep $wait
done
echo "Nextcloud lock file $lock is gone, we can do our thing!"
echo "Nextcloud is now installed, we can do our thing!"
# The `php occ status` command can, and is allowed to, fail when the `occ`
# file already exists, but the rest of the Nextcloud files have not been
# synchronized yet. However from this point in the script onwards,
# everything should succeed.
set -e
# Enable app store so we can run `install` and `enable` commands
......@@ -120,13 +124,14 @@ data:
fi
{{- else }}
# Unpinned app
if ! echo "$app_versions" | grep -q '"{{ .name }}"'; then
echo "Installing app {{ .name }}"
run_as "php $occ app:install {{ .name }} --keep-disabled --no-interaction"
else
if [[ "$app_versions" =~ '"{{ .name }}"' ]]
then
# Update the app to its latest version
echo "Updating app {{ .name }}"
run_as "php $occ app:update {{ .name }} --no-interaction"
else
echo "Installing app {{ .name }}"
run_as "php $occ app:install {{ .name }} --keep-disabled --no-interaction"
fi
{{ end }} # end if and .github_repository .version
{{- if .enabled }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment