Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from vania-pooh/master
Browse files Browse the repository at this point in the history
Added LICENSE, Dockerfile, CI files and docs draft
  • Loading branch information
aandryashin authored Apr 28, 2018
2 parents 07b546d + 4efd42e commit 6aa7ee1
Show file tree
Hide file tree
Showing 11 changed files with 599 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
vendor
ggr-ui

.idea
*.iml
57 changes: 57 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
sudo: required
language: go

go:
- 1.10.x

services:
- docker

script:
- go test -v -race -coverprofile=coverage.txt -covermode=atomic
- GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.buildStamp=`date -u '+%Y-%m-%d_%I:%M:%S%p'` -X main.gitRevision=`git describe --tags || git rev-parse HEAD` -s -w"
- gox -os "linux darwin windows" -arch "amd64" -osarch="windows/386" -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags "-X main.buildStamp=`date -u '+%Y-%m-%d_%I:%M:%S%p'` -X main.gitRevision=`git describe --tags || git rev-parse HEAD` -s -w"

before_install:
- go get -u github.com/golang/dep/cmd/dep

install:
- go get -u github.com/mitchellh/gox # cross compile
- dep ensure

deploy:
- provider: releases
api-key: $GITHUB_TOKEN
file_glob: true
file: dist/*
skip_cleanup: true
on:
tags: true
- provider: script
script: travis/docker-push.sh latest
skip_cleanup: true
on:
branch: master
- provider: script
script: travis/docker-push.sh $TRAVIS_TAG
skip_cleanup: true
on:
tags: true
- provider: script
script: travis/docker-push.sh latest-release
skip_cleanup: true
on:
tags: true
- provider: script
script: travis/docs.sh latest
skip_cleanup: true
on:
branch: master
- provider: script
script: travis/docs.sh $TRAVIS_TAG
skip_cleanup: true
on:
tags: true

after_success:
- bash <(curl -s https://codecov.io/bash) -F unittests
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM alpine:3.7

RUN apk add -U tzdata && rm -Rf /var/cache/apk/*
COPY ggr-ui /usr/bin

EXPOSE 4444
ENTRYPOINT ["/usr/bin/ggr-ui", "-quota-dir", "/etc/grid-router/quota"]
389 changes: 389 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# ggr-ui
# Ggr UI

Ggr UI is a standalone daemon that automatically collects `/status` information from multiple [Selenoid](https://github.com/aerokube/selenoid) and returns it as a single `/status` API. When this daemon is running you can use [Selenoid UI](https://github.com/aerokube/selenoid-ui) to see the state of the entire cluster.

## Complete Guide & Build Instructions

Complete reference guide (including building instructions) can be found at: http://aerokube.com/ggr-ui/latest/
50 changes: 50 additions & 0 deletions docs/contributing.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
== Contributing & Development

To build Ggr UI:

. Install https://golang.org/doc/install[Golang]

. Setup `$GOPATH` https://github.com/golang/go/wiki/GOPATH[properly]

. Get Ggr UI source:

$ go get -d github.com/aerokube/ggr-ui

. Go to project directory:

$ cd $GOPATH/src/github.com/aerokube/ggr-ui

. Checkout dependencies

$ go get -u github.com/golang/dep/cmd/dep && dep ensure

. Build source:

$ go build

. Run Ggr UI:

$ ./ggr-ui --help

[TIP]
====
To build Docker container type:
[source,bash]
----
$ GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build
$ docker build -t ggr-ui:latest .
----
====

=== Documentation

Locally can be generated with:

[source,bash]
----
$ docker run --rm -v `pwd`/docs/:/documents/ \
asciidoctor/docker-asciidoctor \
asciidoctor -D /documents/output/ index.adoc
----
20 changes: 20 additions & 0 deletions docs/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
= Ggr UI
:revdate: {docdate}
:toc: left
:toclevels: 3
:sectnums:
:sectanchors:
:Author: Alexander Andryashin and the Aerokube community
:revnumber: latest
:icons: font
:source-highlighter: coderay
:docinfo: shared

This reference covers version: _{revnumber}_

Ggr UI is a standalone daemon that automatically collects `/status` information from multiple https://github.com/aerokube/selenoid[Selenoid] instances and returns it as a single `/status` API. When this daemon is running you can use https://github.com/aerokube/selenoid-ui[Selenoid UI] to see the state of the entire cluster.

== Getting Started
include::quick-start-guide.adoc[leveloffset=+1]

include::contributing.adoc[]
20 changes: 20 additions & 0 deletions docs/quick-start-guide.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
== Quick Start Guide

. Prerequisites:
* One or more https://github.com/aerokube/selenoid[Selenoid] hosts
* A directory with http://aerokube.com/ggr/latest/#_creating_quota_files[XML quota files] for Ggr
. Start Ggr UI binary or container:
+
```
$ ./ggr-ui -quota-dir /path/to/quota/dir # As a binary

$ docker run -d --name ggr-ui -p 8888:8888 -v /path/to/quota/dir:/etc/grid-router/quota:ro aerokube/ggr-ui:latest-release
```
+
Binaries as usually can be downloaded from https://github.com/aerokube/ggr-ui/releases[releases page].
. Now start https://github.com/aerokube/selenoid-ui[Selenoid UI] and point it to `http://localhost:8888`. It should start showing sessions running anywhere in Selenium cluster behind Ggr.
. You can also use `/status` API similarly to Selenoid http://aerokube.com/selenoid/latest/#_usage_statistics[/status] API:
+
```
$ curl -s http://localhost:8888/status
```
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func configure() error {
func init() {
flag.StringVar(&listen, "listen", ":8888", "host and port to listen to")
flag.IntVar(&limit, "limit", 10, "simultaneous http requests")
flag.StringVar(&quotaDir, "quotaDir", "quota", "quota directory")
flag.StringVar(&quotaDir, "quota-dir", "quota", "quota directory")
flag.DurationVar(&gracePeriod, "grace-period", 300*time.Second, "graceful shutdown period")
flag.Parse()
limitCh = make(chan struct{}, limit)
Expand Down
9 changes: 9 additions & 0 deletions travis/docker-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -e

docker build -t $TRAVIS_REPO_SLUG .
docker tag $TRAVIS_REPO_SLUG $TRAVIS_REPO_SLUG:$1
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker push $TRAVIS_REPO_SLUG
docker push $TRAVIS_REPO_SLUG:$1
36 changes: 36 additions & 0 deletions travis/docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

set -e
TAGNAME=$1
GH_REF=github.com/aerokube/selenoid.git
git config user.name "${TRAVIS_REPO_SLUG}"
git config user.email "[email protected]"
git remote add upstream "https://${GITHUB_TOKEN}@${GH_REF}"
git fetch upstream

git branch -r

echo "Deleting old output"
rm -rf ${TRAVIS_BUILD_DIR}/docs/output
mkdir ${TRAVIS_BUILD_DIR}/docs/output
git worktree prune
rm -rf ${TRAVIS_BUILD_DIR}/.git/worktrees/docs/output/

echo "Checking out gh-pages branch into docs/output"
git worktree add -B gh-pages ${TRAVIS_BUILD_DIR}/docs/output upstream/gh-pages

echo "Removing existing files"
mkdir -p ${TRAVIS_BUILD_DIR}/docs/output/${TAGNAME}
rm -rf ${TRAVIS_BUILD_DIR}/docs/output/${TAGNAME}/*

#echo "Copying images"
#cp -R ${TRAVIS_BUILD_DIR}/docs/img ${TRAVIS_BUILD_DIR}/docs/output/${TAGNAME}/img
echo "Generating docs"
docker run -v ${TRAVIS_BUILD_DIR}/docs/:/documents/ --name asciidoc-to-html asciidoctor/docker-asciidoctor asciidoctor -a revnumber=${TAGNAME} -D /documents/output/${TAGNAME} index.adoc


echo "Updating gh-pages branch"
cd ${TRAVIS_BUILD_DIR}/docs/output && git add --all && git commit -m "Publishing to gh-pages"


git push upstream HEAD:gh-pages

0 comments on commit 6aa7ee1

Please sign in to comment.