feat(entrypoint): add debug mode for entrypoint
This PR does two things:
- Adds a new environment variable (
IMAGE_DEBUG) that toggles on a verbose/debug mode for key image functions (entrypoint, install, rsync) - Adjusts the retry output slightly to be clearer about when retry will start / has started
Details:
- Adds a new environment variable that toggles on verbose/debug output for key image functions
- the
entrypoint.shitself -
occ maintennace:install -
rsync - Note:
occ upgradedidn't need it because it's already fairly verbose by default
- the
- Adjusts the retry output to be clearer about when retry will start / has started
- Adjusts initial message to tell operator it'll be retried in 10s
- Adds a message when 10s timer has expired to make clear when retry attempt has started for real (since I noticed that in normal - i.e. non-IMAGE_DEBUG mode - the install retry just runs again silently so its unclear it's actually retried until the install completes)
- Adds retry count to output
New retry output:
test-nc30-fpm-subdirectory-app-1 | Nextcloud installation failed; will retry in 10s...
[...]
test-nc30-fpm-subdirectory-db-1 | 2024-10-16 14:14:41 0 [Note] mariadbd: ready for connections.
test-nc30-fpm-subdirectory-db-1 | Version: '10.6.19-MariaDB-ubu2004-log' socket: '/usr/local/run/mysql.sock' port: 0 mariadb.org binary distribution
test-nc30-fpm-subdirectory-app-1 | Retrying nextcloud install now... (1 of 10 attempts)
test-nc30-fpm-subdirectory-app-1 | Nextcloud was successfully installed
[...]
TODO:
- [x]
shdebugging / verbose mode - [x]
occ maintenance:installdebugging / verbose mode - [x] hide all behind a toggle config variable
- [ ] anything else?
- [x] rsync
- [x] ~~
occ upgrade~~ (only adds timestamps so not necessary) - [ ] other
occcalls (other than the simple ones)?
- [x] docs: README coverage of config variable that toggles this feature on
- [x] push latest changes
- [x] request review
Might also think about adding -v to occ maintennace:install
Cc: @tzerber You might find this of interest too
Cc: @tzerber You might find this of interest too
I do like it, neat. Would also help debugging fresh installs like the one we had few weeks(months? can't remember) ago where upon fresh install on slower hardware it was reporting weird errors and the only solution was to down/up the container. Good job!
This would be an option would work exclusively on the Nextcloud image.
It has almost the same effect as docker run nextcloud sh -eux /entrypoint.sh apache2-foreground but this works on any other image from the official library.
It has almost the same effect as
@J0WI Well, it also turns on verbose mode for rsync and the installer (added in v28: see nextcloud/server#41214) too.
Perhaps verbose mode for the installer should on by default in the entrypoint (with or without this PR). After all, updating is already fairly verbose. The installer just isn't by default. It's a one-off event so maybe that's the approach there.
Verbose mode for rsync could be helpful in troubleshooting situations that arise with folks with whacky NFS storage/etc. (seems to arise with k8s/helm users most often), but having it on by default doesn't make sense.