Skip to content

Instantly share code, notes, and snippets.

@PramodDutta
Created June 22, 2018 10:13
Show Gist options
  • Save PramodDutta/4fbdbeb058c709379440c4a20e169ffe to your computer and use it in GitHub Desktop.
Save PramodDutta/4fbdbeb058c709379440c4a20e169ffe to your computer and use it in GitHub Desktop.
version: "3"
networks:
main:
driver: overlay
services:
hub:
image: selenium/hub:3.2.0
ports:
- "4444:4444"
networks:
- main
deploy:
mode: replicated
replicas: 1
labels:
selenium.grid.type: "hub"
selenium.grid.hub: "true"
restart_policy:
condition: none
placement:
constraints: [node.role == manager]
chrome:
image: selenium/node-chrome-debug
entrypoint: >
bash -c '
export IP_ADDRESS=$$(ip addr show eth0 | grep "inet\b" | awk '"'"'{print $$2}'"'"' | awk -F/ '"'"'{print $$1}'"'"' | head -1) &&
SE_OPTS="-host $$IP_ADDRESS" /opt/bin/entry_point.sh'
volumes:
- /dev/urandom:/dev/random
- /dev/shm:/dev/shm
environment:
HUB_PORT_4444_TCP_ADDR: hub
HUB_PORT_4444_TCP_PORT: 4444
NODE_MAX_SESSION: 1
networks:
- main
deploy:
mode: replicated
replicas: 2
labels:
selenium.grid.type: "node"
selenium.grid.node: "true"
selenium.grid.node.type: "chrome"
restart_policy:
condition: none
placement:
constraints: [node.role == manager]
firefox:
image: selenium/node-firefox
entrypoint: >
bash -c '
export IP_ADDRESS=$$HOSTNAME &&
SE_OPTS="-host $$IP_ADDRESS" /opt/bin/entry_point.sh'
volumes:
- /dev/shm:/dev/shm
- /dev/urandom:/dev/random
environment:
HUB_PORT_4444_TCP_ADDR: hub
HUB_PORT_4444_TCP_PORT: 4444
NODE_MAX_SESSION: 1
networks:
- main
depends_on:
- hub
deploy:
mode: replicated
replicas: 5
labels:
selenium.grid.type: "node"
selenium.grid.node: "true"
selenium.grid.node.type: "firefox"
restart_policy:
condition: none
placement:
constraints: [node.role == manager]
firefoxBuddy:
image: selenium/node-firefox
entrypoint: >
bash -c '
export IP_ADDRESS=$$HOSTNAME &&
SE_OPTS="-host $$IP_ADDRESS" /opt/bin/entry_point.sh'
volumes:
- /dev/shm:/dev/shm
- /dev/urandom:/dev/random
environment:
HUB_PORT_4444_TCP_ADDR: hub
HUB_PORT_4444_TCP_PORT: 4444
NODE_MAX_SESSION: 1
networks:
- main
depends_on:
- hub
deploy:
mode: replicated
replicas: 4
labels:
selenium.grid.type: "node"
selenium.grid.node: "true"
selenium.grid.node.type: "wefirefox"
restart_policy:
condition: none
placement:
constraints: [node.role == worker]
@amitrangari
Copy link

ip addr show eth0 | grep "inet\b" | awk '"'"'{print $$2}'"'"' | awk -F/ '"'"'{print $$1}'"'"' | head -1
the above command doesn't result in IP

@Rahul-012
Copy link

why you have created chrome a Manger we can also create as worker too, what is firefox buddy ?

  1. You are creating 2 replicas of chrome(container) and 4 replicas(container) of firefox instance am i right ??

  2. What does this attribute do NODE_MAX_SESSION: 1 what i understand this will create only one chrome instance i am right ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment