|
||
---|---|---|
docs/runtimeverification-wasm-semantics | ||
ggreganov-llama.cpp | ||
scripts | ||
src | ||
Cargo.lock | ||
Cargo.toml | ||
cosmo-overlay.nix | ||
justfile | ||
README.md | ||
shell.nix | ||
vespa-cli-overlay.nix |
Nexus
Welcome to the Nexus! This README will guide you through setting up your development environment and getting started with the project.
Prerequisites
Before you begin, make sure you have the following installed on your system:
- Nix
- Git
- Rust
- wasm32-unknown-unknown target
- OpenSSL 1.1
- Cosmoonic
Getting Started
- Clone the repository and navigate to the project directory:
git clone https://github.com/plurigrid/nexus.git
cd nexus
- Start nix shell and run the following command to install all required dependencies:
nix-shell
make all
This will automatically check for and install Rust, wasm32-unknown-unknown target, OpenSSL 1.1, and Cosmo CLI if they are not already installed on your system.
- Create a new actor using Cosmo CLI:
cosmo new actor <your_project_name>
Replace <your_project_name>
with your desired project name.
- Navigate to your newly created project directory:
cd <your_project_name>
- Edit
src/lib.rs
file in your favorite text editor.
The default file content looks like this:
use wasmbus_rpc::actor::prelude::*;
use wasmcloud_interface_httpserver::{HttpRequest, HttpResponse, HttpServer, HttpServerReceiver};
#[derive(Debug, Default, Actor, HealthResponder)]
#[services(Actor, HttpServer)]
struct <your_project_name>Actor {}
/// Implementation of the HttpServer capability contract
#[async_trait]
impl HttpServer for <your_project_name>Actor {
async fn handle_request(&self, _ctx: &Context, _req: &HttpRequest) -> RpcResult<HttpResponse> {
Ok(HttpResponse::ok("message"))
}
}
You can modify the file to accommodate more text like this:
use wasmbus_rpc::actor::prelude::*;
use wasmcloud_interface_httpserver::{HttpRequest, HttpResponse, HttpServer, HttpServerReceiver};
#[derive(Debug, Default, Actor, HealthResponder)]
#[services(Actor, HttpServer)]
struct <your_project_name>Actor {}
/// Implementation of the HTTP server capability
#[async_trait]
impl HttpServer for <your_project_name>Actor {
async fn handle_request(&self, _ctx: &Context, _req: &HttpRequest) -> RpcResult<HttpResponse> {
let message: &str = r#"message"#;
Ok(HttpResponse::ok(message))
}
}
Launching the Project
- Login to Cosmonic:
cosmo login
- Build and sign your actor:
cosmo build
- Start your wasmCloud host:
cosmo up
- Launch the actor using Cosmo CLI:
cosmo launch
-
Navigate to Cosmonic App and sign in with your account.
-
In the Logic view, you should see the new actor you just launched.
-
To make your actor accessible from the web, launch a new provider for an HTTP server with the following OCI URL:
cosmonic.azurecr.io/httpserver_wormhole:0.5.3
. Give the link a name, and note that the HTTP server must be launched on a Cosmonic Manager resource. -
Once the HTTP server is launched, link it to your actor.
-
Launch a wormhole and connect it to your actor link (the HTTP server and the actor).
-
Your actor should now be accessible at the domain of the wormhole followed by
.cosmonic.app
. For example:https://white-morning-5041.cosmonic.app
.
Now you can access your project from any web browser using the provided URL!
You're all set! You can start building your project and explore the Nexus repository. Happy coding!