This page provides information about distributing V-Ray builds to V-Ray Swarm peers by Script.
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.
vrayImportDir
on them to point out to the shared directory.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:
<peer-IP>:<webPort>/api/vray/upload HTTP POST
<peer-IP>
is the IP of the peer, for the local Swarm localhost can be usedwebPort
by default is 1113 if it was not changed in swarm.yaml settingsParameters of the POST request are:
queued
is a boolean flag, if it is false
(JSON representation is used), then the uploaded file is processed immediately (synchronous or rapid call). If it is true
, then the uploaded file will be put to <data-directory>/VRay/import/
and will be imported little bit later (see uploadsQueuePeriod
Swarm’s setting, by default: 10 seconds)file
is the uploaded file itself (an archive of supported format or an installer of supported format). Installers by default are not allowed, to allow them, change the allowExecutables
Swarm’s setting.queued
is false
):<data-directory>/VRay/import/
directory).<data-directory>/VRay/import/ directory.
{ "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 }
}
}
}
<peer-IP>:<webPort>/debug/allowExecutables HTTP GET
allowExecutables
: true)