1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-20 22:08:39 +00:00

update monit

This commit is contained in:
kev 2014-12-30 11:31:19 +08:00
parent 1500fd5f61
commit 6b7083504f
8 changed files with 46 additions and 24 deletions

@ -7,7 +7,7 @@ MAINTAINER kev
RUN echo "Asia/Shanghai" > /etc/timezone
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN apt-get update && apt-get install -y supervisor haproxy libfontconfig1 libfreetype6 nginx monit
RUN apt-get update && apt-get install -y supervisor haproxy libfontconfig1 libfreetype6 nginx
RUN mkdir -p /data/ /webkit/includes/
ADD ./*.js /webkit/
@ -16,7 +16,7 @@ ADD ./bin/ /usr/local/bin/
ADD ./etc/haproxy.cfg /etc/haproxy/
ADD ./etc/supervisor/supervisord.conf /etc/supervisor/
ADD ./etc/supervisor/conf.d/ /etc/supervisor/conf.d/
ADD ./etc/monit/conf.d/ /etc/monit/conf.d/
ADD ./etc/monitrc /etc/
ADD ./etc/nginx.cfg /etc/nginx/sites-enabled/default
VOLUME /data/

Binary file not shown.

@ -188,9 +188,11 @@ function urlopen(req, callback) {
case 'jpg':
case 'png':
case 'gif':
data = '/data/' + req.requestId;
page.render(data, {format: req.requestType});
break;
var name = req.requestId + '.' + req.requestType;
page.render('/data/' + name, {format: req.requestType});
result.pageCapture = name;
data = page.content;
break
case 'script':
data = page.evaluate(function() {
return window.pjsc_output;

@ -1,3 +0,0 @@
check program cleanup with path "/usr/bin/find /data -type f -cmin +60 -delete"
every 5 cycles
if status != 0 then alert

@ -1,4 +0,0 @@
set httpd port 2812 and
use address 0.0.0.0
allow 0.0.0.0/0

@ -1,60 +1,87 @@
###############################################################################
## Monit control file
###############################################################################
###############################################################################
## Global section
###############################################################################
set daemon 60
with start delay 240
set httpd port 2812 and
use address 0.0.0.0
allow 0.0.0.0/0
###############################################################################
## Service (cleanup)
###############################################################################
check program cleanup with path "/usr/bin/find /data -type f -cmin +60 -delete"
every 5 cycles
if status != 0 then alert
###############################################################################
## Services (webkit)
###############################################################################
check process webkit-8080 with pidfile /var/run/webkit-8080.pid
restart program = "/usr/bin/supervisorctl restart webkit:webkit-8080"
if uptime > 1 hour then restart
if total memory > 100 MB for 5 cycles then restart
if total memory > 50 MB for 5 cycles then restart
if total cpu > 10% for 5 cycles then alert
check process webkit-8081 with pidfile /var/run/webkit-8081.pid
restart program = "/usr/bin/supervisorctl restart webkit:webkit-8081"
if uptime > 1 hour then restart
if total memory > 100 MB for 5 cycles then restart
if total memory > 50 MB for 5 cycles then restart
if total cpu > 10% for 5 cycles then alert
check process webkit-8082 with pidfile /var/run/webkit-8082.pid
restart program = "/usr/bin/supervisorctl restart webkit:webkit-8082"
if uptime > 1 hour then restart
if total memory > 100 MB for 5 cycles then restart
if total memory > 50 MB for 5 cycles then restart
if total cpu > 10% for 5 cycles then alert
check process webkit-8083 with pidfile /var/run/webkit-8083.pid
restart program = "/usr/bin/supervisorctl restart webkit:webkit-8083"
if uptime > 1 hour then restart
if total memory > 100 MB for 5 cycles then restart
if total memory > 50 MB for 5 cycles then restart
if total cpu > 10% for 5 cycles then alert
check process webkit-8084 with pidfile /var/run/webkit-8084.pid
restart program = "/usr/bin/supervisorctl restart webkit:webkit-8084"
if uptime > 1 hour then restart
if total memory > 100 MB for 5 cycles then restart
if total memory > 50 MB for 5 cycles then restart
if total cpu > 10% for 5 cycles then alert
check process webkit-8085 with pidfile /var/run/webkit-8085.pid
restart program = "/usr/bin/supervisorctl restart webkit:webkit-8085"
if uptime > 1 hour then restart
if total memory > 100 MB for 5 cycles then restart
if total memory > 50 MB for 5 cycles then restart
if total cpu > 10% for 5 cycles then alert
check process webkit-8086 with pidfile /var/run/webkit-8086.pid
restart program = "/usr/bin/supervisorctl restart webkit:webkit-8086"
if uptime > 1 hour then restart
if total memory > 100 MB for 5 cycles then restart
if total memory > 50 MB for 5 cycles then restart
if total cpu > 10% for 5 cycles then alert
check process webkit-8087 with pidfile /var/run/webkit-8087.pid
restart program = "/usr/bin/supervisorctl restart webkit:webkit-8087"
if uptime > 1 hour then restart
if total memory > 100 MB for 5 cycles then restart
if total memory > 50 MB for 5 cycles then restart
if total cpu > 10% for 5 cycles then alert
check process webkit-8088 with pidfile /var/run/webkit-8088.pid
restart program = "/usr/bin/supervisorctl restart webkit:webkit-8088"
if uptime > 1 hour then restart
if total memory > 100 MB for 5 cycles then restart
if total memory > 50 MB for 5 cycles then restart
if total cpu > 10% for 5 cycles then alert
check process webkit-8089 with pidfile /var/run/webkit-8089.pid
restart program = "/usr/bin/supervisorctl restart webkit:webkit-8089"
if uptime > 1 hour then restart
if total memory > 100 MB for 5 cycles then restart
if total memory > 50 MB for 5 cycles then restart
if total cpu > 10% for 5 cycles then alert

@ -1,2 +1,2 @@
[program:monit]
command = /usr/local/bin/monit -I -c /etc/monit/monitrc
command = /usr/local/bin/monit -I -c /etc/monitrc

@ -14,7 +14,7 @@ var setDefaults = function(req) {
req.isDebug = checkBoolean('isDebug', req.isDebug, false);
req.loadImages = checkBoolean('loadImages', req.loadImages, false);
req.outputAsJson = checkBoolean('outputAsJson', req.outputAsJson, true); //FIXME: it is ignored
req.requestId = checkString('requestId', req.requestId, utils.guid());
req.requestId = checkString('requestId', utils.guid()); // ignore user input
req.requestType = checkString('requestType', req.requestType, 'text');
req.resourceUrlBlacklist = checkArray('resourceUrlBlacklist', req.resourceUrlBlacklist, []); //HINT: set it to ['.*\.css.*'] to block stylesheet
req.resourceUrlWhitelist = checkArray('resourceUrlWhitelist', req.resourceUrlWhitelist, []); //FIXME: not implemented