8000 Add Swarm documentation by JeromeGillard · Pull Request #405 · elgalu/docker-selenium · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Add Swarm documentation #405

Merged
merged 1 commit into from
Nov 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,42 @@ You can now run your tests by using the `--seleniumUrl="http://localhost:4444/wd
However if your web application under test is running in localhost, e.g. `--appHost=localhost` or is publicly not accessible
you should instead either dockerize your application as shown in the example [adwords_mock](https://github.com/elgalu/google_adwords_mock) within the [docker-compose-tests.yml][]. Its there shown as another [service](https://docs.docker.com/compose/compose-file/#/service-configuration-reference). Another option (if you don't want to dockerize your app yet) is to somehow replace `--appHost=localhost` with `--appHost=d.host.loc.dev` in the config file of your testing framework. The string `d.host.loc.dev` is a place holder inside the docker container that points to the IP of your localhost.

## Docker Swarm mode
You might get the following error if you try to run a `SELENIUM_NODE` as part of a Swarm stack:
```
$ docker stack deploy selenium
Updating service selenium_selenium-chrome (id: joru9fw8xej2imcrvgblcrc85)
failed to create service selenium_selenium-chrome: Error response from daemon: rpc error: code = InvalidArgument desc = expanding env failed: expanding env "SELENIUM_NODE_HOST={{CONTAINER_IP}}": template: expansion:1: function "CONTAINER_IP" not defined
```
Thanks to https://github.com/elgalu/docker-selenium/issues/236 you just have to update your variable `SELENIUM_NODE_HOST` to `{{__CONTAINER_IP__}}`.
Example in a `docker-compose file`:
```
selenium-firefox:
image: elgalu/selenium
depends_on:
- hub
volumes:
- /dev/shm:/dev/shm
deploy:
replicas: 3
environment:
- DEBUG=true
- PICK_ALL_RANDOM_PORTS=true
- SELENIUM_HUB_HOST=hub
- SELENIUM_HUB_PORT=4444
- SELENIUM_NODE_HOST={{__CONTAINER_IP__}}
- SCREEN_WIDTH=1300
- SCREEN_HEIGHT=999
- VIDEO=false
- AUDIO=false
- GRID=false
- CHROME=false
- FIREFOX=true
- MAX_INSTANCES=1
- MAX_SESSIONS=1
```


### Cleanup
Once your tests are done you can clean up:

Expand Down
0