Moved from a custom selenium UC standalone to selenium hub with a custom UC node
All checks were successful
Test, build and push image to registry / phpunit-tests (push) Successful in 1m54s
Test, build and push image to registry / build-image (push) Successful in 3m0s

This commit is contained in:
2025-12-16 12:47:24 +01:00
parent 062f428fbc
commit 2a7330bd08
12 changed files with 142 additions and 37 deletions

View File

@@ -10,4 +10,15 @@ Could not start a new session. Response code 500. Message: session not created:
Go into the `/home/seluser` director in the container and run `rm -rf ~/.config/google-chrome/Singleton*`
If it doesn't work, the log can be found in the set profile folder in the file `chrome_debug.log`
One-liner : `rm -rf /home/seluser/.config/google-chrome/Singleton* && exit`
If it doesn't work, the log can be found in the seluser chrome profile folder in the file `chrome_debug.log`
```txt
Could not start a new session. Response code 500. Message: session not created: Chrome instance exited. Examine ChromeDriver verbose log to determine the cause.
```
The log can be found in the seluser chrome profile folder in the file `chrome_debug.log`.
If the log file only says that the chrome profile folder seems to be in use by another chrome application, there is probably a problem with a file in the chrome profile folder like a version change.
The best thing to do is to delete the folder.

Binary file not shown.

View File

@@ -9,17 +9,17 @@ VERSION="latest"
# From undetected chromedriver docker
#sudo docker run --rm -it -p 3389:3389 -v ./undetectedChromedriver:/root/.local/share/undetected_chromedriver/ ultrafunk/undetected-chromedriver:latest
sudo docker pull selenium/standalone-chrome:$VERSION
sudo docker pull selenium/node-chrome:$VERSION
# With undetected chromedriver patcher
# Run the selenium/standalone-chrome:latest with a specific container name in the background
#sudo docker run -d --name standalone-chrome -v /home/ninluc/Documents/codage/DatBrowser/undetectedChromedriver/chrome/:/opt/google/chrome/ selenium/standalone-chrome:$VERSION
sudo docker run -d --name standalone-chrome selenium/standalone-chrome:$VERSION
sudo docker run -d --name node-chrome selenium/node-chrome:$VERSION
sleep 7
# Copy the chromedriver binary from the container to the host
sudo docker cp -L standalone-chrome:/bin/chromedriver ./chromedriver
sudo docker cp -L node-chrome:/bin/chromedriver ./chromedriver
sudo chmod 777 ./chromedriver
@@ -28,5 +28,5 @@ source venv/bin/activate
python3 ./patchChromedriver.py
# Stop the container
sudo docker stop standalone-chrome
sudo docker rm standalone-chrome
sudo docker stop node-chrome
sudo docker rm node-chrome

View File

@@ -1,4 +1,4 @@
#!/bin/bash
sudo docker build -f seleniumChromedriverDockerfile -t git.matthiasg.dev/ninluc/selenium/standalone-uc:latest .
sudo docker push git.matthiasg.dev/ninluc/selenium/standalone-uc:latest
docker build -f seleniumChromedriverDockerfile -t git.matthiasg.dev/ninluc/selenium/node-uc:latest .
docker push git.matthiasg.dev/ninluc/selenium/node-uc:latest

View File

@@ -1,6 +1,6 @@
# FROM selenium/standalone-chrome:108.0 AS final
# FROM selenium/standalone-chrome:133.0-20250606 AS final
FROM selenium/standalone-chrome:latest AS final
FROM selenium/node-chrome:latest AS final
COPY ./chromedriver /bin/chromedriver
RUN mkdir -p /home/seluser/profile/nigga
@@ -9,6 +9,6 @@ ENV TZ=Europe/Brussels
# 30 minutes session timeout
ENV SE_OPTS="--session-timeout 1800"
HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD curl -s http://localhost:4444/wd/hub/status | jq -e '.value.ready == true' || exit 1
# HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD curl -s http://localhost:4444/wd/hub/status | jq -e '.value.ready == true' || exit 1

View File

@@ -1,5 +1,22 @@
services:
undetected-chromedriver:
# undetected-chromedriver:
# # image: git.matthiasg.dev/ninluc/selenium/standalone-uc:latest
# image: selenium/standalone-chrome:latest
# # build:
# # context: ./
# # dockerfile: seleniumChromedriverDockerfile
# volumes:
# - /tmp:/tmp
# - chromeProfile:/home/seluser/profile/
# shm_size: 2gb
# tty: true
# ports:
# - "4444:4444"
# - "7900:7900"
undetected-chromedriver-node:
# image: git.matthiasg.dev/ninluc/selenium/standalone-uc:latest
# image: selenium/node-chrome:latest
build:
context: ./
dockerfile: seleniumChromedriverDockerfile
@@ -8,9 +25,27 @@ services:
- chromeProfile:/home/seluser/profile/
shm_size: 2gb
tty: true
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
ports:
- "4444:4444"
- "7900:7900"
networks:
- selenium-grid
selenium-hub:
image: selenium/hub:latest
tty: true
ports:
- "4442-4444:4442-4444"
networks:
- selenium-grid
networks:
selenium-grid:
driver: bridge
volumes:
chromeProfile: