This repository has been archived by the owner on Dec 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #390 from vania-pooh/master
Dependencies update
- Loading branch information
Showing
8 changed files
with
36 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,12 @@ $ curl -s http://example.com:4444/ping | |
---- | ||
|
||
.Result | ||
[source,javascript] | ||
[source,json] | ||
---- | ||
{"uptime":"2m46.854829503s","lastReloadTime":"2017-05-12 12:33:06.322038542 +0300 MSK","numRequests":42, "numSessions":19, "version": "1.6.3"} | ||
---- | ||
|
||
It returns `200 OK` when Ggr operates normally. Additionally server uptime, last quota reload time and overall number of session requests from service startup are returned in JSON format. | ||
It returns `200 OK` when Ggr operates normally. Additionally, server uptime, last quota reload time and overall number of session requests from service startup are returned in JSON format. | ||
|
||
=== Why Ggr is Stateless | ||
Selenium uses an HTTP-based protocol. That means every action in Selenium, e.g. launching browser or taking screenshot is a separate HTTP request. When multiple instances of Ggr are handling requests behind load balancer every request can be routed to any of these instances. Here's how it works. | ||
|
@@ -25,7 +25,7 @@ On the picture above there is one SLB, two instances of Ggr and one Selenium hub | |
|
||
For example let's assume that new session request is routed to `Ggr 1` (black arrows). This Ggr randomly chooses a hub `hub1.example.com` and creates a new session on it. This hub returns some session identifier marked as `ID` on the picture. `Ggr 1` in its turn knows that session was created on `hub1.example.com` and extends the session ID by adding an MD5 sum `S` of hub hostname. This is why it returns to user new longer session with identifier `S+ID` just by concatenating two strings. Every Ggr instance during startup creates an in-memory map - storing host names and their MD5 sums. When consequent request for the same session `S+ID` arrives e.g. to `Ggr 2` (red arrows) it extracts `S` from extended session ID and finds hub hostname in its map. Then it removes `S` from request session identifier and simply proxies this request to hub corresponding to `S`. | ||
|
||
IMPORTANT: Because of stateless Ggr architecture you can use an unlimited number of Ggr instances behind load balancer. In order to work properly it is very important to have exactly the same XML quota files on every Ggr instance. Otherwise some Ggr instances will return `404` error when a request with unknown host `S` arrives. | ||
IMPORTANT: Because of stateless Ggr architecture you can use an unlimited number of Ggr instances behind load balancer. In order to work properly it is very important to have exactly the same XML quota files on every Ggr instance. Otherwise, some Ggr instances will return `404` error when a request with unknown host `S` arrives. | ||
|
||
=== Getting Host by Session ID | ||
Sometimes you may want to get real hostname behind Ggr that is executing browser session. This can be done using session ID: | ||
|
@@ -37,7 +37,7 @@ $ curl -s http://test:[email protected]:4444/host/4355afe3f54e61eb32 | |
---- | ||
|
||
.Result | ||
[source,javascript] | ||
[source,json] | ||
---- | ||
{"Name":"my-host.example.com","Port":4444,"Count":5,"Username":"","Password":""} | ||
---- |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
== Quota Reloading | ||
* To **reload quota files** just send **SIGHUP** to process or Docker container: | ||
+ | ||
``` | ||
# kill -HUP <pid> | ||
# docker kill -s HUP <container-id-or-name> | ||
``` | ||
[source,bash] | ||
---- | ||
$ kill -HUP <pid> | ||
$ docker kill -s HUP <container-id-or-name> | ||
---- | ||
+ | ||
NOTE: Use only one of these commands depending on whether you have Docker installed. | ||
NOTE: Use only one of these commands depending on whether you have Docker installed. |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
module github.com/aerokube/ggr | ||
|
||
go 1.20 | ||
go 1.21 | ||
|
||
require ( | ||
github.com/aandryashin/matchers v0.0.0-20161126170413-435295ea180e | ||
github.com/aandryashin/reloader v0.0.0-20161127125235-da4f1b43ce40 | ||
github.com/abbot/go-http-auth v0.4.1-0.20220112235402-e1cee1c72f2f | ||
golang.org/x/net v0.17.0 | ||
golang.org/x/net v0.19.0 | ||
) | ||
|
||
require ( | ||
github.com/fsnotify/fsnotify v1.5.4 // indirect | ||
github.com/fsnotify/fsnotify v1.7.0 // indirect | ||
golang.org/x/crypto v0.17.0 // indirect | ||
golang.org/x/sys v0.15.0 // indirect | ||
) |
This file contains 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