Skip to content

Commit 4304a20

Browse files
committed
entrypoint: Better error handling on MANUAL_CONFIGURATION errors.
1 parent 5c4773b commit 4304a20

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

entrypoint.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,33 @@ initialConfiguration() {
349349
secretsConfiguration
350350
authenticationBackends
351351
zulipConfiguration
352+
else
353+
# Check that the configuration will work
354+
root_path="/etc/zulip"
355+
if [ "$LINK_SETTINGS_TO_DATA" = "True" ] || [ "$LINK_SETTINGS_TO_DATA" = "true" ]; then
356+
root_path="/data/settings/etc-zulip"
357+
fi
358+
failure=0
359+
for conf_file in zulip.conf zulip-secrets.conf settings.py; do
360+
if [ ! -f "/etc/zulip/$conf_file" ]; then
361+
echo "ERROR: $root_path/$conf_file does not exist!"
362+
failure=1
363+
elif ! sudo -u zulip test -r "/etc/zulip/$conf_file"; then
364+
echo "ERROR: $root_path/$conf_file is not readable by the zulip user (UID $(id -u zulip))"
365+
failure=1
366+
elif [ ! -s "/etc/zulip/$conf_file" ]; then
367+
echo "ERROR: $root_path/$conf_file is empty"
368+
failure=1
369+
fi
370+
done
371+
if [ "$failure" = "1" ]; then
372+
ls -l /etc/zulip/
373+
exit 1
374+
fi
375+
if ! su zulip -c "/home/zulip/deployments/current/manage.py checkconfig"; then
376+
echo "Error in the Zulip configuration. Exiting."
377+
exit 1
378+
fi
352379
fi
353380
autoBackupConfiguration
354381
echo "=== End Initial Configuration Phase ==="

0 commit comments

Comments
 (0)