diff --git a/.travis.yml b/.travis.yml index a71a761e..9bb828e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,8 @@ services: script: - go test -v -race -coverprofile=coverage.txt -covermode=atomic -coverpkg .,github.com/aerokube/selenoid/session,github.com/aerokube/selenoid/config,github.com/aerokube/selenoid/protect,github.com/aerokube/selenoid/service - - 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`" - - 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`" + - 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 diff --git a/config/config.go b/config/config.go index f0403ee2..90531a10 100644 --- a/config/config.go +++ b/config/config.go @@ -58,6 +58,7 @@ type Browser struct { Env []string `json:"env,omitempty"` Hosts []string `json:"hosts,omitempty"` ShmSize int64 `json:"shmSize,omitempty"` + Labels map[string]string `json:"labels,omitempty"` } // Versions configuration @@ -92,20 +93,20 @@ func loadJSON(filename string, v interface{}) error { // Load loads config from file func (config *Config) Load(browsers, containerLogs string) error { - log.Println("Loading configuration files...") + log.Println("[-] [INIT] [Loading configuration files...]") br := make(map[string]Versions) err := loadJSON(browsers, &br) if err != nil { return fmt.Errorf("browsers config: %v", err) } - log.Printf("Loaded configuration from [%s]\n", browsers) + log.Printf("[-] [INIT] [Loaded configuration from %s]", browsers) var cl *container.LogConfig err = loadJSON(containerLogs, &cl) if err != nil { - log.Printf("Using default containers log configuration because of: %v\n", err) + log.Printf("[-] [INIT] [Using default containers log configuration because of: %v]", err) cl = &container.LogConfig{} } else { - log.Printf("Loaded configuration from [%s]\n", containerLogs) + log.Printf("[-] [INIT] [Loaded log configuration from %s]", containerLogs) } config.lock.Lock() defer config.lock.Unlock() @@ -123,7 +124,7 @@ func (config *Config) Find(name string, version string) (*Browser, string, bool) return nil, "", false } if version == "" { - log.Println("Using default version:", browser.Default) + log.Printf("[-] [DEFAULT_VERSION] [Using default version: %s]", browser.Default) version = browser.Default if version == "" { return nil, "", false diff --git a/config_test.go b/config_test.go index fe7bf4c9..7907a0ca 100644 --- a/config_test.go +++ b/config_test.go @@ -41,7 +41,6 @@ func TestConfigError(t *testing.T) { os.Remove(confFile) conf := config.NewConfig() err := conf.Load(confFile, logConfPath) - log.Println(err) AssertThat(t, err.Error(), EqualTo{fmt.Sprintf("browsers config: read error: open %s: no such file or directory", confFile)}) } diff --git a/docs/browser-image-information.adoc b/docs/browser-image-information.adoc index 8fc10d76..80bf1b60 100644 --- a/docs/browser-image-information.adoc +++ b/docs/browser-image-information.adoc @@ -64,7 +64,7 @@ WARNING: Firefox 53.0+ images require Selenium client 3.4.0 or newer. |=== | Image | VNC Image | Selenoid Version | Geckodriver Version | Firefox Version | Client Version -| selenoid/firefox:48.0 | selenoid/vnc:firefox_48.0 | 1.3.9 | 0.13.0 | 48.0.2 (page load timeout, native events and proxies don't work) .10+<.^| +| selenoid/firefox:48.0 | selenoid/vnc:firefox_48.0 | 1.3.9 | 0.13.0 | 48.0.2 (page load timeout, native events and proxies don't work) .11+<.^| **Java, selenium-webdriver.js**: 3.4.0 and above **Python**: 3.5.0 and above | selenoid/firefox:49.0 | selenoid/vnc:firefox_49.0 | 1.3.9 | 0.13.0 | 49.0.2 (page load timeout, native events and switching between windows don't work) @@ -76,6 +76,7 @@ WARNING: Firefox 53.0+ images require Selenium client 3.4.0 or newer. | selenoid/firefox:55.0 | selenoid/vnc:firefox_55.0 | 1.3.9 | 0.18.0 | 55.0.1 (switching windows may not work) | selenoid/firefox:56.0 | selenoid/vnc:firefox_56.0 | 1.3.9 | 0.19.1 | 56.0.1 | selenoid/firefox:57.0 | selenoid/vnc:firefox_57.0 | 1.3.9 | 0.19.1 | 57.0 +| selenoid/firefox:58.0 | selenoid/vnc:firefox_58.0 | 1.3.9 | 0.19.1 | 58.0 |=== @@ -150,6 +151,7 @@ We do not consider these images really stable. Many of base operations like work | selenoid/opera:48.0 | selenoid/vnc:opera_48.0 | 2.30 | 48.0.2685.35 | selenoid/opera:49.0 | selenoid/vnc:opera_49.0 | 2.32 | 49.0.2725.39 | selenoid/opera:50.0 | selenoid/vnc:opera_50.0 | 2.32 | 50.0.2762.45 +| selenoid/opera:51.0 | selenoid/vnc:opera_51.0 | 2.33 | 51.0.2830.26 |=== [NOTE] diff --git a/docs/browser-images.adoc b/docs/browser-images.adoc index 223a7005..2948a443 100644 --- a/docs/browser-images.adoc +++ b/docs/browser-images.adoc @@ -9,4 +9,23 @@ We maintain a set of prebuilt Docker container images for different browsers inc All these images are free to use. See image tags for a list of supported versions. Build files are stored in http://github.com/aerokube/selenoid-images[selenoid-images] repository. Feel free to create issues or request images for new versions. -NOTE: Complete list of browser images can be found in <> +[NOTE] +==== +. Complete list of browser images can be found in <> +. These images support all UTF-8 locales. This can be important if you want to save files using national alphabet symbols. You can enable your preferred locale in browsers configuration file by setting respective environment variables: +``` +{ + "chrome": { + "default": "64.0", + "versions": { + "64.0": { + "image": "selenoid/vnc:chrome_64.0", + //... + "env" : ["LANG=ru_RU.UTF-8", "LANGUAGE=ru:en", "LC_ALL=ru_RU.UTF-8"] + } + } + } +} +``` +==== + diff --git a/docs/browsers-configuration-file.adoc b/docs/browsers-configuration-file.adoc index 8d3885e8..6b3602d2 100644 --- a/docs/browsers-configuration-file.adoc +++ b/docs/browsers-configuration-file.adoc @@ -14,7 +14,7 @@ Selenoid requires a simple JSON configuration file of the following format: "port": "4444", <6> "tmpfs": {"/tmp": "size=512m"}, <7> "path" : "/wd/hub", <8> - "volumes" : ["/to:/from:ro"], <9> + "volumes" : ["/from:/to:ro"], <9> "env" : ["TZ=Europe/Moscow"], <10> "hosts" : ["example.com:192.168.0.1"], <11> "shmSize" : 268435456, <12> @@ -113,12 +113,13 @@ Selenoid proxies connections to either Selenium server or standalone driver bina ---- "46.0": { //... - "port": "" + "port": "", "tmpfs": {"/tmp": "size=512m", "/var": "size=128m"}, "path" : "", - "volumes": ["/to:/from", "/another:/one:ro"], + "volumes": ["/from:/to", "/another:/one:ro"], "env" : ["TZ=Europe/Moscow", "ONE_MORE_VARIABLE=itsValue"], "hosts" : ["one.example.com:192.168.0.1", "two.example.com:192.168.0.2"], + "labels" : {"component": "frontend", "project": "my-project"}, "shmSize" : 268435456, }, ---- @@ -142,6 +143,8 @@ We recommend to use our https://github.com/aerokube/cm[configuration tool] to av * *hosts* (_optional_) - This field allows to add custom `/etc/hosts` entries to running container. Specified as an array of `hostname:ip` pairs. +* *labels* (_optional_) - This field allows to add custom labels to running container. Specified as an object of `"key": "value"` pairs. + * *shmSize* (_optional_) - Use it to override shared memory size for browser container. === Syncing Browser Images from Existing File diff --git a/docs/index.adoc b/docs/index.adoc index 12b48f8c..5633b3d0 100644 --- a/docs/index.adoc +++ b/docs/index.adoc @@ -10,7 +10,7 @@ :source-highlighter: coderay :docinfo: shared -This reference for version: _{revnumber}_ +This reference covers version: _{revnumber}_ Selenoid is a powerful http://golang.org/[Go] implementation of original http://github.com/SeleniumHQ/selenium[Selenium] hub code. It is using Docker to launch browsers. Please refer to https://github.com/aerokube/selenoid[GitHub repository] if you need sources. diff --git a/docs/log-files.adoc b/docs/log-files.adoc index f59b187d..4948a70d 100644 --- a/docs/log-files.adoc +++ b/docs/log-files.adoc @@ -1,8 +1,8 @@ == Log Files A typical log file looks like the following: ``` -2017/11/01 19:12:38 [NEW_REQUEST] -2017/11/01 19:12:38 [NEW_REQUEST_ACCEPTED] +2017/11/01 19:12:38 [-] [NEW_REQUEST] +2017/11/01 19:12:38 [-] [NEW_REQUEST_ACCEPTED] 2017/11/01 19:12:38 [41301] [LOCATING_SERVICE] [firefox-45.0] 2017/11/01 19:12:38 [41301] [USING_DOCKER] [firefox-45.0] 2017/11/01 19:12:38 [41301] [CREATING_CONTAINER] [selenoid/firefox:45.0] @@ -24,11 +24,10 @@ Every line contains: | Time | 2017/11/01 19:12:42 | - | Request counter | [41301] | So far as session ID is unknown when doing attempts this counter is used to find all session attempts for each new session request. | Status | [SESSION_ATTEMPTED] | See table below for complete list of statuses. -| Quota name | [my_quota] | Extracted from basic HTTP auth headers. | Browser | [firefox-45.0] | Name and version. Only present for new session requests. | Attempt number | [1] | For SESSION_ATTEMPTED entries means current attempt number. For SESSION_CREATED entries means total number of attempts to create this session. | Session ID | [345bb886-7026-46d7-82d4-4788c0460110] | This value is unique for every browser session -| Session start time | [4.155712239s] | - +| Session start time | [4.15s] | - |=== The following statuses are available: @@ -50,10 +49,12 @@ The following statuses are available: | CONTAINER_REMOVED | Docker container was successfully removed | CONTAINER_STARTED | Docker container has successfully started | CREATING_CONTAINER | Docker container with browser is creating +| DEFAULT_VERSION | Selenoid is using default browser version | DELETED_VIDEO_FILE | Video file was deleted by user | ENVIRONMENT_NOT_AVAILABLE | Browser with desired name and version does not exist | FAILED_TO_REMOVE_CONTAINER | Failed to remove Docker container | FAILED_TO_TERMINATE_PROCESS | An error occurred while terminating driver process +| INIT | Server is starting | PROCESS_STARTED | Driver process successfully started | PROXY_TO | Starting to proxy requests to running container or driver process | REMOVING_CONTAINER | Docker container with browser or video recorder is being removed @@ -66,7 +67,8 @@ The following statuses are available: | SESSION_FAILED | An attempt to create a new session failed - user receives an error | SESSION_NOT_FOUND | Requested VNC or logs for unknown session. | STARTING_CONTAINER | Docker container with browser was created and is starting -| STARTING_PROCESS | Starting driver process +| STARTING_PROCESS | Starting driver process +| SHUTTING_DOWN | Server is stopping | TERMINATING_PROCESS | Stopping driver process | TERMINATED_PROCESS | Driver process was successfully stopped | VNC_ENABLED | User requested VNC traffic diff --git a/docs/special-capabilities.adoc b/docs/special-capabilities.adoc index 01b462ff..9f14c02b 100644 --- a/docs/special-capabilities.adoc +++ b/docs/special-capabilities.adoc @@ -39,7 +39,7 @@ You need to use `setSize` method instead. === Video Recording: enableVideo, videoName, videoScreenSize, videoFrameRate -NOTE: This feature requires some preparation. Please refer <