From 0a4c0483f7d854cb450a9a1dee1f87acbd3bd75e Mon Sep 17 00:00:00 2001 From: vania-pooh Date: Sun, 16 Dec 2018 07:41:20 +0000 Subject: [PATCH] Documentation updated by vania-pooh --- latest/index.html | 363 ++++++++++------------------------------------ 1 file changed, 79 insertions(+), 284 deletions(-) diff --git a/latest/index.html b/latest/index.html index 2b5426b..f37d36f 100644 --- a/latest/index.html +++ b/latest/index.html @@ -524,7 +524,7 @@

Moon

Aerokube OÜ
version latest, -2018-12-11 +2018-12-16
Table of Contents
@@ -552,21 +552,19 @@

Moon

  • 2.2.3. Updating Browsers List
  • -
  • 2.3. Configuration File
  • -
  • 2.4. Credentials File
  • -
  • 2.5. Installing License
  • -
  • 2.6. Advanced Configuration +
  • 2.3. Installing License
  • +
  • 2.4. Advanced Configuration
  • -
  • 2.7. Log Files
  • -
  • 2.8. CLI Flags
  • +
  • 2.5. Log Files
  • +
  • 2.6. CLI Flags
  • 3. Advanced Features @@ -882,7 +880,7 @@

    2. Configur

    2.1. Users List

    -

    Moon is a multi-user application allowing different users access different browser versions. A single htpasswd file is used to store users information. This file is saved to Kubernetes Secret and mounted to Moon container as a volume. A typical users file is a text file with user names and their encrypted passwords separated by colon:

    +

    Moon is a multi-user application allowing different users access different browser versions. One htpasswd file is used to store users information. This file is saved to Kubernetes Secret and mounted to Moon container as a volume. A typical users file is a text file with user names and their encrypted passwords separated by colon:

    @@ -918,7 +916,12 @@

  • -

    Changes are applied immediately without Moon restart.

    +

    Gracefully restart Moon service:

    +
    +
    +
    $ kubectl moon replace -f moon.yaml -n moon
    +
    +
  • @@ -1058,8 +1061,8 @@

    2.2.2. Guest Qu
    Guest quota file name
    -
    -guest-user browsers ====> browsers.json # This is the default
    --guest-user guest-user ====> guest-user.json
    +
    -guest-quota browsers ====> browsers.json # This is the default
    +-guest-quota guest-user ====> guest-user.json
    @@ -1082,203 +1085,22 @@

    -

    2.3. Configuration File

    -
    -

    Moon stores all advanced configuration options (e.g. S3 settings) in a special JSON file called service.json:

    -
    -
    -
    Typical service.json file
    -
    -
    {
    -  "s3": {                                          (1)
    -    "endpoint": "https://storage.googleapis.com",  (2)
    -    "bucketName": "moon-test",                     (3)
    -    "version": "S3v2"                              (4)
    -  },
    -  "images": {                                      (5)
    -    "logger": {                                    (6)
    -      "image": "my-reg.com/moon/logger:1.2.0",     (7)
    -      "cpu": "0.3",                                (8)
    -      "mem": "1024Mi"                              (9)
    -    }
    -  }
    -}
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1S3 configuration section
    2S3 endpoint URL
    3S3 bucket name
    4S3 signature version (should be S3v2 or S3v4)
    5Custom Moon system images section (to use Moon with private Docker registries)
    6Custom Moon image definition (one of logger, defender, videoRecorder)
    7Custom Moon image reference
    8Custom Moon image CPU limit
    9Custom Moon image memory limit
    -
    -
    -

    service.json is mounted to Moon container as a regular file using Kubernetes config map. Path to configuration file is specified with -config-file Moon flag. Any changes to configuration file are applied immediately - no need to restart Moon.

    -
    -
    -
    Adding service.json file to Moon
    -
    -
    apiVersion: v1
    -kind: ConfigMap
    -metadata:
    -  name: config
    -  namespace: moon
    -data:
    -  service.json: |
    -    {
    -      "s3": {
    -        "endpoint": "https://storage.googleapis.com",
    -        "bucketName": "moon-test",
    -        "version": "S3v2"
    -      }
    -    }
    ----
    -apiVersion: apps/v1beta1
    -kind: Deployment
    -metadata:
    -  name: moon
    -  namespace: moon
    -spec:
    -  template:
    -    metadata:
    -      labels:
    -        app: moon
    -    spec:
    -      containers:
    -      - name: moon
    -        image: aerokube/moon:latest-release
    -        args: ["-config-file", "/config/service.json"]
    -        volumeMounts:
    -        - name: config
    -          mountPath: /config
    -          readOnly: true
    -    volumes:
    -      - name: config
    -        configMap:
    -          name: config
    -
    -
    - -
    -

    2.4. Credentials File

    -
    -

    Moon reads all credentials (e.g. S3 keys) from an optional JSON file called :

    -
    -
    -
    Typical credentials.json file
    +

    Gracefully restart Moon service:

    +
    -
    {
    -  "s3": {                              (1)
    -    "accessKey": "access-key-value",   (2)
    -    "secretKey": "secret-key-value"    (3)
    -  }
    -}
    +
    $ kubectl replace -f moon.yaml -n moon
    -
    - - - - - - - - - - - - - -
    1S3 credentials section
    2S3 access key value
    3S3 secret key value
    + +
    -

    Such credentials file is mounted to Moon container as a regular file using Kubernetes secret. Path to credentials file is specified with -credentials-file Moon flag. Any changes to credentials file are applied immediately - no need to restart Moon.

    -
    -
    -
    Adding credentials file to Moon
    -
    -
    apiVersion: v1
    -kind: Secret
    -metadata:
    -  name: credentials
    -  namespace: moon
    -stringData:
    -  credentials.json: |
    -    {
    -      "s3": {
    -        "accessKey": "access-key-value",
    -        "secretKey": "secret-key-value"
    -      }
    -    }
    ----
    -apiVersion: apps/v1beta1
    -kind: Deployment
    -metadata:
    -  name: moon
    -  namespace: moon
    -spec:
    -  template:
    -    metadata:
    -      labels:
    -        app: moon
    -    spec:
    -      containers:
    -      - name: moon
    -        image: aerokube/moon:latest-release
    -        args: ["-credentials-file", "/credentials/credentials.json"]
    -        volumeMounts:
    -        - name: credentials
    -          mountPath: /credentials
    -          readOnly: true
    -    volumes:
    -    - name: credentials
    -      secret:
    -        secretName: credentials
    +

    All running user sessions will continue to work without any interruption.

    -

    2.5. Installing License

    +

    2.3. Installing License

    @@ -1309,22 +1131,7 @@

    2

    Having a license key file - create a Kubernetes secret:

    -
    $ kubectl create secret generic license-key --from-file /path/to/license.key -n moon
    -
    -
    -
    -

    If you prefer YAML - this will look like:

    -
    -
    -
    Creating a secret for license key
    -
    -
    apiVersion: v1
    -kind: Secret
    -metadata:
    -  name: license-key
    -  namespace: moon
    -stringData:
    -  license.key: Ti90a3ljSWpvV3hicU5ZY3U3ZVNMUzdzalVjU29nSVU2a3lmWDdENmhOSEs4SFJVVE5LNEpKL2oxRGhWTnRhZVBEQmx5cm1SM0dFWlVpbGIwOWhBSUpvWmlQMnNtYmtoZVRDbnJ3UTlIV3grMUMzaXFJalU3L0NIZDJuSzN3QUpIS0lyV2VoVjlRVUh5NzNCMFg0NEV5KzFSVXg1elhvaC9RUkNjTlBIOHR4WWtrRFBmTFhxYTFESlI0aXNObGtobWpXY2VJNVdna1lsWHFFOUp0OUxValZPN05hb2pCcHJzY0pvZjBrZys2YkhWUDR3cUJvYVFoSFJTYzMzZzNRSTkrWVd4dlZCeExmdTVxM2k2ZnluMDRHSEhGc21Fd2owVHdVa1Z3MmI5Z2FyVXlaVFF4RDdCRjVSVjBmSUVrU1pEQ0ZQdmIvMHZoKythY1V4OVRrR2FBREZzbWR3dExxRlU4NHF3MzBVdE5nTGhnNWYxRXRCQ215R1BHR0wyK2NpR0RDZDBTSXg4K1RsRGNWVzUyVVY4MUt6bkdOanJhTklOeXVtYjVPVXF6aVVpdmJZeVJNVVBSMWF3NUJRVGJDaHVycWVVdGtMMWFRZDgwOCtoWGRxODFOakxRNEJlVENNQTdPL2FneHBTUE1nL0J2QmVQKy84ZGhJeXd5Y0lxQVJhVWxocUdmUko2K05tbkFYV0hzZ2RjTng1dUVHU0w5VWF5TU1rR3RkZEZKQ1FiWmF0RnJMaDFHbHhKTndBRHFWcXIvQ0oxSzBQL2p6K2NFSWpsSG82TktvM3pudVFlanhYT2tGU1p1bWZrS1krZmF3VkVRZWlvcFlmZFk0TU9tc3U5TThsbng3T2VXQXZmOTFUQ2w1NUhBK1ZsQTMzN3VFOG1WV3ZlS0E1Tlk9O2V5SnNhV05sYm5ObFpTSTZJa0ZqYldVZ1RFeERJaXdpY0hKdlpIVmpkQ0k2SWsxdmIyNGlMQ0p0WVhoVFpYTnphVzl1Y3lJNk1qQXNJblJ2SWpveE5UTTRNelV5TURBd2ZRPT0=
    +
    $ kubectl create secret generic moon-license-key --from-file /path/to/license.key -n moon
    @@ -1347,7 +1154,7 @@

    2 spec: containers: - name: moon - image: aerokube/moon:latest-release + image: aerokube/moon:latest args: ["-license-file", "/license/license.key"] # Pointing to license key file resources: # Resources here @@ -1361,8 +1168,8 @@

    2 volumes: # Other volumes here - name: license-key # Creating volume from secret - secret: - secretName: license-key + secret: + secretName: moon-license-key @@ -1370,9 +1177,9 @@

    2
    -

    2.6. Advanced Configuration

    +

    2.4. Advanced Configuration

    -

    2.6.1. Uploading Files to S3

    +

    2.4.1. Uploading Files to S3

    You can configure Moon to send sessions logs and recorded video files to S3-compatible storage. Such type of storage is supported by AWS, Google Cloud, Microsoft Azure, Digital Ocean and many other cloud providers. To deploy a private S3-compatible storage you can use Minio. To enable S3 support in Moon:

    @@ -1385,7 +1192,9 @@

    Create a service.json file with the following contents:

    -
    $ cat service.json
    +
    $ mkdir -p moon-config
    +$ touch moon-config/service.json # Add contents to file as shown on the next line
    +$ cat moon-config/service.json
     {
       "s3": {
         "endpoint": "https://storage.googleapis.com",
    @@ -1397,33 +1206,34 @@ 

  • -

    Save service.json to a Kubernetes config map, mount it as a file to Moon container and then specify path to the file using -config-file flag as shown in Configuration File section.

    -
  • -
  • -

    Create a credentials.json file to store S3 keys:

    +

    Create a moon-config ConfigMap object:

    -
    $ cat service.json
    -{
    -  "s3": {
    -    "accessKey": "access-key-value",
    -    "secretKey": "secret-key-value"
    -  }
    -}
    +
    $ kubectl create configmap moon-config --from-file=moon-config -n moon
  • -

    Save credentials.json to a Kubernetes secret, mount it as a file to Moon container and then specify path to the file using -credentials-file flag as shown in Credentials File section.

    +

    Create an S3 secret for Moon to store the keys:

    +
    +
    +
    $ kubectl create secret generic s3-credentials --from-literal=accessKey="<Your-S3-Access-Key>" --from-literal=secretKey="<Your-S3-Secret-Key>" -n moon
    +
    +
  • -

    When you update a config map with service.json or a secret with credentials.json - settings are applied immediately without Moon restart.

    +

    Restart Moon pods to apply the changes:

    +
    +
    +
    $ kubectl delete po -l app=moon -n moon
    +
    +
  • -
    -

    You can optionally adjust CPU and memory limits for each image as follows:

    -
    -

    -

    2.6.3. Adjusting Timeouts

    +

    2.4.3. Adjusting Timeouts

    Sometimes things go wrong: user can unexpectedly disconnect or browser session starts longer than needed. This can lead to overall cluster degradation because of broken browser pods occupying all available hardware. To prevent such cases Moon automatically detects and closes suspicious browser sessions. Several flags allow to adjust timeout settings:

    @@ -1529,7 +1328,7 @@

    2

    -

    2.6.4. Adjusting Resources Consumption

    +

    2.4.4. Adjusting Resources Consumption

    @@ -1646,7 +1445,7 @@

    -

    2.6.5. Running Browser Pods in Privileged Mode

    +

    2.4.5. Running Browser Pods in Privileged Mode

    In some cases like running Android emulators browser container should be run in privileged mode. This setting can be applied separately to each browser version in browsers list file as follows:

    @@ -1678,7 +1477,7 @@

    -

    2.6.6. Using Node Selectors

    +

    2.4.6. Using Node Selectors

    Sometimes you may need to run browser pods on particular Kubernetes nodes (i.e. hardware hosts) only. Kubernetes allows to do this by specifying so called node selectors. To provide such selector to Moon browser pods update browsers list as shown below:

    @@ -1713,7 +1512,7 @@

    <
    -

    2.7. Log Files

    +

    2.5. Log Files

    Every log line contains:

    @@ -1971,7 +1770,7 @@

    2.7. Log Files

    -

    2.8. CLI Flags

    +

    2.6. CLI Flags

    These flags should be specified in Kubernetes YAML files when starting the cluster.

    @@ -1980,14 +1779,10 @@

    2.8. CLI Flags

    -
    -config-file string
    -    optional configuration file (default "config/service.json")
    --cpu-limit string
    +
    -cpu-limit string
         browser container cpu limit (default "1")
     -cpu-request string
    -    browser container cpu request (default "0.5")
    --credentials-file string
    -    optional credentials file (default "credentials/credentials.json")
    +    browser container cpu request (default "1")
     -grace-period duration
         graceful shutdown (default 30s)
     -guest-user string
    @@ -2001,11 +1796,11 @@ 

    2.8. CLI Flags

    -memory-request string browser container memory request (default "512Mi") -namespace string - namespace + namespace (default "default") -quota-dir string quota directory (default "quota") -session-attempt-timeout duration - new session attempt timeout (default 30m0s) + new session attempt timeout (default 10m0s) -timeout duration override session timeout (default 1m0s) -users-file string @@ -3648,7 +3443,7 @@