For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

  1. Identify the Spark services to include in the deployment.

  2. Ensure you have setup the appropriate Authorization for the Export API.

  3. Start an Export job to fetch the required services into a Wasm bundle ZIP file. In this example, 2 services are fetched from myenvironment mytenant Folder A. Upon the successful posting of this job, it will return an id.

    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"]
        }
    }'
  4. Check the status of the Export job with the id from the previous step. When successful, the job status will be closed and there will be a link to download the Wasm bundle ZIP file.

    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'
  5. The resulting ZIP file 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.

Environment variable

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.

  1. Ensure that the Docker engine/daemon is up and running.

  2. Navigate to your desired working directory and move the exported ZIP to this location.

  3. unzip the ZIP file to a folder that contains the above contents. In this example we are extracting runner_example.zip to a folder called model_zip.

  4. docker image pull the nodegen-server Docker image using the following command:

  5. docker container run the service and create a container called wasm-server.

    1. Mount the local unzipped folder ./model_zip to the wasm-server container /models path. 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.

  6. Test the service using the healthcheck endpoint. You should receive the message {"msg":"ok"}.

  7. Execute a request similar to that in the API Tester.

    • Note the change in the URI to localhost:3000 and make sure to update mytenant in 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_id and version_id should match those from the tenant you exported the Wasm ZIP bundle.

      • Also see the Hybrid runner API reference for alternative endpoints available from the runner.

  8. It is good practice to docker container stop and docker container rm containers when you are finished.

Last updated