Introduction to Atmo
When building modern applications for the cloud, you want to be sure that what you're creating has a secure foundation that will scale with your product. Atmo is a server-side runtime that uses WebAssembly to execute your code securely and with a high level of performance. Atmo is designed to be easy for developers to get started with, and equally easy to scale up to handle large amounts of traffic.
We've built Atmo to be compatible with a wide variety of cloud providers, and Civo K3s is perfectly suited to get a simple and powerful cluster of Atmo instances up and running quickly.
Installing Atmo on a Civo cluster
With the Civo application marketplace, installing Atmo to deploy your WebAssembly-based applications is very straightforward. To start, you will need the the Civo CLI tool set up on your machine. You can then proceed to create a K3s cluster and install Atmo:
civo kubernetes create atmo-demo-cluster --nodes=2 --applications=Atmo
This will launch Atmo in wait
mode, which means it will wait for you to upload an application bundle. To create one, install Suborbital's subo
CLI tool and try out the example app, important-api.
# First, install subo
> curl -Ls https://subo.suborbital.dev | sh
# Next, clone the example project
> git clone git@github.com:suborbital/important-api.git
# Finally, build the application into a deployable bundle
> cd important-api
> subo build .
Preparing your application
A file called runnables.wasm.zip
will be created. This is called an Atmo bundle, and it contains everything your application needs to work. Your code is compiled into several small WebAssembly modules, which are packaged into the bundle alongside Directive.yaml
which describes how your application operates. For all of the details about creating Atmo applications, check out the Atmo documentation.
Now that you have an application bundle, you can upload it to your K3s cluster and Atmo will use it to run an API server as described in the Directive. You'll first need to download your cluster's kubeconfig file and move it to $HOME/.kube/
so that kubectl
can connect to your K3s cluster. If you need help in doing that, follow the "Downloading the cluster's configuration" section of this guide.
Once you have your cluster's configuration file correctly stored, you can:
# List pods and take note of Atmo's pod name
> kubectl get pods -n suborbital
# Upload the application bundle
> kubectl cp ./runnables.wasm.zip <atmo pod name>:/home/atmo/ -n suborbital
Atmo will start up, and you can verify your application is running using the logs
command:
> kubectl logs <atmo pod name> atmo -f -n suborbital
And you can get the publicly accessible IP address:
> kubectl get services -n suborbital
Conclusion
Now we have a working Atmo cluster executing an application compiled to WebAssembly! This is an incredibly easy way to deploy secure applications written in various languages such as Rust, TypeScript, and Swift. The Directive is a new format for building applications by declaratively chaining together functions compiled to WebAssembly. If you'd like to learn more, check out the Suborbital website and join the Suborbital Discord server.
We think the pairing of Atmo and K3s is a perfect match that combines the newest generation of cloud native applications with the newest generation of lightweight powerful infrastructure. If you try out this guide, let Civo know on Twitter or in the Civo Slack community.