Skip to main content

1. Quickstart

Welcome to the Cosmonic quick start guide. In the next 2 minutes we will take you through getting your first Rust application running in Cosmonic using Web Assembly, wasmCloud and the power of XKCD comics. We will run this first all in the Cosmonic cloud, then we will split up where the app is running with some of it on your local machine without changing or modifying your architecture! (all in the same secure network - your constellation ✨)

1. Running your first server side Wasm application

To get started, we are going to run a simple application that serves us with random XKCD comic. Click the button below to view the manifest & deploy the application - then head back here.

Deploy XKCD Demo on Cosmonic

Awesome! You have now run your first application. You will start off in the Applications view where you can see a list of all the components that you just deployed.

This application consists of a single actor, which is a stateless, reactive component that represents the smallest unit of compute that you can create. In the future this is where you will write your business logic. This actor is connected to two capability providers, stateful providers offering services like a blob store, database, HTTP server, etc. In this case, one is there to listen for incoming HTTP requests, and another to make outbound HTTP requests to fetch XKCD comics.

The full architecture looks like this:

XKCD App Architecture

Next let's head to the Logic View to check out how this fits together in Cosmonic and access our application!

The Logic View

You can access the Logic View by navigating on the left hand side of Cosmonic, selecting the top option.

You'll see a node on the canvas for your actor, which is connected to the two capability providers. Right now, this is all running on a host in Cosmonic. A host is an instance of the wasmCloud runtime on a machine.

Logic View

You can then access your application by selecting your wormhole and clicking 'Access your Wormhole'

Access Your app

🎉 Congratulations, you have run and accessed your first server side Wasm application on Cosmonic! Next let's take a look at the power of the Cosmonic networking to see what else we can do.

2. Running the same application split between the cloud and your machine

Next we are going to see how easy it is to run the same components of an application split between hosts. One of the powerful things about Cosmonic is that your basic application architecture can be deployed to dramatically different application topologies, all without changing or modifying your architecture.

To do this, we need a second remote host. We label our remote hosts "Stargate". To set up a Stargate host on your local machine, you can install our CLI:

bash
bash -c "$(curl -fsSL https://cosmonic.sh/install.sh)"
bash
bash -c "$(curl -fsSL https://cosmonic.sh/install.sh)"

And then run up to start a Stargate host on your local machine:

bash
cosmo up
bash
cosmo up

Deploying a new version of the application

Deploying a new version of an application is as simple as updating the manifest. We have already done that for you, which you can launch from the button below

OS-specific

Note this new manifest is OS-specific, and setup for macOS currently. If you are using a different OS, you can update the hostcore.os to either windows or linux

Deploy on Cosmonic & Stargate

In the new manifest, we updated the version and specified new requirements for our XKCD Actor and the HTTP client. New wadm

And that's it! It's the same application, running in the same secure network, now communicating between two sets of totally different infrastructure with different underlying system architectures! You can still access it through the same ingress wormhole (DNS address), and it works the same way 🎉

What's next?

Next, let's turn to local development and see how easy it is to make a change with Cosmonic and have that run on any machine, still as part of the same application. Head on to Make It Your Own to learn more!