From a92a4daac729de1cde501e5fb10a1197f39a241a Mon Sep 17 00:00:00 2001 From: kev Date: Sun, 3 Nov 2019 04:34:23 +0800 Subject: [PATCH] add ggr --- README.md | 1 + ggr/Dockerfile | 15 +++++++++++++++ ggr/README.md | 8 ++++++++ ggr/data/confd/conf.d/ggr.toml | 6 ++++++ ggr/data/confd/templates/guest.xml.tmpl | 11 +++++++++++ ggr/data/grid-router/quota/guest.xml | 8 ++++++++ ggr/data/grid-router/users.htpasswd | 0 ggr/data/supervisor.d/confd.ini | 2 ++ ggr/data/supervisor.d/ggr.ini | 2 ++ ggr/docker-compose.yml | 18 ++++++++++++++++++ 10 files changed, 71 insertions(+) create mode 100644 ggr/Dockerfile create mode 100644 ggr/README.md create mode 100644 ggr/data/confd/conf.d/ggr.toml create mode 100644 ggr/data/confd/templates/guest.xml.tmpl create mode 100644 ggr/data/grid-router/quota/guest.xml create mode 100644 ggr/data/grid-router/users.htpasswd create mode 100644 ggr/data/supervisor.d/confd.ini create mode 100644 ggr/data/supervisor.d/ggr.ini create mode 100644 ggr/docker-compose.yml diff --git a/README.md b/README.md index 54c92c5..38b7994 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ A collection of delicious docker recipes. - [x] drone-scp-arm - [x] drone-ssh-arm - [x] errbot :octocat: +- [x] ggr - [x] hubot :octocat: - [x] jenkins-arm :beetle: diff --git a/ggr/Dockerfile b/ggr/Dockerfile new file mode 100644 index 0000000..f37289e --- /dev/null +++ b/ggr/Dockerfile @@ -0,0 +1,15 @@ +# +# Dockerfile for ggr +# + +FROM golang:alpine +RUN apk add --no-cache git +RUN go get -v github.com/kelseyhightower/confd + +FROM aerokube/ggr +RUN apk add --no-cache 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 +ENTRYPOINT ["supervisord", "-n", "-c", "/etc/supervisord.conf"] diff --git a/ggr/README.md b/ggr/README.md new file mode 100644 index 0000000..fca21bc --- /dev/null +++ b/ggr/README.md @@ -0,0 +1,8 @@ +ggr +=== + +Go Grid Router (aka [Ggr][1]) is a lightweight active load balancer used to +create scalable and highly-available Selenium clusters. + +[1]: https://github.com/aerokube/ggr + diff --git a/ggr/data/confd/conf.d/ggr.toml b/ggr/data/confd/conf.d/ggr.toml new file mode 100644 index 0000000..3d2e3ed --- /dev/null +++ b/ggr/data/confd/conf.d/ggr.toml @@ -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" diff --git a/ggr/data/confd/templates/guest.xml.tmpl b/ggr/data/confd/templates/guest.xml.tmpl new file mode 100644 index 0000000..cc81805 --- /dev/null +++ b/ggr/data/confd/templates/guest.xml.tmpl @@ -0,0 +1,11 @@ + + + + + {{range lookupIP (getenv "BROWSER_HOSTS" "tasks.chrome")}} + + {{end}} + + + + diff --git a/ggr/data/grid-router/quota/guest.xml b/ggr/data/grid-router/quota/guest.xml new file mode 100644 index 0000000..3f4c4ac --- /dev/null +++ b/ggr/data/grid-router/quota/guest.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/ggr/data/grid-router/users.htpasswd b/ggr/data/grid-router/users.htpasswd new file mode 100644 index 0000000..e69de29 diff --git a/ggr/data/supervisor.d/confd.ini b/ggr/data/supervisor.d/confd.ini new file mode 100644 index 0000000..96acd58 --- /dev/null +++ b/ggr/data/supervisor.d/confd.ini @@ -0,0 +1,2 @@ +[program:confd] +command = confd -watch -backend file -file /dev/null diff --git a/ggr/data/supervisor.d/ggr.ini b/ggr/data/supervisor.d/ggr.ini new file mode 100644 index 0000000..d5b1312 --- /dev/null +++ b/ggr/data/supervisor.d/ggr.ini @@ -0,0 +1,2 @@ +[program:ggr] +command = ggr -listen :4444 -users /etc/grid-router/users.htpasswd -quotaDir /etc/grid-router/quota -guests-allowed diff --git a/ggr/docker-compose.yml b/ggr/docker-compose.yml new file mode 100644 index 0000000..2e36f3c --- /dev/null +++ b/ggr/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3.7" + +services: + + ggr: + image: vimagick/ggr + ports: + - "4444:4444" + volumes: + - ./data/grid-router:/etc/grid-router + environment: + - BROWSER_NAME=chrome + - BROWSER_VERSION=78.0 + - BROWSER_REGION=1 + - BROWSER_HOSTS=tasks.chrome + - BROWSER_PORT=5555 + - BROWSER_COUNT=10 + restart: unless-stopped