testing and preparing beta

This commit is contained in:
buanet
2020-07-28 19:25:44 +02:00
parent e6469a4255
commit f836cd1fca
5 changed files with 42 additions and 21 deletions

View File

@@ -126,6 +126,20 @@ To get familiar with that feature try the following: Create a Container, mount a
Details will follow soon.
### Healthcheck (beta)
Since v5.0.2beta the image contains a simple Docker healthcheck. At the moment it only checks if js-controller is running inside the container and reports "healthy" or "unhealthy" to the Docker daemon. Further development is planned.
Hint: As the Docker daemon itself gives no opportunity to automatically restart an unhealthy container you might want to setup some kind of "watchdog container" like this simple one: https://hub.docker.com/r/willfarrell/autoheal/ (works great so far!).
### Maintenance script (beta)
Within the implementation of the docker health check (above) some manual maintenance actions, like stopping ioBroker for upgrading js-controller, would cause the container to get "unhealthy" and may cause an external watchdog to automatically restart it.
In this case you can use the new maintenance command line tool inside the container. By simply typing `maintenance on` it will activate some kind of "maintenance mode" and automatically stop ioBroker while the container stays healthy.
After your maintenance is done just type `maintenance off`. Depending on the selected restart policy of your container the command will stop (and automatically restart) it.
## Best practices
### Avoid using "latest" tag
@@ -164,11 +178,16 @@ Thank you!
## Changelog
### v5.0.1beta (2020-07-01)
* fixing backup detection in startup script
* fixing permission issue on iobroker restored
* extended Logging
* optimize multihost support
### v5.0.2beta (2020-07-28)
* extend readme.md doku
* added maintenance script
* added container healthcheck
* fixed configuration procedure and logging for objects and states db setup
* v5.0.1beta (2020-07-01)
* fixing backup detection in startup script
* fixing permission issue on iobroker restored
* extended Logging
* optimize multihost support
### v5.0.0 (2020-06-29)
* v4.2.4beta (2020-06-23)

View File

@@ -51,13 +51,13 @@ COPY scripts/setup_avahi.sh setup_avahi.sh
COPY scripts/setup_packages.sh setup_packages.sh
COPY scripts/setup_zwave.sh setup_zwave.sh
COPY scripts/healthcheck.sh healthcheck.sh
COPY scripts/maintenance-mode.sh maintenance-mode.sh
COPY scripts/maintenance.sh maintenance.sh
RUN chmod +x iobroker_startup.sh \
&& chmod +x setup_avahi.sh \
&& chmod +x setup_packages.sh \
&& chmod +x setup_zwave.sh \
&& chmod +x healthcheck.sh \
&& chmod +x maintenance-mode.sh
&& chmod +x maintenance.sh
WORKDIR /opt/userscripts/
COPY scripts/userscript_firststart_example.sh userscript_firststart_example.sh
COPY scripts/userscript_everystart_example.sh userscript_everystart_example.sh

View File

@@ -8,7 +8,7 @@ then
exit 0
elif [ "$(cat /opt/iobroker/.docker_config/.healthcheck)" == "maintenance" ]
then
echo 'Health status: OK - Container running in maintenance mode.'
echo 'Health status: OK - Container is running in maintenance mode.'
exit 0
elif [ "$(ps -fe|grep "[i]obroker.js-controller"|awk '{print $2}')" != "" ]
then
@@ -16,5 +16,5 @@ then
exit 0
fi
echo 'Health status: !!! NOT OK !!! - Something went wrong. Please see Container Logs for more details.'
echo 'Health status: !!! NOT OK !!! - Something went wrong. Please see container logs for more details and/or try restarting the container.'
exit 1

View File

@@ -112,8 +112,9 @@ then
fi
if [ -f /opt/.firstrun ]
then
echo "Registering maintenance-mode script as command."
echo "alias maintenance-mode=\'/opt/scripts/maintenance-mode.sh\'" >> /root/.bashrc
echo "Registering maintenance script as command."
echo "alias maintenance=\'/opt/scripts/maintenance.sh\'" >> /root/.bashrc
rm -f /opt/.firstrun
echo "Done."
echo ' '
fi

View File

@@ -13,16 +13,17 @@ then
fi
elif [ "$1" == "on" ]
then
echo 'This will stop ioBroker and enable maintenance mode for this container.'
read -p 'Continue? Type yes or no: ' A
if [ "$A" == "y" ] || [ "$A" == "yes" ]
echo 'You are going to stop ioBroker and activating maintenance mode for this container.'
read -p 'Do you want to continue [yes/no]? ' A
if [ "$A" == "y" ] || [ "$A" == "Y" ] || [ "$A" == "yes" ]
then
echo 'Enabling maintenance mode...'
echo 'Activating maintenance mode...'
echo "maintenance" > /opt/iobroker/.docker_config/.healthcheck
sleep 1
echo 'Done.'
sleep 2
echo 'Stopping ioBroker...'
pkill -u iobroker
sleep 1
echo 'Done.'
exit 0
else
@@ -30,12 +31,12 @@ then
fi
elif [ "$1" == "off" ]
then
echo 'Depending of the restart policy of this container, this will force it to stop (and restart) immediately.'
echo 'Maintenance mode will be disabled after the restart.'
read -p 'Continue? Type yes or no: ' A
if [ "$A" == "y" ] || [ "$A" == "yes" ]
echo 'You are going to deactivate maintenance mode for this container.'
echo 'Depending of the restart policy of this container, this will stop/ restart your container immediately.'
read -p 'Do you want to continue [yes/no]? ' A
if [ "$A" == "y" ] || [ "$A" == "Y" ] || [ "$A" == "yes" ]
then
echo 'Disabling maintenance mode and forcing container to stop/ restart...'
echo 'Deactivating maintenance mode and forcing container to stop/ restart...'
echo "maintenance" > /opt/iobroker/.docker_config/.healthcheck
pkill -u root
exit 0