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

Commit c782d08

Browse files
author
Leo Gallucci
committed
Breaking changes! Supervisor final fixes and ready to release v2.46.0-sup
1 parent 0524337 commit c782d08

File tree

16 files changed

+71
-56
lines changed

16 files changed

+71
-56
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Note sha256 digests are generated after pushing the image to the registry theref
44

55
Note image ids also change after scm-source.json has being updated which triggers a cyclic problem so value TBD will be set here and updated in the [release][] page by navigating into any release tag.
66

7-
## v2.46.0-sup (2015-07-12)
7+
## v2.46.0-sup (2015-07-13)
88
+ Switched to supervidord for process management, closes #24 (Leo Gallucci)
99
+ Extracted guacamole (with tomcat) into elgalu/guaca-docker.
1010
+ Refactored code and directory structure.

Dockerfile

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ RUN apt-get update -qqy \
6464
bc \
6565
grc \
6666
moreutils \
67-
# TODO: do we need this X11-unix things?
68-
&& mkdir -p /tmp/.X11-unix /tmp/.ICE-unix \
69-
&& chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix \
70-
&& mkdir -p /var/log/sele \
71-
&& mkdir -p /var/run/sele \
7267
&& rm -rf /var/lib/apt/lists/*
7368

7469
#==============================
@@ -288,10 +283,6 @@ ENV NORMAL_USER_HOME /home/${NORMAL_USER}
288283
# TODO: Upgrade to supervisor stable 4.0 as soon as is released
289284
RUN pip install --upgrade \
290285
https://github.com/Supervisor/supervisor/zipball/b3ad59703b554f \
291-
&& mkdir -p /var/log/sele/supervisor \
292-
&& mkdir -p /etc/supervisor/conf.d \
293-
&& mkdir -p /var/run/sele \
294-
&& touch /var/run/sele/supervisord.pid \
295286
&& rm -rf /var/lib/apt/lists/*
296287

297288
#=====================
@@ -395,6 +386,8 @@ RUN apt-get update -qqy \
395386
xserver-xorg-video-dummy \
396387
&& rm -rf /var/lib/apt/lists/*
397388

389+
ENV RUN_DIR /var/run/sele
390+
398391
#======================
399392
# OpenSSH server (sshd)
400393
#======================
@@ -403,9 +396,7 @@ RUN apt-get update -qqy \
403396
RUN apt-get update -qqy \
404397
&& apt-get -qqy install \
405398
openssh-server \
406-
&& mkdir -p /var/run/sshd \
407-
&& chmod 744 /var/run/sshd \
408-
&& echo "PidFile /tmp/run_sshd.pid" >> /etc/ssh/sshd_config \
399+
&& echo "PidFile ${RUN_DIR}/sshd.pid" >> /etc/ssh/sshd_config \
409400
&& echo "X11Forwarding yes" >> /etc/ssh/sshd_config \
410401
&& echo "GatewayPorts yes" >> /etc/ssh/sshd_config \
411402
&& rm -rf /var/lib/apt/lists/*
@@ -513,14 +504,6 @@ ADD xterm/etc/supervisor/conf.d/* /etc/supervisor/conf.d/
513504
USER ${NORMAL_USER}
514505
ENV USER ${NORMAL_USER}
515506
ENV HOME ${NORMAL_USER_HOME}
516-
RUN mkdir -p ~/.ssh \
517-
&& touch ~/.ssh/authorized_keys \
518-
&& chmod 700 ~/.ssh \
519-
&& chmod 600 ~/.ssh/authorized_keys \
520-
&& sudo chown -R ${NORMAL_USER}:${NORMAL_GROUP} /var/log/sele \
521-
&& sudo chown -R ${NORMAL_USER}:${NORMAL_GROUP} /var/run/sele \
522-
&& sudo chown -R ${NORMAL_USER}:${NORMAL_GROUP} /etc/supervisor \
523-
&& mkdir -p ${HOME}/.vnc
524507
ENV VNC_STORE_PWD_FILE ${HOME}/.vnc/passwd
525508

526509
#========================================================================
@@ -549,8 +532,6 @@ ENV NOVNC_PORT 26080
549532
# You can set the VNC password or leave null so a random password is generated:
550533
# ENV VNC_PASSWORD topsecret
551534
ENV SSHD_PORT 22222
552-
# Logs are now managed by supervisord.conf, see
553-
# /var/log/sele/supervisor/*.log
554535
# Supervisor (process management) http server
555536
ENV SUPERVISOR_HTTP_PORT 29001
556537
ENV SUPERVISOR_HTTP_USERNAME supervisorweb
@@ -560,6 +541,9 @@ ENV SUPERVISOR_HTTP_PASSWORD somehttpbasicauthpwd
560541
ENV LOGLEVEL info
561542
ENV LOGFILE_MAXBYTES 10MB
562543
ENV LOGFILE_BACKUPS 5
544+
# Logs are now managed by supervisord.conf, see
545+
# ${LOGS_DIR}/*.log
546+
ENV LOGS_DIR /var/log/sele
563547
#===============================
564548
# Run docker from inside docker
565549
# Usage: docker run -v /var/run/docker.sock:/var/run/docker.sock
@@ -569,7 +553,7 @@ ENV DOCKER_SOCK "/var/run/docker.sock"
569553
#================================
570554
# Expose Container's Directories
571555
#================================
572-
VOLUME /var/log/sele
556+
# VOLUME ${LOGS_DIR}
573557

574558
# Only expose ssh port given the other services are not secured
575559
# forcing the user to open ssh tunnels or use docker run -p ports...

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ If your setup is correct, privileged mode and sudo should not be necessary:
2727
docker run --rm --name=ch -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 \
2828
-p=0.0.0.0:2222:22222 -p=0.0.0.0:6080:26080 \
2929
-e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1080 \
30-
-e VNC_PASSWORD=hola -v /var/log/sele \
30+
-e VNC_PASSWORD=hola \
3131
-e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" \
3232
elgalu/selenium:v2.46.0-sup
3333

34-
Make sure `docker run` finishes with **start.sh all done and ready for testing** else you won't be able to start your tests.
34+
Make sure `docker run` finishes with **selenium all done and ready for testing** else you won't be able to start your tests.
3535
Selenium should be up and running at http://localhost:4470/wd/hub open the web page to confirm is running.
3636

3737
You can also ssh into the machine as long as `SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)"` is correct.
@@ -140,8 +140,8 @@ CONTAINER=$(docker run -d -p=0.0.0.0:${ANYPORT}:22222 -e SCREEN_HEIGHT=1110 \
140140
elgalu/selenium:v2.46.0-sup
141141
142142
# -- Common: Wait for the container to start
143-
while ! docker logs ${CONTAINER} 2>&1 | grep \
144-
"start.sh all done" >/dev/null; do sleep 0.2; done
143+
while ! docker exec ch grep 'all done and ready for testing' \
144+
/var/log/sele/xterm-stdout.log > /dev/null 2>&1; do sleep 0.2; done
145145
json_filter='{{(index (index .NetworkSettings.Ports "22222/tcp") 0).HostPort}}'
146146
SSHD_PORT=$(docker inspect -f='${json_filter}' $CONTAINER)
147147
echo $SSHD_PORT #=> e.g. SSHD_PORT=32769

READMELeo.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
## Build
22

33
time (docker build -t="elgalu/selenium:v2.46.0-sup" . ;echo $?;beep)
4-
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" -e VNC_PASSWORD=hola elgalu/selenium:v2.46.0-sup
5-
docker run --rm --name=ch --net=host -p=4470:24444 -p=5920:25900 -p=2222:22222 -p=9001:29001 -p=6080:26080 -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" -e VNC_PASSWORD=hola elgalu/selenium:v2.46.0-sup
4+
docker run --rm -ti --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -p=6080:26080 -p=29001:29001 -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" -e VNC_PASSWORD=hola -v /var/log/sele elgalu/selenium:v2.46.0-sup
5+
6+
See logs
7+
8+
docker exec -ti ch bash -c "ls -lah /var/log/sele/"
69

710
Testing in ssh [email protected]
811

912
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -e SSH_AUTH_KEYS="$(cat ~/.ssh/authorized_keys)" -e VNC_PASSWORD=Hola3 os-registry.stups.zalan.do/tip/selenium:v2.46.0-sup
1013

14+
Wait for docker-selenium to finish starting
15+
16+
while ! docker exec ch grep 'all done and ready for testing' /var/log/sele/xterm-stdout.log > /dev/null 2>&1; do sleep 0.2; done
17+
1118
## Transfer used browser source artifacts to keep them in the cloud
1219

1320
SSHCMD="-o StrictHostKeyChecking=no -q -P 2222 application@localhost"

bin/entry.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ export DOCKER_HOST_IP=$(netstat -nr | grep '^0\.0\.0\.0' | awk '{print $2}')
1313
export CONTAINER_IP=$(ip addr show dev eth0 | grep "inet " | awk '{print $2}' | cut -d '/' -f 1)
1414
#end.
1515

16-
#--------------------
17-
# Improve etc/hosts
16+
#--------------------------------
17+
# Improve etc/hosts and fix dirs
1818
improve_etc_hosts.sh
19+
fix_dirs.sh
1920

2021
#-------------------------
2122
# Docker alongside docker
@@ -25,10 +26,10 @@ docker_alongside_docker.sh
2526
# Fix running user
2627
#------------------
2728
RUN_PREFIX="sudo -E HOME=/home/$NORMAL_USER -u $NORMAL_USER"
28-
# RUN_SUPERVISOR="supervisord -c /etc/supervisor/supervisord.conf --pidfile /var/run/sele/supervisord.pid"
29+
# RUN_SUPERVISOR="supervisord -c /etc/supervisor/supervisord.conf --pidfile ${RUN_DIR}/supervisord.pid"
2930
RUN_SUPERVISOR="supervisord -c /etc/supervisor/supervisord.conf"
3031
RUN_START="${RUN_PREFIX} $BIN_UTILS/start.sh"
31-
# RUN_TAIL="grc tail -f /var/log/sele/supervisor/supervisord.log --pid=$(cat /var/run/sele/supervisord.pid) --sleep-interval=0.1"
32+
# RUN_TAIL="grc tail -f ${LOGS_DIR}/supervisord.log --pid=$(cat ${RUN_DIR}/supervisord.pid) --sleep-interval=0.1"
3233
WHOAMI=$(whoami)
3334
WHOAMI_EXIT_CODE=$?
3435
echo "-- INFO: Container USER var is: '$USER', \$(whoami) returns '$WHOAMI', UID is '$UID'"

novnc/etc/supervisor/conf.d/novnc.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ startretries=0
3838

3939
;Logs
4040
redirect_stderr=false
41-
stdout_logfile=/var/log/sele/supervisor/novnc-stdout.log
42-
stderr_logfile=/var/log/sele/supervisor/novnc-stderr.log
41+
stdout_logfile=%(ENV_LOGS_DIR)s/novnc-stdout.log
42+
stderr_logfile=%(ENV_LOGS_DIR)s/novnc-stderr.log
4343
stdout_logfile_maxbytes=%(ENV_LOGFILE_MAXBYTES)s
4444
stderr_logfile_maxbytes=%(ENV_LOGFILE_MAXBYTES)s
4545
stdout_logfile_backups=%(ENV_LOGFILE_BACKUPS)s

scm-source.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"url": "https://github.com/elgalu/docker-selenium",
3-
"revision": "822ae681465090192e4a5f98a5179ffd5b2d08bb",
3+
"revision": "05243375de86d6a0cdafef1551f8245e78b3a25b",
44
"author": "lgallucci",
55
"status": ""
66
}

selenium/etc/supervisor/conf.d/selenium.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ startretries=0
3838

3939
;Logs
4040
redirect_stderr=false
41-
stdout_logfile=/var/log/sele/supervisor/selenium-stdout.log
42-
stderr_logfile=/var/log/sele/supervisor/selenium-stderr.log
41+
stdout_logfile=%(ENV_LOGS_DIR)s/selenium-stdout.log
42+
stderr_logfile=%(ENV_LOGS_DIR)s/selenium-stderr.log
4343
stdout_logfile_maxbytes=%(ENV_LOGFILE_MAXBYTES)s
4444
stderr_logfile_maxbytes=%(ENV_LOGFILE_MAXBYTES)s
4545
stdout_logfile_backups=%(ENV_LOGFILE_BACKUPS)s

sshd/etc/supervisor/conf.d/sshd.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ startretries=0
3838

3939
;Logs
4040
redirect_stderr=false
41-
stdout_logfile=/var/log/sele/supervisor/sshd-stdout.log
42-
stderr_logfile=/var/log/sele/supervisor/sshd-stderr.log
41+
stdout_logfile=%(ENV_LOGS_DIR)s/sshd-stdout.log
42+
stderr_logfile=%(ENV_LOGS_DIR)s/sshd-stderr.log
4343
stdout_logfile_maxbytes=%(ENV_LOGFILE_MAXBYTES)s
4444
stderr_logfile_maxbytes=%(ENV_LOGFILE_MAXBYTES)s
4545
stdout_logfile_backups=%(ENV_LOGFILE_BACKUPS)s

supervisor/etc/supervisor/supervisord.conf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
nodaemon=true
55

66
;main log file;default $CWD/supervisord.log
7-
logfile=/var/log/sele/supervisor/supervisord.log
7+
logfile=%(ENV_LOGS_DIR)s/supervisord.log
88

99
;max main logfile bytes b4 rotation;default 50MB
1010
logfile_maxbytes=%(ENV_LOGFILE_MAXBYTES)s
@@ -16,14 +16,14 @@ logfile_backups=%(ENV_LOGFILE_BACKUPS)s
1616
;debug will log all monitored process outputs
1717
;an alternative to debug would be to tail all logs
1818
;and pipe `ts` to inject the timestamp:
19-
; tail -f /var/log/sele/supervisor/*.log --pid.... | ts
19+
; tail -f %(ENV_LOGS_DIR)s/*.log --pid.... | ts
2020
loglevel=%(ENV_LOGLEVEL)s
2121

2222
;supervisord pidfile;default supervisord.pid
23-
pidfile=/var/run/sele/supervisord.pid
23+
pidfile=%(ENV_RUN_DIR)s/supervisord.pid
2424

2525
;'AUTO' child log dir, default $TEMP
26-
childlogdir=/var/log/sele/supervisor
26+
childlogdir=%(ENV_LOGS_DIR)s
2727

2828
;The number of seconds to wait for the OS to return a SIGCHILD to
2929
;supervisord after the program has been sent a stopsignal.
@@ -33,7 +33,7 @@ childlogdir=/var/log/sele/supervisor
3333
stopwaitsecs=1
3434

3535
[unix_http_server]
36-
file=/var/run/sele/supervisor.sock
36+
file=%(ENV_RUN_DIR)s/supervisor.sock
3737
username=%(ENV_SUPERVISOR_HTTP_USERNAME)s
3838
password=%(ENV_SUPERVISOR_HTTP_PASSWORD)s
3939
;sockef file mode (default 0700)
@@ -47,7 +47,7 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
4747

4848
[supervisorctl]
4949
; use a unix:// URL for a unix socket
50-
serverurl=unix:///var/run/sele/supervisor.sock
50+
serverurl=unix://%(ENV_RUN_DIR)s/supervisor.sock
5151
username=%(ENV_SUPERVISOR_HTTP_USERNAME)s
5252
password=%(ENV_SUPERVISOR_HTTP_PASSWORD)s
5353

0 commit comments

Comments
 (0)