Open shaunco opened 7 months ago
The VPN, API, Registry, and S3 containers all seem to have the same entrypoint /usr/bin/entry.sh
. The script could benefit from a more detailed logs in case of errors. Maybe something like the following;
#!/bin/bash
set -m
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Function to print error message
print_error() {
echo -e "${RED}Error: $1${NC}"
}
# Function to handle cleanup
cleanup() {
# Add cleanup tasks here
exit 1
}
# Trap error signals and call cleanup function
trap 'print_error "Script encountered an error"; cleanup' ERR
echo -e "${GREEN}Systemd init system enabled."
# systemd causes a POLLHUP for console FD to occur
# on startup once all other processes have stopped.
# We need this sleep to ensure this doesn't occur, else
# logging to the console will not work.
sleep infinity &
# Example command that may fail
# Uncomment to test error handling
#non_existent_command
for var in $(compgen -e); do
printf '%q=%q\n' "$var" "${!var}"
done > /etc/docker.env
exec /sbin/init
As previously reported in https://github.com/balena-io/open-balena/issues/99 the only log that gets spit out to stdout/stderr is
This is the case in Kubernetes and Docker for all the open-balena-* services... which makes capturing logs quite difficult in production, especially when the container is constantly restarting.