【Selenoid -3】Selenoidの実行をウォッチする Selenoid-uiを構築する

■はじめに

Ggrの話を進める前に今日は小ネタです。
Selenoidで構築したクライアントマシンをウォッチするプロダクト、Selenoid-uiについて簡単に説明です。

aerokube.com

■Selenoid-uiって?

Selenoidで起動したブラウザコンテナの稼働状況を確認できます。
Selenoidで起動するブラウザはコンテナなので、実行状況を追跡するのが普通では簡単ではありません。
ですので、実行状況を容易に眺めることができるプロダクトがSelenoid-uiです。

■準備

Selenoid-1の回で準備した以下のdocker-compose.yml
https://theboyalex.hatenablog.com/entry/2020/05/20/194158
この末尾にselenoid-ui分を追加します。

以下docker-composeです。

version: "3.7"
services:
  selenoid:
    container_name: selenoid
    image: aerokube/selenoid:1.10.0
    network_mode: bridge
    restart: always
    ports:
      - "4444:4444"
    volumes:
      - "./config:/etc/selenoid"
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./video/:/opt/selenoid/video/"
      - "./logs/:/opt/selenoid/logs/"
    environment:
      - OVERRIDE_VIDEO_OUTPUT_DIR=/path/to/selenoid/video
    command: >
      -conf /etc/selenoid/browsers.json
      -video-output-dir /opt/selenoid/video
      -log-output-dir /opt/selenoid/logs
    healthcheck:
      test: ["CMD-SHELL", "stat /opt/selenoid/logs/ || exit 1"]
      interval: 10s
      timeout: 10s
      retries: 3
      start_period: 30s
  videorecorder:
    container_name: video-recorder
    image: selenoid/video-recorder:latest-release
    restart: always
    healthcheck:
      test: ["CMD-SHELL", "stat /var/ || exit 1"]
      interval: 10s
      timeout: 10s
      retries: 3
      start_period: 30s
  # 以下追加分
  selenoid-ui:
    container_name: selenoid-ui
    image: "aerokube/selenoid-ui"
    network_mode: bridge
    restart: always
    ports:
      - "18080:8080"
    command: ["--selenoid-uri", "http://selenoid.example.test01.com:4444"]

■実行

実行します。

$ docker-compose up -d
Creating network "selenoid_default" with the default driver
Creating selenoid       ... done
Creating video-recorder ... done
Creating selenoid-ui    ... done

psします。

$ docker-compose ps
     Name                   Command                  State                Ports
----------------------------------------------------------------------------------------
selenoid         /usr/bin/selenoid -listen  ...   Up (healthy)   0.0.0.0:4445->4444/tcp
selenoid-ui      /selenoid-ui --selenoid-ur ...   Up (healthy)   0.0.0.0:18080->8080/tcp
video-recorder   /entrypoint.sh  

ちゃんとhealthyになっています。


logも確認しましょう。
video-recorderは起動中ずっと待機ログを吐くので、コンテナ個別にlogを確認。

$ docker container logs -f selenoid-ui
2020/05/23 15:57:55 [INIT] [Listening on :8080]

最後画面の確認です。
8080は18080にポートフォワードしているので、URLは以下になります。
http://selenoid.example.test01.com:18080

f:id:theboyalex:20200524010241p:plain

Selenoid-1では先人のページで書いてあった内容を省略したため、browsers.jsonについては言及しませんでしたが、Selenoid-uiはSelenoidで設定したbrowsers.jsonの中身がそのまま出ています。
念のため、browsers.jsonの中身をこちらに記載しておきます。

{
    "chrome": {
        "default": "80.0",
        "versions": {
            "80.0": {
                "image": "selenoid/vnc_chrome:80.0",
                "port": "4444",
                "tmpfs": {"/tmp": "size=512m", "/var": "size=128m"},
                "path": "/"
            },
            "81.0": {
                "image": "selenoid/vnc_chrome:81.0",
                "port": "4444",
                "tmpfs": {"/tmp": "size=512m", "/var": "size=128m"},
                "path": "/"
            }
        }
    },
    "firefox": {
        "default": "73.0",
        "versions": {
            "73.0": {
                "image": "selenoid/vnc_firefox:73.0",
                "port": "4444",
                "tmpfs": {"/tmp": "size=512m", "/var": "size=128m"},
                "path": "/wd/hub"
            },
            "74.0": {
                "image": "selenoid/vnc_firefox:74.0",
                "port": "4444",
                "tmpfs": {"/tmp": "size=512m", "/var": "size=128m"},
                "path": "/wd/hub"
            }
        }
    }
}


さて、次回は今回の内容を派生してGgr-uiの説明をします。
Ggr-uiの方で実際の画面動作も合わせて見て行きます。

ではでは。