Hybrid method 2: Manual Wasm mount
This alternate method involves downloading the required Wasm modules using the Export API and utilizing Docker's bind-mount feature to execute them.
Export the Wasm modules from Spark
The Export API packages all of the files necessary to create a service into a Wasm bundle ZIP file.
Identify the Spark services to include in the deployment.
Ensure you have setup the appropriate Authorization for the Export API.
Start an Export job to fetch the required services into a Wasm bundle
ZIPfile. In this example, 2 services are fetched frommyenvironmentmytenantFolder A. Upon the successful posting of this job, it will return anid.curl --location --request POST 'https://excel.myenvironment.coherent.global/mytenant/api/v4/export' \ --header 'Content-Type: application/json' \ --header 'x-synthetic-key: 22f68e51-b04b-4a46-b0aa-a629a8a3fca8' \ --header 'x-tenant-name: mytenant' \ --data '{ "file_filter": "onpremises", "inputs": { "services": ["Folder A/Service A", "Folder A/Service B"] } }'Check the status of the Export job with the
idfrom the previous step. When successful, the jobstatuswill beclosedand there will be a link to download the Wasm bundleZIPfile.curl --location 'https://excel.myenvironment.coherent.global/mytenant/api/v4/export/fea5ba57-675b-4a16-be5e-cb6648f59b4b/status' \ --header 'x-synthetic-key: 22f68e51-b04b-4a46-b0aa-a629a8a3fca8' \ --header 'x-tenant-name: mytenant'The resulting
ZIPfile will be structured as follows with a Tenant, Folder, Service, Service version hierarchy:mytenant ├── Folder A │ ├── Service A │ │ ├── 0.1.0 │ │ │ ├── 3deb2c18-fc05-44d9-b77b-119758a7ef91.zip │ │ │ ├── DefaultValidations.json │ │ │ ├── ModelMetadata.json │ │ │ └──WASMMetadata.json │ ├── Service B │ │ ├── 1.0.0 │ │ │ ├── c16d9b89-92c4-430f-a30e-9b04805fcb78.zip │ │ │ ├── DefaultValidations.json │ │ │ ├── ModelMetadata.json │ │ │ └──WASMMetadata.json │ ├── ... └── ...
Run Wasm modules using the nodegen-server
To configure nodegen-server to run exported Wasm modules, you need to set the following environment variables.
USE_SAAS
false
This must always be set as false. The setting of true is for Coherent deployments on our SaaS environments. The default value is true.
MODEL_LOCATION
/models
The location within the container used to store models.
UPLOAD_ENABLED
true
This allows users to upload additional WASM modules without having to restart the container. The default value is false.
Ensure that the Docker engine/daemon is up and running.
Navigate to your desired working directory and move the exported
ZIPto this location.unziptheZIPfile to a folder that contains the above contents. In this example we are extractingrunner_example.zipto a folder calledmodel_zip.docker image pullthenodegen-serverDocker image using the following command:docker container runthe service and create a container calledwasm-server.Mount the local unzipped folder
./model_zipto thewasm-servercontainer/modelspath. Be mindful of the file paths. Read more about Docker bind mounts for more details on how to mount files and directories on Windows, Linux, and macOS.
Test the service using the
healthcheckendpoint. You should receive the message{"msg":"ok"}.Execute a request similar to that in the API Tester.
Note the change in the URI to
localhost:3000and make sure to updatemytenantin the URI to your tenant name.See Execute API (v3) for more information on the request_data and request_meta structure and options.
The
service_idandversion_idshould match those from the tenant you exported the WasmZIPbundle.Also see the Hybrid runner API reference for alternative endpoints available from the runner.
It is good practice to
docker container stopanddocker container rmcontainers when you are finished.
Last updated
