Last active
May 3, 2019 09:10
-
-
Save pstadler/c039db8681468cfe380f1cb7f8154e83 to your computer and use it in GitHub Desktop.
./selenoid.sh start|stop|restart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"chrome": { | |
"default": "65.0", | |
"versions": { | |
"65.0": { | |
"image": "selenoid/vnc:chrome_65.0", | |
"port": "4444" | |
} | |
} | |
}, | |
"firefox": { | |
"default": "59.0", | |
"versions": { | |
"59.0": { | |
"image": "selenoid/vnc:firefox_59.0", | |
"port": "4444", | |
"path": "/wd/hub" | |
} | |
} | |
}, | |
"phantomjs": { | |
"default": "2.1.1", | |
"versions": { | |
"2.1.1": { | |
"image": "selenoid/phantomjs:2.1.1", | |
"port": "4444", | |
"path": "/wd/hub" | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DIRNAME=$(cd "$(dirname "$0")"; pwd -P) | |
DOCKER_ARGS="-e DOCKER_API_VERSION=1.35" | |
start() { | |
if ! $(type jq > /dev/null 2>&1); then | |
echo "'jq' is not in the PATH. (See: https://stedolan.github.io/jq/)" | |
exit 1 | |
fi | |
# Driver | |
docker run $DOCKER_ARGS -d --name selenoid -p 4444:4444 \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
-v $DIRNAME/browsers.json:/etc/selenoid/browsers.json:ro \ | |
aerokube/selenoid:latest-release -timeout 60s -conf /etc/selenoid/browsers.json | |
GW_ADDR=$(docker inspect selenoid -f {{.NetworkSettings.Gateway}}) | |
# UI | |
docker run $DOCKER_ARGS -d --name selenoid-ui -p 8080:8080 \ | |
--link selenoid \ | |
aerokube/selenoid-ui --selenoid-uri=http://${GW_ADDR}:4444 | |
# Browsers | |
cat $DIRNAME/browsers.json | jq -r '..|.image?|strings' | xargs -I{} docker pull {} | |
echo Selenoid UI is running on http://localhost:8080 | |
} | |
stop() { | |
docker stop selenoid selenoid-ui | |
docker rm selenoid selenoid-ui | |
} | |
case "$1" in | |
start) start ;; | |
stop) stop ;; | |
restart) stop; start ;; | |
*) echo "usage: $0 start|stop|restart" >&2 | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment