This page provides information about distributing V-Ray builds to V-Ray Swarm peers by Script.


Overview


The Script distribution method is performed by the System Administrator or an advanced user. It saves V-Ray versions to <data-directory>/VRay/import/ directory on every peer.


Workflow


  1. Create a shared directory on your server.
  2. Put V-Ray distributions there.
  3. Mount it on all peers.
  4. Stop Swarm on all peers.
  5. Change the setting vrayImportDir on them to point out to the shared directory.
  6. Start Swarms on all peers.

4,5,6 are needed only if your shared directory is not located in <data-directory>/VRay/import/. If this directory contains V-Ray builds for different OSs, only some of them will be successfully deployed. However, deployment attempts will be performed approximately every 10 seconds, which will load a machine. So, the best approach is to create multiple shared directories: one per OS + architecture (for example: Windows_x86/, Windows_Arm64/, Linux_x86/)and to put relevant V-Ray archives/installers there.

This can be done with scripts, for example, with PowerShell or bash or similar. Such script should upload/send V-Ray archive or an installer to a special Swarm endpoint, It is localhost:1113/api/vray/upload where 1113 is the webPort setting and 1113 is its default value. Example for curl:

curl -v -Fqueued=false -F \
file=@$HOME/tmp/vray-lin-df715d3c8ff9.tar\
localhost:1113/api/vray/upload

And the script could do something very similar. From this simple example, it can be seen that there are parameters - queued and file.
So, the API is:

  1. <peer-IP>:<webPort>/api/vray/upload    HTTP POST

    Parameters of the POST request are:

    { "deployedInDirectory": <path>,
      "uploadedFileSize": <int>,
      "tmpFile": <path>,
      "takenSeconds": <int>,
      "uploadedVrayVersion": <version-dictionary> }

    When a file is uploaded in queued mode (queued is true):

    The uploaded files are saved in the import folder - it is queued.
    Wait until the uploading of a file completes, but not the deployment.
    You receive a response that the file was queued.
    Responses include a JSON dictionary as follows:


    { "queuedAs": <path>,
      "uploadedFileSize": <int>,
      "tmpFile": <path> }

    If rapid or queues upload fails, the response includes JSON dictionary such as:

    {"message": <str>, "tmpFile": <path>}

    If such version already exists (such detection is able only with uploads of archives), the error JSON dictionary inside the larger JSON response is:

    { "message": <str>, "tmpFile": <path>,
      "uploadedVrayVersion": <version-dictionary> }

    Where <version-dictionary> is a JSON dictionary like:

    { "_revHash": "e8197af2",
      "_ver": {"_major":6,"_minor":20,"_release":10} }.

    It corresponds to a <version-str> as 6.20.10-e8197af2 when it is a part of a file name in <data-directory>/VRay/import/ directory.

    In both bad cases (failure, already existing version) temporary file will be removed and everything will be in a state as before.
     
    So, the whole (large) JSON is:

    {<tag-str>: <one-of-dictionaries-above>}

    where <tag-str> is one of these strings:

    ExistingUR

    such V-Ray version already exists

    FailUR

    uploading failure

    QueuedUR

    succeeded uploading in the queued mode

    RapidUR

    succeeded uploading in the rapid mode


    Examples of responses:

    { "ExistingUR":
      {"message":"V-Ray version already exists",
       "tmpFile":"/tmp/servant-multipart106588-2922.buf",
       "uploadedVrayVersion":
         {"_revHash":"e8197af2",
          "_ver": {"_major":6,"_minor":20,"_release":10} }}}

    Another one:

    {
      "RapidUR": {
         "takenSeconds": 6,
         "tmpFile": "/tmp/servant-multipart106588-2924.buf",
         "uploadedFileSize": 458321016,
         "deployedInDirectory":
           "/tmp/VRay/vray-6.20.10-e8197af2",
         "uploadedVrayVersion": {
           "_revHash": "e8197af2",
           "_ver": {
             "_major": 6,
             "_minor": 20,
             "_release": 10 }
         }
      }
    }



  2. <peer-IP>:<webPort>/debug/allowExecutables    HTTP GET