From 3ff22166258d4bb9eb68e6dfaf39bb2363604826 Mon Sep 17 00:00:00 2001 From: kev Date: Thu, 25 Dec 2014 18:35:53 +0800 Subject: [PATCH] update webkit --- webkit/Dockerfile | 4 ++-- webkit/README.md | 10 +++++++--- webkit/bin/webkit.sh | 9 --------- webkit/monit/conf.d/webkit.cfg | 20 ++++++++++---------- webkit/supervisor/conf.d/webkit.conf | 3 ++- 5 files changed, 21 insertions(+), 25 deletions(-) delete mode 100755 webkit/bin/webkit.sh diff --git a/webkit/Dockerfile b/webkit/Dockerfile index 6015873..040b337 100644 --- a/webkit/Dockerfile +++ b/webkit/Dockerfile @@ -6,14 +6,14 @@ FROM ubuntu:14.04 MAINTAINER kev RUN apt-get update && apt-get install -y supervisor haproxy libfontconfig1 libfreetype6 -RUN mkdir -p /usr/local/lib/webkit/ /etc/supervisor/conf.d/ /etc/monit/ +RUN mkdir -p /usr/local/lib/webkit/ /etc/supervisor/conf.d/ /etc/monit/ /var/lib/monit/events/ ADD ./*.js ./includes /usr/local/lib/webkit/ ADD ./bin/* /usr/local/bin/ ADD ./haproxy.cfg /etc/haproxy/ ADD ./supervisor/supervisord.conf /etc/supervisor/ ADD ./supervisor/conf.d/* /etc/supervisor/conf.d/ -ADD ./monit/* /etc/monit/ +ADD ./monit/ /etc/monit/ EXPOSE 1024 2812 9001 diff --git a/webkit/README.md b/webkit/README.md index 1118b1d..76b0b07 100644 --- a/webkit/README.md +++ b/webkit/README.md @@ -1,10 +1,14 @@ -A simple service for rendering javascript-enabled website. +A simple web-service for rendering javascript-enabled website. ## server - phantomjs --config=config.json server.js + docker run -d --restart=always -p 1024:1024 -p 2812:2812 -p 9001:9001 --name=webkit vimagick/webkit ## client - http :1024 targetUrl=https://github.com/ requestType=png loadImages:=true execScripts:='{"preInjected": ["1+2+3"], "postInjected": ["Math.sqrt(2)"]}' + http :1024 targetUrl=https://github.com/ +## admin + + firefox localhost:2812 + firefox localhost:9001 diff --git a/webkit/bin/webkit.sh b/webkit/bin/webkit.sh deleted file mode 100755 index 9234b48..0000000 --- a/webkit/bin/webkit.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# -# run webkit instance -# - -set -e -cd /usr/local/lib/webkit -exec phantomjs server.js "$@" - diff --git a/webkit/monit/conf.d/webkit.cfg b/webkit/monit/conf.d/webkit.cfg index feccbe6..ebbe181 100644 --- a/webkit/monit/conf.d/webkit.cfg +++ b/webkit/monit/conf.d/webkit.cfg @@ -1,40 +1,40 @@ check process webkit-8080 with pidfile /var/run/webkit-8080.pid restart program = "/usr/bin/supervisorctl restart webkit:webkit-8080" - if uptime > 10 minute then restart + if uptime > 10 minutes then restart check process webkit-8081 with pidfile /var/run/webkit-8081.pid restart program = "/usr/bin/supervisorctl restart webkit:webkit-8081" - if uptime > 10 minute then restart + if uptime > 10 minutes then restart check process webkit-8082 with pidfile /var/run/webkit-8082.pid restart program = "/usr/bin/supervisorctl restart webkit:webkit-8082" - if uptime > 10 minute then restart + if uptime > 10 minutes then restart check process webkit-8083 with pidfile /var/run/webkit-8083.pid restart program = "/usr/bin/supervisorctl restart webkit:webkit-8083" - if uptime > 10 minute then restart + if uptime > 10 minutes then restart check process webkit-8084 with pidfile /var/run/webkit-8084.pid restart program = "/usr/bin/supervisorctl restart webkit:webkit-8084" - if uptime > 10 minute then restart + if uptime > 10 minutes then restart check process webkit-8085 with pidfile /var/run/webkit-8085.pid restart program = "/usr/bin/supervisorctl restart webkit:webkit-8085" - if uptime > 10 minute then restart + if uptime > 10 minutes then restart check process webkit-8086 with pidfile /var/run/webkit-8086.pid restart program = "/usr/bin/supervisorctl restart webkit:webkit-8086" - if uptime > 10 minute then restart + if uptime > 10 minutes then restart check process webkit-8087 with pidfile /var/run/webkit-8087.pid restart program = "/usr/bin/supervisorctl restart webkit:webkit-8087" - if uptime > 10 minute then restart + if uptime > 10 minutes then restart check process webkit-8088 with pidfile /var/run/webkit-8088.pid restart program = "/usr/bin/supervisorctl restart webkit:webkit-8088" - if uptime > 10 minute then restart + if uptime > 10 minutes then restart check process webkit-8089 with pidfile /var/run/webkit-8089.pid restart program = "/usr/bin/supervisorctl restart webkit:webkit-8089" - if uptime > 10 minute then restart + if uptime > 10 minutes then restart diff --git a/webkit/supervisor/conf.d/webkit.conf b/webkit/supervisor/conf.d/webkit.conf index a98c944..2ab826d 100644 --- a/webkit/supervisor/conf.d/webkit.conf +++ b/webkit/supervisor/conf.d/webkit.conf @@ -1,5 +1,6 @@ [program:webkit] -command = /usr/local/bin/webkit.sh %(process_num)d +command = /usr/local/bin/phantomjs server.js %(process_num)d numprocs_start = 8080 numprocs = 10 process_name = %(program_name)s-%(process_num)d +directory = /usr/local/lib/webkit