mirror of
https://github.com/bitnami/containers.git
synced 2026-02-23 08:57:25 +08:00
added circuit breaker logic for frequent and repeated failures
This commit is contained in:
@@ -1 +0,0 @@
|
||||
/bin/true
|
||||
21
bitnami/apache/rootfs/etc/services.d/apache/finish
Executable file
21
bitnami/apache/rootfs/etc/services.d/apache/finish
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
failcount=0
|
||||
if [ -f $BITNAMI_APP_DIR/tmp/failcount ]; then
|
||||
failcount=$(cat $BITNAMI_APP_DIR/tmp/failcount)
|
||||
fi
|
||||
|
||||
start=$(cat $BITNAMI_APP_DIR/tmp/start)
|
||||
stop=`date '+%d%H%M%S'`
|
||||
interval=`expr $stop - $start`
|
||||
if test $interval -lt 30 ; then
|
||||
failcount=`expr $failcount + 1`
|
||||
else
|
||||
failcount=0
|
||||
fi
|
||||
echo -n $failcount > $BITNAMI_APP_DIR/tmp/failcount
|
||||
|
||||
# bring down container on frequent failures. something is definitely wrong
|
||||
if test $failcount -ge 3 ; then
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
fi
|
||||
@@ -5,4 +5,6 @@ source $BITNAMI_PREFIX/bitnami-utils.sh
|
||||
# Remove zombie pidfile
|
||||
rm -f $BITNAMI_APP_DIR/logs/httpd.pid
|
||||
|
||||
mkdir -p $BITNAMI_APP_DIR/tmp
|
||||
date '+%d%H%M%S' > $BITNAMI_APP_DIR/tmp/start
|
||||
exec httpd -DFOREGROUND -f $BITNAMI_APP_DIR/conf/httpd.conf ${EXTRA_OPTIONS:+"$EXTRA_OPTIONS"}
|
||||
|
||||
Reference in New Issue
Block a user