Log when startup is successful

This commit is contained in:
Leonard Jonathan Oh 2023-04-14 10:21:11 +00:00
parent 9f3a47ed53
commit 686fdf7c6f
2 changed files with 18 additions and 10 deletions

View file

@ -61,16 +61,20 @@ sed 's/^auth_logging_filename = .*/auth_logging_filename = "auth.log"/' -i $SNAP
sed 's/^auth_logging_format = .*/auth_logging_format = "[{date:Y-m-d H:i:s}] Auth failed: ip={request:ip} user={imap:login} host={imap:host} port={imap:port}"/' -i $SNAPPYMAIL_CONFIG_FILE sed 's/^auth_logging_format = .*/auth_logging_format = "[{date:Y-m-d H:i:s}] Auth failed: ip={request:ip} user={imap:login} host={imap:host} port={imap:port}"/' -i $SNAPPYMAIL_CONFIG_FILE
sed 's/^auth_syslog = .*/auth_syslog = Off/' -i $SNAPPYMAIL_CONFIG_FILE sed 's/^auth_syslog = .*/auth_syslog = Off/' -i $SNAPPYMAIL_CONFIG_FILE
(
while ! nc -vz -w 1 localhost 8888 > /dev/null 2>&1; do echo "[INFO] Checking whether nginx is alive"; sleep 1; done
while ! nc -vz -w 1 localhost 9000 > /dev/null 2>&1; do echo "[INFO] Checking whether php-fpm is alive"; sleep 1; done
# Create snappymail admin password if absent # Create snappymail admin password if absent
SNAPPYMAIL_ADMIN_PASSWORD_FILE=/var/lib/snappymail/_data_/_default_/admin_password.txt SNAPPYMAIL_ADMIN_PASSWORD_FILE=/var/lib/snappymail/_data_/_default_/admin_password.txt
if [ ! -f "$SNAPPYMAIL_ADMIN_PASSWORD_FILE" ]; then if [ ! -f "$SNAPPYMAIL_ADMIN_PASSWORD_FILE" ]; then
(
while ! nc -vz -w 1 localhost 8888 > /dev/null 2>&1; do echo "[INFO] Checking whether Snappymail is alive"; sleep 1; done
echo "[INFO] Creating Snappymail admin password file: $SNAPPYMAIL_ADMIN_PASSWORD_FILE" echo "[INFO] Creating Snappymail admin password file: $SNAPPYMAIL_ADMIN_PASSWORD_FILE"
wget -qO- 'http://localhost:8888/?/AdminAppData/0/12345/' > /dev/null wget -T 1 -qO- 'http://localhost:8888/?/AdminAppData/0/12345/' > /dev/null
echo "[INFO] Snappymail Admin Panel ready at http://localhost:8888/?admin. Login using password in $SNAPPYMAIL_ADMIN_PASSWORD_FILE" echo "[INFO] Snappymail Admin Panel ready at http://localhost:8888/?admin. Login using password in $SNAPPYMAIL_ADMIN_PASSWORD_FILE"
) &
fi fi
wget -T 1 -qO- 'http://localhost:8888/' > /dev/null
echo "[INFO] Snappymail ready at http://localhost:8888/"
) &
# RUN ! # RUN !
exec /usr/bin/supervisord -c /supervisor.conf --pidfile /run/supervisord.pid exec /usr/bin/supervisord -c /supervisor.conf --pidfile /run/supervisord.pid

View file

@ -2,7 +2,7 @@
# See: https://github.com/GoogleContainerTools/container-structure-test/issues/78 # See: https://github.com/GoogleContainerTools/container-structure-test/issues/78
schemaVersion: 2.0.0 schemaVersion: 2.0.0
commandTests: commandTests:
- name: Server starts - name: Integration test
command: /bin/sh command: /bin/sh
args: args:
- -c - -c
@ -14,6 +14,10 @@ commandTests:
pidof supervisord pidof supervisord
pidof nginx pidof nginx
pidof php-fpm pidof php-fpm
ls -al /var/lib/snappymail/_data_/_default_/configs/application.ini
ls -al /var/lib/snappymail/_data_/_default_/admin_password.txt
nc -vz localhost 8888
nc -vz localhost 9000
wget -S -T 3 -O /dev/null http://localhost:8888 wget -S -T 3 -O /dev/null http://localhost:8888
kill `pidof supervisord` kill `pidof supervisord`
metadataTest: metadataTest:
@ -22,4 +26,4 @@ metadataTest:
entrypoint: [] entrypoint: []
cmd: ["/entrypoint.sh"] cmd: ["/entrypoint.sh"]
workdir: /snappymail workdir: /snappymail
user: '' user: root