Atym lets you harness the power of WebAssembly to create ultra-lightweight, highly portable containers that execute with near native performance. The best part? You don't need any WebAssembly knowledge to get started!
In this tutorial, we'll build and deploy the "hello-world" demo from our getting-started repository to your Atym-enabled device.
Before you begin, complete one of the "Getting Started with Atym" board guides below to create your Atym account and install Atym on your board - this will have you ready to start developing in minutes!
Board Guides:
- B-U585I-IOT02A (STM32)
- Portenta H7 (Arduino)
Once your board is set up and ready, let's dive into building your first containerized application with Atym.
-----------------------------------------------------------------------------------------------------------------
PrequisitesFor this tutorial, we're going to use a dev container that contains all of the pre-requisites you need to build, debug, and deploy WebAssembly-based containers with Atym. You can run the container either inside VSCode (recommended) or interactively.
Alternatively, you can set up your own development environment by following the "What's in the Atym Dev Container" section in our developer guide found in the Atym docs.
Docker container (in VSCode)
1. Download and install the following:
- Docker Desktop
- Visual Studio Code
- The Dev Containers extension for VS Code
2. Clone Atym's getting-started repository
git clone --recursive https://github.com/atym-io/getting-started.git3. Open the newly cloned repo in VS Code. When the folder opens, you should see a dialog box from the Dev Containers extension in the bottom right corner, asking if you want to reopen in a container. Click "Reopen in Container".
4. Wait for 15-20 seconds while the container is being prepared.
Docker container (interactively)
1. Download and install Docker Desktop.
2. Clone Atym's getting-started repository
git clone --recursive https://github.com/atym-io/getting-started.git3. Navigate to the newly cloned repo.
cd getting-started4. Run the following command:
docker run --rm -it -v $(pwd):/home/atym ghcr.io/atym-io/atym-c-toolchain:latestBuilding Your First Atym ApplicationNow that you've got your development environment set up, let's get to the fun stuff!
1. Navigate to the hello-world sample in the samples directory:
cd samples/hello-world/2. Compile the Application
mkdir build && cd build
cmake ..
makeThis step builds your application and exports it as a WebAssembly module (hello-world.wasm)which is used by theatym buildcommand in the next step. This is a great step to test and debug the module if you have wabt or similar tools installed.
3. Build the Container
Return to the project root directory and build the Atym container:
cd ..
atym buildBy default,atym buildwill look forbuild.yamlin the top-level of your project to understand how to build your container.
If everything went well, you've just built your first Atym container! The next step is to deploy our container to our Atym-enabled device.
Deploying Your First Atym Application1. First, push your container to the Atym Hub:
atym push hello-worldThis command essentially pushes your container to a docker-like registry in the Atym Hub. In fact, Atym containers are oci-compliant and can be pushed to any registry that you'd put docker containers into!
2. Deploy the Container to your Device
Next, deploy the container to your device by running the following command, where the first hello-world is the container name on your device, and the second is the name in the hub:
atym run hello-world -n <deviceId>YourdeviceIdcan be found by simply runningatym list devices, and then copying the appropriatedeviceIdfor your device.
3. Verify the deployment worked
The Atym Hub will then deploy your container to the device, and you should see the following success message in your console:
atym:~$ Client connected.
_ _________ ___ ______________ ______ ____ __
| | /| / / __/ _ )/ _ | / __/ __/ __/ |/ / _ )/ /\ \/ /
| |/ |/ / _// _ / __ |_\ \_\ \/ _// /|_/ / _ / /__\ /
|__/|__/___/____/_/ |_/___/___/___/_/ /_/____/____//_/
powered by Atym
Update v4Congratulations! You have successfully built and deployed your first Atym container.
Next StepsTo continue your journey, head to the Atym Docs site to learn how to learn more about Atym, including checking out our in-depth developer guide, references, and much more to get you up and running quickly with Atym development. Once done with that, feel free to check out any of the other projects found on our Hackster.io page, or contribute your own!










Comments