diff --git a/Base/Dockerfile b/Base/Dockerfile index acd7044e9..80b77f446 100644 --- a/Base/Dockerfile +++ b/Base/Dockerfile @@ -159,6 +159,9 @@ ENV SE_BIND_HOST=false \ SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED=true \ SE_OTEL_TRACES_EXPORTER="otlp" \ SE_SUPERVISORD_LOG_LEVEL="info" \ + SE_SUPERVISORD_CHILD_LOG_DIR="/tmp" \ + SE_SUPERVISORD_LOG_FILE="/tmp/supervisord.log" \ + SE_SUPERVISORD_PID_FILE="/tmp/supervisord.pid" \ SE_LOG_LEVEL="INFO" \ SE_HTTP_LOGS=false \ SE_STRUCTURED_LOGS=false \ diff --git a/Base/supervisord.conf b/Base/supervisord.conf index 2f29341b2..fdee7f8f4 100644 --- a/Base/supervisord.conf +++ b/Base/supervisord.conf @@ -1,12 +1,12 @@ ; Documentation of this file format -> http://supervisord.org/configuration.html [supervisord] -childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) -logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) +childlogdir=%(ENV_SE_SUPERVISORD_CHILD_LOG_DIR)s ; ('AUTO' child log dir, default $TEMP) +logfile=%(ENV_SE_SUPERVISORD_LOG_FILE)s ; (main log file;default $CWD/supervisord.log) logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) logfile_backups=10 ; (num of main logfile rotation backups;default 10) loglevel=%(ENV_SE_SUPERVISORD_LOG_LEVEL)s ; (log level;default info; others: debug,warn,trace) http://supervisord.org/logging.html -pidfile=/var/run/supervisor/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +pidfile=%(ENV_SE_SUPERVISORD_PID_FILE)s ; (supervisord pidfile;default supervisord.pid) nodaemon=true ; (start in foreground if true;default false) minfds=1024 ; (min. avail startup file descriptors;default 1024) minprocs=200 ; (min. avail process descriptors;default 200) diff --git a/NodeBase/selenium.conf b/NodeBase/selenium.conf index 41f0fa78d..77bc5f82c 100644 --- a/NodeBase/selenium.conf +++ b/NodeBase/selenium.conf @@ -58,7 +58,7 @@ stderr_capture_maxbytes=50MB [program:selenium-node] priority=15 -command=bash -c "/opt/bin/start-selenium-node.sh; EXIT_CODE=$?; kill -s SIGINT `cat /var/run/supervisor/supervisord.pid`; exit $EXIT_CODE" +command=bash -c "/opt/bin/start-selenium-node.sh; EXIT_CODE=$?; kill -s SIGINT `cat ${SE_SUPERVISORD_PID_FILE}`; exit $EXIT_CODE" stopasgroup = true killasgroup=true autostart=true diff --git a/README.md b/README.md index 965780b96..ec1901ba2 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ Talk to us at https://www.selenium.dev/support/ * [Mask sensitive information in console logs](#mask-sensitive-information-in-console-logs) * [Secure Connection](#secure-connection) * [Browser language and locale](#browser-language-and-locale) + * [Managing processes in container](#managing-processes-in-container) * [Building the images](#building-the-images) * [Build the images with specific versions](#build-the-images-with-specific-versions) * [Upgrade browser version in the images](#upgrade-browser-version-in-the-images) @@ -785,7 +786,7 @@ host-config-keys = ["Binds"] Volumes config in docker compose file -```dockerfile +```yaml services: node-docker: image: selenium/node-docker:latest @@ -1309,6 +1310,17 @@ FIREFOX_VERSION=$(docker run --rm --entrypoint="" selenium/node-firefox:latest f Or, you can mount the container directory `/home/seluser/firefox/distribution/extensions` to host directory to access packs were pre-built in the container for using in your test script. +## Managing processes in container + +[Supervisor](http://supervisord.org/configuration.html) is used to manage processes and logs in the container. Few configuration for `supervisord` can be set via environment variables as below: + +| Environment variables | Default | `supervisord` config | +|------------------------------|------------------------|-------------------------| +| SE_SUPERVISORD_LOG_LEVEL | `info` | supervisord.loglevel | +| SE_SUPERVISORD_CHILD_LOG_DIR | `/tmp` | supervisord.childlogdir | +| SE_SUPERVISORD_LOG_FILE | `/tmp/supervisord.log` | supervisord.logfile | +| SE_SUPERVISORD_PID_FILE | `/tmp/supervisord.pid` | supervisord.pidfile | + ___ ## Building the images diff --git a/Standalone/selenium.conf b/Standalone/selenium.conf index e6975da74..6e807b5e2 100644 --- a/Standalone/selenium.conf +++ b/Standalone/selenium.conf @@ -61,7 +61,7 @@ stderr_capture_maxbytes=50MB [program:selenium-standalone] priority=15 -command=bash -c "/opt/bin/start-selenium-standalone.sh; EXIT_CODE=$?; kill -s SIGINT `cat /var/run/supervisor/supervisord.pid`; exit $EXIT_CODE" +command=bash -c "/opt/bin/start-selenium-standalone.sh; EXIT_CODE=$?; kill -s SIGINT `cat ${SE_SUPERVISORD_PID_FILE}`; exit $EXIT_CODE" stopasgroup = true autostart=true autorestart=false diff --git a/Video/Dockerfile b/Video/Dockerfile index 3b0806149..b6bcc4db9 100755 --- a/Video/Dockerfile +++ b/Video/Dockerfile @@ -110,6 +110,9 @@ ENV DISPLAY_NUM=99 \ VIDEO_FOLDER=${VIDEO_FOLDER} \ SE_VIDEO_FILE_NAME=video.mp4 \ SE_VIDEO_FILE_NAME_TRIM_REGEX="[:alnum:]-_" \ - SE_SUPERVISORD_LOG_LEVEL="info" + SE_SUPERVISORD_LOG_LEVEL="info" \ + SE_SUPERVISORD_CHILD_LOG_DIR="/tmp" \ + SE_SUPERVISORD_LOG_FILE="/tmp/supervisord.log" \ + SE_SUPERVISORD_PID_FILE="/tmp/supervisord.pid" EXPOSE 9000 diff --git a/Video/supervisord.conf b/Video/supervisord.conf index faa5ee25c..fa9c4596a 100755 --- a/Video/supervisord.conf +++ b/Video/supervisord.conf @@ -1,12 +1,12 @@ ; Documentation of this file format -> http://supervisord.org/configuration.html [supervisord] -childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) -logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) +childlogdir=%(ENV_SE_SUPERVISORD_CHILD_LOG_DIR)s ; ('AUTO' child log dir, default $TEMP) +logfile=%(ENV_SE_SUPERVISORD_LOG_FILE)s ; (main log file;default $CWD/supervisord.log) logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) logfile_backups=10 ; (num of main logfile rotation backups;default 10) loglevel=%(ENV_SE_SUPERVISORD_LOG_LEVEL)s ; (log level;default info; others: debug,warn,trace) http://supervisord.org/logging.html -pidfile=/var/run/supervisor/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +pidfile=%(ENV_SE_SUPERVISORD_PID_FILE)s ; (supervisord pidfile;default supervisord.pid) nodaemon=true ; (start in foreground if true;default false) minfds=1024 ; (min. avail startup file descriptors;default 1024) minprocs=200 ; (min. avail process descriptors;default 200) diff --git a/Video/video.sh b/Video/video.sh index db4e2e3ca..224610473 100755 --- a/Video/video.sh +++ b/Video/video.sh @@ -172,7 +172,7 @@ function graceful_exit() { stop_if_recording_inprogress send_exit_signal_to_uploader wait_util_uploader_shutdown - kill -SIGTERM "$(cat /var/run/supervisor/supervisord.pid)" 2>/dev/null + kill -SIGTERM "$(cat ${SE_SUPERVISORD_PID_FILE})" 2>/dev/null echo "$(date +%FT%T%Z) [${process_name}] - Ready to shutdown the recorder" exit 0 } diff --git a/charts/selenium-grid/CONFIGURATION.md b/charts/selenium-grid/CONFIGURATION.md index 37f9bb123..a03c8c683 100644 --- a/charts/selenium-grid/CONFIGURATION.md +++ b/charts/selenium-grid/CONFIGURATION.md @@ -21,7 +21,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | https://jaegertracing.github.io/helm-charts | jaeger | 3.2.0 | | https://kedacore.github.io/charts | keda | 2.15.1 | | https://kubernetes.github.io/ingress-nginx | ingress-nginx | 4.11.2 | -| https://prometheus-community.github.io/helm-charts | kube-prometheus-stack | 62.3.1 | +| https://prometheus-community.github.io/helm-charts | kube-prometheus-stack | 62.5.0 | ## Values diff --git a/tests/test.py b/tests/test.py index b3cfce086..4308161f5 100644 --- a/tests/test.py +++ b/tests/test.py @@ -46,6 +46,7 @@ def signal_handler(signum, frame): no_proxy = os.environ.get('no_proxy', '') SKIP_BUILD = os.environ.get('SKIP_BUILD', False) PLATFORMS = os.environ.get('PLATFORMS', 'linux/amd64') +FILESYSTEM_READ_ONLY = os.environ.get('FILESYSTEM_READ_ONLY', 'false').lower() == 'true' BASE_VERSION = os.environ.get('BASE_VERSION') BASE_RELEASE = os.environ.get('BASE_RELEASE') @@ -200,6 +201,8 @@ def launch_container(container, **kwargs): detach=True, environment=environment, shm_size="2G", + read_only=FILESYSTEM_READ_ONLY, + tmpfs={'/tmp': 'rw'}, **kwargs).short_id logger.info("%s up and running" % container) return container_id