Skip to content

Instantly share code, notes, and snippets.

@AlexeySetevoi
Last active April 10, 2017 08:00
Show Gist options
  • Save AlexeySetevoi/93376d6cfbe8a2c96f6b52ac167c11ac to your computer and use it in GitHub Desktop.
Save AlexeySetevoi/93376d6cfbe8a2c96f6b52ac167c11ac to your computer and use it in GitHub Desktop.
Docker compose selenium hub + nodes
version: '2'
services:
hub:
image: selenium/hub
ports:
- 4444:4444
networks:
- front-tier
- back-tier
node_firefox:
image: selenium/node-firefox
environment:
HUB_PORT_4444_TCP_ADDR: hub
HUB_PORT_4444_TCP_PORT: 4444
links:
- hub
networks:
- back-tier
node_chrome:
image: selenium/node-chrome
environment:
HUB_PORT_4444_TCP_ADDR: hub
HUB_PORT_4444_TCP_PORT: 4444
links:
- hub
volumes:
- /dev/shm:/dev/shm
networks:
- back-tier
networks:
front-tier:
driver: bridge
back-tier:
driver: bridge
#!/bin/bash
### BEGIN INIT INFO
# Provides: selenium
# Required-Start: $local_fs $remote_fs $syslog
# Required-Stop: $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Docker selenium pack
# Description: selenium start|stop|restart|status|logs
### END INIT INFO
name=`basename $0`
pid_file="/var/run/$name.pid"
stdout_log="/var/log/$name.log"
stderr_log="/var/log/$name.err"
workdir="/usr/local/src/selenium-docker"
ccount=20
case "$1" in
start)
cd $workdir
docker-compose up -d
docker-compose scale node_firefox=$ccount
docker-compose scale node_chrome=$ccount
;;
stop)
cd $workdir
docker-compose down
;;
status)
cd $workdir
docker-compose ps
;;
logs)
cd $workdir
docker-compose logs
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|status|logs}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment