Skip to content

Commit

Permalink
📦️ Create a release: first release 0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
k33g committed Nov 16, 2023
1 parent 258a5be commit 657b32d
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 57 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
simplism
simplism.tar.gz
my-projects
hello
target
*.code-workspace

Expand Down
134 changes: 87 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,52 @@
## 🚀 Getting started

### Install simplism
### Install Simplism

```bash
SIMPLISM_DISTRO="Linux_arm64.tar"
SIMPLISM_DISTRO="Linux_arm64.tar" # 👀 https://github.com/bots-garden/simplism/releases
VERSION="0.0.0"
wget https://github.com/bots-garden/simplism/releases/download/v${VERSION}/simplism_${SIMPLISM_DISTRO}.tar.gz -O simplism.tar.gz
tar -xf simplism.tar.gz -C /usr/bin
rm simplism.tar.gz
simplism version
```

### Generate a (GoLang) wasm plug-in

```bash
simplism generate golang hello ./

# hello
# ├── go.mod
# ├── main.go
# └── README.md
```

#### Build the wasm plug-in
> you can follow the instructions into the `hello/README.md` file
## How is Simplism developed?

Simplism is developed in Go with **[Wazero](https://wazero.io/)**[^1] as the Wasm runtime and **[Extism](https://extism.org/)**[^2], which offers a Wazero-based Go SDK and a Wasm plugin system.

### Write an Extism plug-in

- Let's have a look at the official Extism documentation https://extism.org/docs/category/write-a-plug-in
- Look into the `samples` directory of this repository:
```bash
samples
├── golang
│ ├── hello-plugin
│ └── simple-plugin
└── rustlang
├── hello-plugin
└── simple-plugin
```

>**important**: you can write Extism plug-ins with Go, Rust, AssemblyScript, Zig, C, Haskell and JavaScript

### Ready to use environments

- [🍊 Open it with Gitpod](https://gitpod.io/#https://github.com/bots-garden/simplism)
- [🐳 Open it with Docker Dev Environment (**✋ arm version**)](https://open.docker.com/dashboard/dev-envs?url=https://github.com/bots-garden/simplism/tree/main)
- Prerequisites:
- https://docs.docker.com/desktop/dev-environments/create-dev-env/#prerequisites
- [Visual Studio Code Remote Containers Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
```bash
cd hello
tinygo build -scheduler=none --no-debug \
-o hello.wasm \
-target wasi main.go
```

## Build Simplism
#### Serve the wasm plug-in

```bash
go build
./simplism version
simplism listen \
hello.wasm handle --http-port 8080 --log-level info
```

### Prerquisites
#### Query the wasm plug-in:

> 🚧 work in progress
```bash
curl http://localhost:8080/hello/world \
-H 'content-type: application/json; charset=utf-8' \
-d '{"firstName":"Bob","lastName":"Morane"}'
```

## Run Simplism

Expand Down Expand Up @@ -95,25 +90,29 @@ Flags for listen command:
> **Examples**:
```bash
./simplism listen ./samples/golang/simple-plugin/simple.wasm say_hello
simplism listen ./samples/golang/simple-plugin/simple.wasm say_hello
```

```bash
./simplism listen ./samples/golang/hello-plugin/simple.wasm say_hello \
--http-port 9090 \
--log-level info \
--allow-hosts '["*","*.google.com"]' \
--config '{"message":"👋 hello world 🌍"}' \
--allow-paths '{"data":"/mnt"}'
simplism listen ./samples/golang/hello-plugin/simple.wasm say_hello \
--http-port 9090 \
--log-level info \
--allow-hosts '["*","*.google.com"]' \
--config '{"message":"👋 hello world 🌍"}' \
--allow-paths '{"data":"/mnt"}'
```

## Generate Extism plug-ins for Simplism
## Generate Extism plug-in projects for Simplism

You can use **Simplism** to generate a project skeleton of an **Extism** plug-in with the following languages:

- Golang
- Rustlang

You can use **Simplism** to generate a project skeleton of an **Extism** plug-in:
### Generate a Golang project

> Generate a **Golang** project
```bash
./simplism generate golang hello my-projects
simplism generate golang hello my-projects
```
This command will create this tree structure:
```bash
Expand All @@ -124,9 +123,10 @@ This command will create this tree structure:
│ │ └── README.md
```

> Generate a **Rustlang** project
### Generate a Rustlang project

```bash
./simplism generate rustlang hello my-projects
simplism generate rustlang hello my-projects
```
This command will create this tree structure:
```bash
Expand All @@ -140,6 +140,46 @@ This command will create this tree structure:

✋ more languages to come very soon

## How is Simplism developed?

Simplism is developed in Go with **[Wazero](https://wazero.io/)**[^1] as the Wasm runtime and **[Extism](https://extism.org/)**[^2], which offers a Wazero-based Go SDK and a Wasm plugin system.

### Prerequisites
> 🚧 work in progress
To develop on the Simplism project and/or create Extism plug-ins, look at `docker-dev-environment/Dockerfile`, you will find the list of the necessary softwares, libraries, tools...

### 👋 Or you can use ready to use environments

- [🍊 Open it with Gitpod](https://gitpod.io/#https://github.com/bots-garden/simplism)
- [🐳 Open it with Docker Dev Environment (**✋ arm version**)](https://open.docker.com/dashboard/dev-envs?url=https://github.com/bots-garden/simplism/tree/main)
- Prerequisites:
- https://docs.docker.com/desktop/dev-environments/create-dev-env/#prerequisites
- [Visual Studio Code Remote Containers Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)


### Build Simplism

```bash
go build
./simplism version
```

### Write an Extism plug-in

- Let's have a look at the official Extism documentation https://extism.org/docs/category/write-a-plug-in
- Look into the `samples` directory of this repository:
```bash
samples
├── golang
│ ├── hello-plugin
│ └── simple-plugin
└── rustlang
├── hello-plugin
└── simple-plugin
```

>**important**: you can write Extism plug-ins with Go, Rust, AssemblyScript, Zig, C, Haskell and JavaScript

[^1]: Wazero is a project from **[Tetrate](https://tetrate.io/)**
[^2]: Extism is a project from **[Dylibso](https://dylibso.com/)**
Expand Down
12 changes: 6 additions & 6 deletions generators/go-readme.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# <name>

> Build the wasm plugin:
> Build the wasm plug-in:
```bash
tinygo build -scheduler=none --no-debug \
-o <name>.wasm \
-target wasi main.go
-o <name>.wasm \
-target wasi main.go
```

> Serve the wasm plugin with Simplism:
> Serve the wasm plug-in with Simplism:
```bash
./simplism listen \
simplism listen \
<name>.wasm handle --http-port 8080 --log-level info
```

> Query the wasm plugin:
> Query the wasm plug-in:
```bash
curl http://localhost:8080/hello/world \
-H 'content-type: application/json; charset=utf-8' \
Expand Down
8 changes: 4 additions & 4 deletions generators/rust-readme.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# <name>

> Build the wasm plugin:
> Build the wasm plug-in:
```bash
cargo clean
cargo build --release --target wasm32-wasi
```

> Serve the wasm plugin with Simplism:
> Serve the wasm plug-in with Simplism:
```bash
./simplism listen \
simplism listen \
./target/wasm32-wasi/release/<name>.wasm handle --http-port 8080 --log-level info
```

> Query the wasm plugin:
> Query the wasm plug-in:
```bash
curl http://localhost:8080/hello/world \
-H 'content-type: application/json; charset=utf-8' \
Expand Down

0 comments on commit 657b32d

Please sign in to comment.