1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-21 01:27:01 +02:00

add ggr-ui

This commit is contained in:
kev 2019-11-11 23:42:43 +08:00
parent 81840a6ab9
commit c0ebf05dc5
14 changed files with 207 additions and 2 deletions

View File

@ -74,6 +74,7 @@ A collection of delicious docker recipes.
## Cluster
- [x] ggr
- [x] ggr-ui
- [x] jsonwire-grid
## Monitor

View File

@ -21,6 +21,16 @@ services:
restart_policy:
condition: on-failure
cleanup:
image: docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: docker system prune --all --force
deploy:
mode: global
restart_policy:
delay: 24h
networks:
default:
ipam:

17
ggr-ui/Dockerfile Normal file
View File

@ -0,0 +1,17 @@
#
# Dockerfile for ggr-ui
#
FROM golang:alpine
RUN apk add --no-cache git
RUN go get -v github.com/kelseyhightower/confd
FROM aerokube/ggr-ui:latest-release
RUN apk add --no-cache curl libxml2-utils supervisor
COPY --from=0 /go/bin/confd /usr/bin/
COPY data/confd /etc/confd
COPY data/supervisor.d /etc/supervisor.d
COPY data/grid-router /etc/grid-router
EXPOSE 8888
ENTRYPOINT ["supervisord", "-n", "-c", "/etc/supervisord.conf"]
HEALTHCHECK CMD ["curl", "-f", "http://127.0.0.1:8888/ping"]

23
ggr-ui/README.md Normal file
View File

@ -0,0 +1,23 @@
ggr-ui
======
[Ggr UI][1] is a standalone daemon that automatically collects `/status` information
from multiple Selenoid instances and returns it as a single `/status` API. When
this daemon is running you can use Selenoid UI to see the state of the entire
cluster.
```bash
$ docker-compose up -d
$ docker run --rm -it alpine sh
>>> apk update
>>> apk add bind-tools
>>> dig tasks.selenoid
```
```bash
$ curl http://127.0.0.1:8888/ping
$ curl http://127.0.0.1:8888/status
```
[1]: https://github.com/aerokube/ggr-ui

View File

@ -0,0 +1,6 @@
[template]
src = "guest.xml.tmpl"
dest = "/etc/grid-router/quota/guest.xml"
keys = ["/"]
check_cmd = "xmllint --noout /etc/grid-router/quota/guest.xml"
reload_cmd = "supervisorctl signal HUP ggr-ui"

View File

@ -0,0 +1,11 @@
<qa:browsers xmlns:qa="urn:config.gridrouter.qatools.ru">
<browser name="{{getenv "BROWSER_NAME" "chrome"}}" defaultVersion="{{getenv "BROWSER_VERSION" "78.0"}}">
<version number="{{getenv "BROWSER_VERSION" "78.0"}}">
<region name="{{getenv "BROWSER_REGION" "1"}}">
{{range lookupIP (getenv "BROWSER_HOSTS" "tasks.selenoid")}}
<host name="{{.}}" port="{{getenv "BROWSER_PORT" "5555"}}" count="{{getenv "BROWSER_COUNT" "1"}}" vnc="vnc://{{.}}:5900"/>
{{end}}
</region>
</version>
</browser>
</qa:browsers>

View File

@ -0,0 +1,8 @@
<qa:browsers xmlns:qa="urn:config.gridrouter.qatools.ru">
<browser name="chrome" defaultVersion="78.0">
<version number="78.0">
<region name="1">
</region>
</version>
</browser>
</qa:browsers>

View File

@ -0,0 +1,7 @@
[program:confd]
command = confd -watch -backend file -file /dev/null
redirect_stderr = true
[program:null]
command = sh -c 'while true; do date > /dev/null; sleep 60; done'
redirect_stderr = true

View File

@ -0,0 +1,3 @@
[program:ggr-ui]
command = ggr-ui -listen 8888 -limit 10 -quota-dir /etc/grid-router/quota
redirect_stderr = true

28
ggr-ui/docker-compose.yml Normal file
View File

@ -0,0 +1,28 @@
version: "3.7"
services:
ggr-ui:
image: vimagick/ggr-ui
ports:
- "8888:8888"
environment:
- BROWSER_NAME=chrome
- BROWSER_VERSION=78.0
- BROWSER_REGION=1
- BROWSER_HOSTS=tasks.selenoid
- BROWSER_PORT=4444
- BROWSER_COUNT=10
extra_hosts:
- tasks.selenoid:1.2.3.4
- tasks.selenoid:4.3.2.1
restart: unless-stopped
selenoid-ui:
image: aerokube/selenoid-ui:latest-release
command: --selenoid-uri=http://ggr-ui:8888
ports:
- "8080:8080"
depends_on:
- ggr-ui
restart: unless-stopped

View File

@ -4,6 +4,14 @@ ggr
Go Grid Router (aka [Ggr][1]) is a lightweight active load balancer used to
create scalable and highly-available Selenium clusters.
```bash
$ docker stack deploy -c docker-stack.yml ggr
$ docker run --rm -it alpine sh
>>> apk update
>>> apk add bind-tools
>>> dig tasks.chrome
```
```bash
$ curl http://127.0.0.1:4444/ping
{

View File

@ -41,3 +41,8 @@ services:
parallelism: 5
delay: 10s
order: stop-first
networks:
default:
driver: overlay
attachable: true

75
selenoid/docker-stack.yml Normal file
View File

@ -0,0 +1,75 @@
version: "3.7"
services:
selenoid:
image: aerokube/selenoid:latest-release
command: >
-conf config/browsers.json
-video-output-dir video
-log-output-dir logs
-limit 10
-timeout 5m
-max-timeout 1h
-container-network selenoid_default
ports:
- "4444:4444"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- selenoid_data:/opt/selenoid
environment:
- OVERRIDE_VIDEO_OUTPUT_DIR=/mnt/selenoid/video
deploy:
replicas: 0
placement:
constraints:
- node.role == worker
restart_policy:
condition: on-failure
ggr-ui:
image: vimagick/ggr-ui
ports:
- "8888:8888"
environment:
- BROWSER_NAME=chrome
- BROWSER_VERSION=78.0
- BROWSER_REGION=1
- BROWSER_HOSTS=tasks.selenoid
- BROWSER_PORT=4444
- BROWSER_COUNT=10
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
selenoid-ui:
image: aerokube/selenoid-ui:latest-release
command: --selenoid-uri=http://ggr-ui:8888
ports:
- "8080:8080"
depends_on:
- ggr-ui
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
volumes:
selenoid_data:
driver: local
driver_opts:
type: nfs
o: "addr=10.0.0.96,nolock,soft,ro"
device: ":/export/selenoid"
networks:
default:
driver: overlay
attachable: true

View File

@ -1,7 +1,8 @@
version: '3.5'
version: '3.7'
services:
splash:
image: scrapinghub/splash:3.3.1
image: scrapinghub/splash:3.4
command: --maxrss 2048 --max-timeout 300 --disable-lua-sandbox --verbosity 1
ports:
- "8050:8050"
@ -20,6 +21,7 @@ services:
- node.role == worker
restart_policy:
condition: on-failure
volumes:
splash_filters:
driver: local
@ -45,6 +47,7 @@ volumes:
type: nfs
o: "addr=10.0.0.96,nolock,soft,ro"
device: ":/export/splash/proxy-profiles"
networks:
default:
ipam: