Deployment

When you're ready to deploy your WASM module, use one of the following methods to build an optimized version of your module:

AssemblyScript

The compiled WASM module will be saved to build/soralet-optimized.wasm.

Rust

The compiled WASM module will be saved to target/wasm32-unknown-unknown/release/soralet.wasm.

C/C++

The compiled WASM module will be saved to build/soralet-optimized.wasm.

The size of the WASM module may increase depending on your build environment and program contents. Orbit does not support WASM modules larger than 4 MB. If your optimized module is larger, you can reduce the size using the wasm-strip command included in the WebAssembly Binary Toolkit , which is installed in the development container.

Now you can deploy the module to your Soracom account.

The instructions on this page provide information for how to deploy and manage your WASM modules from within your development environment. You can also manage your modules from the User Console by referring to the Soralets & Modules documentation.


Creating a Soralet

To upload a WASM module, you must first create a Soralet. A Soralet is a WASM runtime container on Soracom which will run your WASM modules, and which can contain multiple versions of of your modules.

Using the Soracom CLI, run the soralets create command to create a new Soralet:

soracom soralets create --soralet-id my-soralet

Use the --soralet-id parameter to specify a name for the Soralet.

The name of a Soralet can only consist of numbers, letters, underscores, and hyphens, and must be 100 characters or less.

You can then confirm that your Soralet was created successfully:

soracom soralets get --soralet-id my-soralet
>{
>  "createdTime": 1592491058519,
>  "description": "",
>  "operatorId": "OP0012345678",
>  "soraletId": "my-soralet",
>  "updatedTime": 1592491058519
>}

Uploading a Module

Now, upload your WASM module to your Soralet:

soracom soralets upload --soralet-id my-soralet \
>  --content-type application/octet-stream \
>  --body @path/to/soralet-optimized.wasm
>{
>  "createdTime": 1592491690521,
>  "operatorId": "OP0012345678",
>  "soraletId": "my-soralet",
>  "srn": "srn:soracom:OP0012345678:g:Soralet:my-soralet/1",
>  "version": 1
>}

Arguments:

You can then follow the Device Testing documentation to test your module in on Soracom, and the Configuration documentation to enable your module for a device group.

If you upload additional modules to the same Soralet, they will be saved separately rather than overwriting existing modules. Each time you upload another WASM module, the Soracom Resource Name (SRN) version number will automatically increment. This allows you to easily update your group configuration and roll back to a previous version without re-uploading an older WASM module.

You can check which module versions are available within a Soralet using the following command:

soracom soralets list-versions --soralet-id my-soralet

Each version will also indicate the module size and SHA-512 hash for reference.


Deleting a Module

If you no longer need a particular module version, or if you have reached the limit of modules that can be uploaded to a Soralet, you can delete individual modules.

First, use the soralets list-versions command to get a list of all module versions in the Soralet:

soracom soralets list-versions --soralet-id my-soralet

You should receive a JSON response similar to:

[
  {
    "createdTime": 1592491690521,
    "hash": "0671a28cce494d6848bd5ba9c88d00070cfdc1bd8a47f8e9174c2eb178905279b90c06c6f1a7c8b3d0a9ffcd5bb3f508f46f3d83737c5f83db35b4eac29216ae",
    "operatorId": "OP0012345678",
    "size": 15684,
    "soraletId": "my-soralet",
    "srn": "srn:soracom:OP0012345678:g:Soralet:my-soralet/1",
    "version": 1
  },
  {
    "createdTime": 1592491919049,
    "hash": "7f2a8b7b424267458f318a6959f1bf6e24e6384aeb9dd05c075510e5edff07e8a1660a22812cc02e57e8f5645417798916703b2bf5c10cb29e1538a6b0ecdd8a",
    "operatorId": "OP0012345678",
    "size": 31213,
    "soraletId": "my-soralet",
    "srn": "srn:soracom:OP0012345678:g:Soralet:my-soralet/2",
    "version": 2
  }
]

Then, use the following command to delete a module version:

soracom soralets delete-version --soralet-id my-soralet --version 2

You can only delete a module if it is not used in a group configuration.

Deleting a module is a permanent action. Once deleted, a module cannot be restored. You will need to upload the module again.


Deleting a Soralet

Once you have deleted all modules from a Soralet, you can also delete the Soralet itself:

soracom soralets delete --soralet-id my-soralet

Deploying with VS Code

To create a Soralet:

  1. Open the SORACOM Orbit Tools view from the Activity Bar.
  2. Click the Create Soralet button in the title bar of the Soralets panel.
  3. Enter the Soralet ID and press Enter.
  4. Enter an optional Description and press Enter.

The Soralets panel will update to show the new Soralet.

To upload a module:

  1. Click the Upload new WASM button on the right side of Soralet.
  2. Specify the path of the WASM module in your workspace and click OK.

The uploaded WASM module will be displayed under the Soralet along with the version number and the date and time of upload.

To delete a module:

  1. Open the SORACOM Orbit Tools view from the Activity Bar.
  2. Expand the Soralet from the Soralets panel.
  3. Right-click the version and click Delete this version.

If the module is currently being used in a device group, the group name will be displayed as a child element. Open the Soracom User Console and edit the group configuration to remove the module version from the SORACOM Orbit settings.

To delete a Soralet:

  1. Right-click a Soralet and click Delete this Soralet.