Skip to content

Commit

Permalink
Merge pull request #17 from cosmonic/wadms
Browse files Browse the repository at this point in the history
Adding wadm for hello world
  • Loading branch information
LiamRandall authored Oct 4, 2023
2 parents cea36cf + dbfc29f commit f264ea7
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ Awesome projects and source code for the [Things To Build](https://cosmonic.com/

| Deployment | Link | Topology |
| ------------- | ------------- | ------------- |
| Hello World on Cosmonic | [<img src="https://cosmonic.com/badge/deploy.svg" alt="Deploy on Cosmonic" width="400">](https://new.cosmonic.app/?yaml=https://raw.githubusercontent.com/cosmonic/awesome-cosmonic/main/hello-world/hello-cosmonic.wadm) | This example will deploy Hello World actor and HTTP Server Provider all on Cosmonic. |
| Hello World on Stargate | [<img src="https://cosmonic.com/badge/deploy.svg" alt="Deploy on Cosmonic" width="400">](https://new.cosmonic.app/?yaml=https://raw.githubusercontent.com/cosmonic/awesome-cosmonic/main/hello-world/hello-stargate.wadm) | This example will deploy Hello World on a remote stargate node, and the HTTP Server Provider on Cosmonic. In order for this manifest to work you will need at least one stargate host deployed. |
| XKCD Generator on Cosmonic | [<img src="https://cosmonic.com/badge/deploy.svg" alt="Deploy on Cosmonic" width="400">](https://new.cosmonic.app/?yaml=https://raw.githubusercontent.com/cosmonic/awesome-cosmonic/main/xkcdgenerator/xkcd-generator-cosmonic.wadm) | This example will deploy the XKCD actor, HTTP Client Provider, and HTTP Server Provider all on Cosmonic. |
| XKCD Generator on Stargate | [<img src="https://cosmonic.com/badge/deploy.svg" alt="Deploy on Cosmonic" width="400">](https://new.cosmonic.app/?yaml=https://raw.githubusercontent.com/cosmonic/awesome-cosmonic/main/xkcdgenerator/xkcd-generator-stargate.wadm) | This example will deploy the XKCD actor & HTTP Client Provider on a remote stargate node, and the HTTP Server Provider on Cosmonic. In order for this manifest to work you will need at least one stargate host deployed. |


# How does it work?
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. In the simple examples below we use [Open Application Manifest WADM Manifests](https://github.com/wasmCloud/wadm) to automatically deploy applications to Cosmonic.

Expand Down
5 changes: 5 additions & 0 deletions hello-world/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Hello world

Click on the button below to launch Hello World on Cosmonic Now:

[<img src="https://cosmonic.com/badge/deploy.svg" alt="Deploy on Cosmonic" width="400">](https://new.cosmonic.app/?yaml=https://raw.githubusercontent.com/cosmonic/awesome-cosmonic/main/hello-world/hello-cosmonic.wadm)

This actor is the "Hello, World" of Cosmonic applications. It uses a single capability, HTTP server, and returns a string as a response. This project is actually a template, and if you'd like to try it for yourself, install the [cosmo cli](https://cosmonic.com/docs/getting-started/quickstart) and run:

```
cosmo new actor --git https://github.com/cosmonic/things-to-build --path hello-world/rust hello
cosmo launch -p hello
```

38 changes: 38 additions & 0 deletions hello-world/hello-cosmonic.wadm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is a full example of how to run the hello actor exposed with an HTTP server on Cosmonic.
# This example leverages WADM running: https://github.com/wasmCloud/wadm/tree/main/wadm.
#
# All components are started on Cosmonic. See other examples for different scenarios.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: hello
annotations:
version: v0.0.1-cosmonic
description: "Cosmonic Hello World Example"
spec:
components:
- name: hello
type: actor
properties:
image: wasmcloud.azurecr.io/hello:0.1.7
traits:
- type: spreadscaler
properties:
replicas: 1
- type: linkdef
properties:
target: httpserver
- name: httpserver
properties:
contract: wasmcloud:httpserver
image: cosmonic.azurecr.io/httpserver_wormhole:0.5.4
traits:
- properties:
replicas: 1
spread:
- name: oncosmonic
requirements:
cosmonic_managed: 'true'
type: spreadscaler
type: capability
44 changes: 44 additions & 0 deletions hello-world/hello-stargate.wadm
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This is a full example of how to run the hello actor exposed with an HTTP server on Cosmonic.
# This example leverages WADM running: https://github.com/wasmCloud/wadm/tree/main/wadm.
#
# This example starts a webserver on Cosmonic and runs the hello world on a remote host.
# See other examples for different scenarios.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: hello
annotations:
version: v0.0.1-stargate
description: "Cosmonic Hello World Example"
spec:
components:
- name: hello
type: actor
properties:
image: wasmcloud.azurecr.io/hello:0.1.7
traits:
- properties:
replicas: 1
spread:
- name: stargate
requirements:
# hostcore.os: macos
stargate: 'true'
type: spreadscaler
- properties:
target: httpserver
type: linkdef
- name: httpserver
properties:
contract: wasmcloud:httpserver
image: cosmonic.azurecr.io/httpserver_wormhole:0.5.4
traits:
- properties:
replicas: 1
spread:
- name: oncosmonic
requirements:
cosmonic_managed: 'true'
type: spreadscaler
type: capability

0 comments on commit f264ea7

Please sign in to comment.