Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Commit 6641723

Browse files
jlamailleelgalu
authored andcommitted
Add browsermob-proxy in run supervisor (#362)
* Add browsermob-proxy in run supervisor * Delete browsermob proxy jar file and replaced by http get
1 parent 363c7d3 commit 6641723

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ temp.md
3131
git_shortlog.stdout
3232
.bitballoon
3333
.idea
34+
*.DS_Store
35+
*.iml

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ ENV FIREFOX_VERSION="${FF_VER}" \
688688
HOME="/home/seluser" \
689689
VNC_STORE_PWD_FILE="/home/seluser/.vnc/passwd" \
690690
BIN_UTILS="/usr/bin" \
691+
LIB_UTILS="/usr/lib" \
691692
MEM_JAVA_PERCENT=80 \
692693
WAIT_FOREGROUND_RETRY="2s" \
693694
WAIT_VNC_FOREGROUND_RETRY="6s" \
@@ -740,6 +741,7 @@ ENV FIREFOX_VERSION="${FF_VER}" \
740741
NOVNC_PORT="${DEFAULT_NOVNC_PORT}" \
741742
NOVNC="false" \
742743
NOVNC_WAIT_TIMEOUT="5s" \
744+
BROWSERMOBPROXY_START="false" \
743745
SUPERVISOR_HTTP_PORT="${DEFAULT_SUPERVISOR_HTTP_PORT}" \
744746
SUPERVISOR_HTTP_USERNAME="supervisorweb" \
745747
SUPERVISOR_HTTP_PASSWORD="somehttpbasicauthpwd" \
@@ -799,6 +801,7 @@ ENV FIREFOX_VERSION="${FF_VER}" \
799801
VNC_STOP_SIGNAL="TERM" \
800802
NOVNC_STOP_SIGNAL="TERM" \
801803
VIDEO_REC_STOP_SIGNAL="INT" \
804+
BROWSERMOBPROXY_STOP_SIGNAL="TERM" \
802805
DOCKER_SOCK="/var/run/docker.sock" \
803806
TEST_SLEEPS="0.1" \
804807
ZALENIUM="false" \
@@ -848,6 +851,21 @@ ENV SUPERVISOR_PIDFILE="${RUN_DIR}/supervisord.pid" \
848851
VNC_TRYOUT_ERR_LOG="${LOGS_DIR}/vnc-tryouts-stderr" \
849852
VNC_TRYOUT_OUT_LOG="${LOGS_DIR}/vnc-tryouts-stdout"
850853

854+
# Include Lib Browsermob Proxy
855+
USER root
856+
857+
ENV BROWSERMOBPROXY_VER=2.1.4
858+
ENV BROWSERMOBPROXY_FOLDER=browsermob-proxy-${BROWSERMOBPROXY_VER}
859+
860+
RUN wget -nv -O browsermob-proxy.zip \
861+
"https://github.com/lightbody/browsermob-proxy/releases/download/browsermob-proxy-${BROWSERMOBPROXY_VER}/browsermob-proxy-${BROWSERMOBPROXY_VER}-bin.zip" \
862+
&& unzip -x browsermob-proxy.zip \
863+
&& rm browsermob-proxy.zip \
864+
&& mv ${BROWSERMOBPROXY_FOLDER}/lib/browsermob-dist-${BROWSERMOBPROXY_VER}.jar ${LIB_UTILS}/ \
865+
&& rm -r ${BROWSERMOBPROXY_FOLDER}
866+
867+
USER seluser
868+
851869
#===================================
852870
# Fix dirs (again) and final chores
853871
#===================================
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
BASEDIR=`dirname $0`/..
4+
BASEDIR=`(cd "$BASEDIR"; pwd)`
5+
6+
# if user has not explicitly set a command to use to invoke java, use 'java' and assume it is on the path
7+
if [ -z "$JAVACMD" ]
8+
then
9+
JAVACMD="java"
10+
fi
11+
12+
"$JAVACMD" $JAVA_OPTS \
13+
-Dapp.name="browsermob-proxy" \
14+
-Dbasedir="$BASEDIR" \
15+
-jar "$BASEDIR/lib/browsermob-dist-2.1.4.jar" \
16+
--port ${ENV_BROWSERMOBPROXY_PORT:-8080}
17+
"$@"
18+
19+
# if we couldn't find java, print a helpful error message
20+
if [ $? -eq 127 ]
21+
then
22+
echo
23+
echo "Unable to run java using command: $JAVACMD"
24+
echo "Make sure java is installed and on the path, or set JAVACMD to the java executable before running this script."
25+
echo
26+
echo "Example:"
27+
echo
28+
echo " $ JAVACMD=/var/lib/jdk/bin/java ./browsermob-proxy"
29+
echo
30+
fi
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[program:browsermobproxy]
2+
3+
;The relative priority of the program in the start and shutdown ordering.
4+
;Lower priorities indicate programs that start first and shut down last.
5+
priority=95
6+
7+
;User to run-as, note environment expansion outside of `command` is only
8+
;supported in supervisor >= 3.2
9+
;user=seluser
10+
11+
;The command that will be run when this program is started.
12+
;Controlled programs should themselves not be daemons, as supervisord
13+
;assumes it is responsible for daemonizing its subprocesses
14+
directory=/home/seluser
15+
command=%(ENV_BIN_UTILS)s/browsermob-proxy
16+
17+
;If true, this program will start automatically when supervisord is started.
18+
;default=true
19+
autostart=%(ENV_BROWSERMOBPROXY_START)s
20+
21+
;If false, the process will never be autorestarted.
22+
;If true, the process will be unconditionally restarted when it exits,
23+
;without regard to its exit code. default=unexpected
24+
;If unexpected, the process will be restart when the program exits with an
25+
;exit code that is not one of the exit codes associated with this process.
26+
autorestart=unexpected
27+
28+
;Set to 0 to indicate that the program needn’t stay running for any
29+
;particular amount of time.
30+
;So using custom wait-xxxx.sh scripts to perform a more efficient
31+
;active waiting until https://github.com/Supervisor/supervisor/issues/584
32+
startsecs=2
33+
34+
;The number of serial failure attempts that supervisord will allow when
35+
;attempting to start the program before giving up and puting the process
36+
;into an FATAL state.
37+
startretries=3
38+
39+
;Logs
40+
redirect_stderr=false
41+
stdout_logfile=%(ENV_LOGS_DIR)s/browsermobproxy-stdout.log
42+
stderr_logfile=%(ENV_LOGS_DIR)s/browsermobproxy-stderr.log
43+
stdout_logfile_maxbytes=%(ENV_LOGFILE_MAXBYTES)s
44+
stderr_logfile_maxbytes=%(ENV_LOGFILE_MAXBYTES)s
45+
stdout_logfile_backups=%(ENV_LOGFILE_BACKUPS)s
46+
stderr_logfile_backups=%(ENV_LOGFILE_BACKUPS)s
47+
stdout_capture_maxbytes=%(ENV_LOGFILE_MAXBYTES)s
48+
stderr_capture_maxbytes=%(ENV_LOGFILE_MAXBYTES)s
49+
50+
;The signal used to kill the program when a stop is requested. This can be
51+
;any of TERM, HUP, INT, QUIT, KILL, USR1, or USR2. default=TERM
52+
stopsignal=%(ENV_BROWSERMOBPROXY_STOP_SIGNAL)s

0 commit comments

Comments
 (0)