Skip to content

Commit c710231

Browse files
committed
📦 updates modules for v0.2.7
1 parent 2753339 commit c710231

12 files changed

+125
-34
lines changed

README.md

+98-20
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,10 @@
55
<img src="./logos/capsule-logo-readme.png" alt="capsule-logo.png" width="10%" height="10%"/>
66

77
# Capsule: the nano (wasm) functions runner
8-
> - 🖐 I'm learning Go
9-
> - Issues: https://github.com/bots-garden/capsule/issues
10-
> - Last release: `v0.2.6 🐝 [Bee]`
11-
> - Dev release: `v0.2.7 🦚 [peacock][dev]` *🚧 in progress*
12-
13-
## What's new
148

15-
- `v0.2.6`: Wazero: updates to `1.0.0-pre.2` by [@codefromthecrypt](https://github.com/codefromthecrypt) + a logo
16-
- `v0.2.5`: Add MQTT support by [@py4mac](https://github.com/py4mac) with `MqttPublish` & `MqttPublish`
17-
- `v0.2.4`: Add 2 wasm helper functions `flatjson.StrToMap` and `flatjson.MapToStr`
18-
- `v0.2.3`: NATS support, 2 new functions: `NatsReply` and `NatsConnectRequest`
19-
- `v0.2.2`: like `0.2.1` with fixed modules dependencies, and tag name start with a `v`
20-
- `0.2.1`: NATS support (1st stage) `OnNatsMessage`, `NatsPublish`, `NatsConnectPublish`, `NatsConnectPublish`, `NatsGetSubject`, `NatsGetServer`
21-
- `0.2.0`: `OnLoad` & `OnExit` functions + Memory cache host functions (`MemorySet`, `MemoryGet`, `MemoryKeys`)
22-
- `0.1.9`: Add `Request` and `Response` types (for the Handle function)
23-
- `0.1.8`: Redis host functions: add the KEYS command (`RedisKeys(pattern string)`)
9+
> - Issues: https://github.com/bots-garden/capsule/issues
10+
> - Last release: `v0.2.7 🦚 [peacock]`
11+
> - Dev release: `v0.2.8 TBD` *🚧 in progress*
2412
2513
## What is **Capsule**?
2614

@@ -31,13 +19,49 @@
3119
- Serving a function of a wasm module through NATS (the **"NATS mode"**), in this case **Capsule** is used as a NATS subscriber and can reply on a subject(topic)
3220
- Serving a function of a wasm module through MQTT (the **"MQTT mode"**), in this case **Capsule** is used as a MQTT subscriber and can reply on a subject(topic)
3321

34-
> 🖐 **The functions are developed with GoLang and compiled to wasm with TinyGo**
35-
36-
📦 Before executing or running a function, you need to download the last release of **Capsule**: https://github.com/bots-garden/capsule/releases/tag/v0.2.6 (`v0.2.6 🐝 [Bee]`)
37-
3822
> - **Capsule** is developed with GoLang and thanks to the 💜 **[Wazero](https://github.com/tetratelabs/wazero)** project
3923
> - The wasm modules are developed in GoLang and compiled with TinyGo (with the WASI specification)
4024
25+
## Installing Capsule
26+
27+
Before executing or running a function, you need to install the last release of **Capsule**:
28+
29+
```bash
30+
CAPSULE_VERSION="v0.2.7"
31+
wget -O - https://raw.githubusercontent.com/bots-garden/capsule/${CAPSULE_VERSION}/install-capsule-launcher.sh| bash
32+
# To get the developement version you can use CAPSULE_VERSION="main"
33+
```
34+
> The script will install capsule in `$HOME/.local/bin`
35+
36+
Then you can serve a wasm function like this:
37+
38+
```bash
39+
MESSAGE="👋 Hello World 🌍" capsule \
40+
-wasm=./app/index.wasm \
41+
-mode=http \
42+
-httpPort=8080
43+
```
44+
45+
> You can download the appropriate release of **Capsule** here: https://github.com/bots-garden/capsule/releases/tag/v0.2.7 (`v0.2.7 🦚 [peacock]`)
46+
47+
### Using the Capsule Docker image
48+
> The documentation is a wip 🚧
49+
50+
A "scratch" Docker image of Capsule exists on https://hub.docker.com/r/k33g/capsule-launcher/tags. You can find more details on the [capsule-docker-image](https://github.com/bots-garden/capsule-docker-image) project.
51+
This image will be used to deploy Capsule to CaaS or Kubernetes. You can use it directly to run a wasm function without installing Capsule:
52+
53+
```bash
54+
docker run \
55+
-p 8080:8080 \
56+
-e MESSAGE="👋 Hello World 🌍" \
57+
-v $(pwd):/app --rm k33g/capsule-launcher:0.2.6 \
58+
/capsule \
59+
-wasm=./app/index.wasm \
60+
-mode=http \
61+
-httpPort=8080
62+
```
63+
64+
4165
👋 You will find some **running examples** with these projects:
4266
- https://github.com/bots-garden/capsule-launcher-demo
4367
- https://github.com/bots-garden/capsule-hello-universe
@@ -46,8 +70,62 @@
4670
> - https://github.com/bots-garden/capsule-samples
4771
> - https://github.com/bots-garden/capsule-on-fly-dot-io
4872
49-
## Blog posts
73+
## Tooling
74+
> The documentation is a wip 🚧
5075
76+
To write and build wasm function for Capsule, you need to install GoLang and TinyGo. Otherwise, you can use the [capsule-function-builder](https://github.com/bots-garden/capsule-function-builder) project. It provides a very simple CLI, named **capsule-builder** or **cabu** that uses a Docker image with all the necessary resources (Golang and TinyGo compilers).
77+
78+
### Install Capsule Builder
79+
80+
```bash
81+
CAPSULE_BUILDER_VERSION="v0.0.0"
82+
wget -O - https://raw.githubusercontent.com/bots-garden/capsule-function-builder/${CAPSULE_BUILDER_VERSION}/install-capsule-builder.sh | bash
83+
```
84+
85+
Then you can generate a new project from a template:
86+
87+
```bash
88+
# template name: `service-get`
89+
# function project name `hello-world`
90+
cabu generate service-get hello-world
91+
```
92+
93+
94+
Then, build it easily:
95+
96+
```bash
97+
cd hello-world
98+
cabu build . hello-world.go hello-world.wasm
99+
```
100+
101+
And, finally, serve it:
102+
103+
```bash
104+
capsule \
105+
-wasm=./hello-world.wasm \
106+
-mode=http \
107+
-httpPort=8080
108+
```
109+
110+
## What's new
111+
112+
- `v0.2.7`:
113+
- The FaaS components are externalized, now, this project is **only** for the **Capsule Runner**
114+
- "Scratch" Docker image (18.5M) to easily use and deploy the Capsule Runner (https://github.com/bots-garden/capsule-docker-image)
115+
- **cabu** (or **capsule-builder**) (https://github.com/bots-garden/capsule-function-builder): a CLI using a specific Docker image allowing:
116+
- the creation of a wasm function project (from templates)
117+
- the build of the wasm function, without installing anything (TinyGo is embedded in the image) (https://github.com/bots-garden/capsule-function-builder)
118+
>- `v0.2.6`: Wazero: updates to `1.0.0-pre.2` by [@codefromthecrypt](https://github.com/codefromthecrypt) + a logo
119+
>- `v0.2.5`: Add MQTT support by [@py4mac](https://github.com/py4mac) with `MqttPublish` & `MqttPublish`
120+
>- `v0.2.4`: Add 2 wasm helper functions `flatjson.StrToMap` and `flatjson.MapToStr`
121+
>- `v0.2.3`: NATS support, 2 new functions: `NatsReply` and `NatsConnectRequest`
122+
>- `v0.2.2`: like `0.2.1` with fixed modules dependencies, and tag name start with a `v`
123+
>- `0.2.1`: NATS support (1st stage) `OnNatsMessage`, `NatsPublish`, `NatsConnectPublish`, `NatsConnectPublish`, `NatsGetSubject`, `NatsGetServer`
124+
>- `0.2.0`: `OnLoad` & `OnExit` functions + Memory cache host functions (`MemorySet`, `MemoryGet`, `MemoryKeys`)
125+
>- `0.1.9`: Add `Request` and `Response` types (for the Handle function)
126+
>- `0.1.8`: Redis host functions: add the KEYS command (`RedisKeys(pattern string)`)
127+
128+
## Blog posts
51129

52130
- [Capsule, my personal wasm multi-tools knife (part 1)](https://www.wasm.builders/k33g_org/capsule-my-personal-wasm-multi-tools-knife-part-1-3eoa)
53131
- [Capsule, my personal wasm FaaS (part 2)](https://www.wasm.builders/k33g_org/capsule-my-personal-wasm-faas-part-2-140k)

RELEASE.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- `./commons/version.go`
55
- `/README.md`
66
- `install-capsule-launcher.sh`
7+
- `sudo.install-capsule-launcher.sh`
78
- 🖐 Check **every dependency** for every module
89
- Update and run `update-modules-for-release.sh`
910
- On GitHub: create a release + a tag (`vN.N.N`)

capsule-launcher/go.mod

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ replace (
99
)
1010

1111
require (
12-
github.com/bots-garden/capsule/commons v0.2.5
13-
github.com/bots-garden/capsule/mqttconn v0.0.0-20220925075755-ccaa11dca703
14-
github.com/bots-garden/capsule/natsconn v0.0.0-20220925075755-ccaa11dca703
12+
github.com/bots-garden/capsule/commons v0.2.6
13+
github.com/bots-garden/capsule/mqttconn v0.0.0-20221008083118-2753339a260f
14+
github.com/bots-garden/capsule/natsconn v0.0.0-20221008083118-2753339a260f
1515
github.com/couchbase/gocb/v2 v2.5.3
1616
github.com/eclipse/paho.mqtt.golang v1.4.1
1717
github.com/gin-gonic/gin v1.8.1
18-
github.com/go-redis/redis/v9 v9.0.0-beta.2
18+
github.com/go-redis/redis/v9 v9.0.0-beta.3
1919
github.com/go-resty/resty/v2 v2.7.0
2020
github.com/nats-io/nats.go v1.17.0
2121
github.com/shirou/gopsutil/v3 v3.22.9
@@ -50,10 +50,10 @@ require (
5050
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
5151
github.com/ugorji/go/codec v1.2.7 // indirect
5252
github.com/yusufpapurcu/wmi v1.2.2 // indirect
53-
golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be // indirect
54-
golang.org/x/net v0.0.0-20220930213112-107f3e3c3b0b // indirect
53+
golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b // indirect
54+
golang.org/x/net v0.0.0-20221004154528-8021a29435af // indirect
5555
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 // indirect
56-
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect
56+
golang.org/x/sys v0.0.0-20221006211917-84dc82d7e875 // indirect
5757
golang.org/x/text v0.3.7 // indirect
5858
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
5959
google.golang.org/protobuf v1.28.1 // indirect

capsule-launcher/go.sum

+9
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJ
3131
github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU=
3232
github.com/go-redis/redis/v9 v9.0.0-beta.2 h1:ZSr84TsnQyKMAg8gnV+oawuQezeJR11/09THcWCQzr4=
3333
github.com/go-redis/redis/v9 v9.0.0-beta.2/go.mod h1:Bldcd/M/bm9HbnNPi/LUtYBSD8ttcZYBMupwMXhdU0o=
34+
github.com/go-redis/redis/v9 v9.0.0-beta.3 h1:rkIfHaVFD8vPPfA44MTKFtRlQ6I7K3xvQwKOu+Qnh94=
35+
github.com/go-redis/redis/v9 v9.0.0-beta.3/go.mod h1:XNkosunJlFQUw/sKdZ9rMyoRFgqk9SLUv2gbKTtvWl8=
3436
github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY=
3537
github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I=
3638
github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk=
@@ -88,6 +90,7 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS
8890
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
8991
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
9092
github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q=
93+
github.com/onsi/gomega v1.20.2 h1:8uQq0zMgLEfa0vRrrBgaJF2gyW9Da9BmfGV+OyUzfkY=
9194
github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg=
9295
github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas=
9396
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
@@ -132,6 +135,8 @@ golang.org/x/crypto v0.0.0-20220924013350-4ba4fb4dd9e7 h1:WJywXQVIb56P2kAvXeMGTI
132135
golang.org/x/crypto v0.0.0-20220924013350-4ba4fb4dd9e7/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
133136
golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be h1:fmw3UbQh+nxngCAHrDCCztao/kbYFnWjoqop8dHx05A=
134137
golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
138+
golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b h1:huxqepDufQpLLIRXiVkTvnxrzJlpwmIWAObmcCcUFr0=
139+
golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
135140
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
136141
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
137142
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
@@ -140,6 +145,8 @@ golang.org/x/net v0.0.0-20220923203811-8be639271d50 h1:vKyz8L3zkd+xrMeIaBsQ/MNVP
140145
golang.org/x/net v0.0.0-20220923203811-8be639271d50/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
141146
golang.org/x/net v0.0.0-20220930213112-107f3e3c3b0b h1:uKO3Js8lXGjpjdc4J3rqs0/Ex5yDKUGfk43tTYWVLas=
142147
golang.org/x/net v0.0.0-20220930213112-107f3e3c3b0b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
148+
golang.org/x/net v0.0.0-20221004154528-8021a29435af h1:wv66FM3rLZGPdxpYL+ApnDe2HzHcTFta3z5nsc13wI4=
149+
golang.org/x/net v0.0.0-20221004154528-8021a29435af/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
143150
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
144151
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 h1:ZrnxWX62AgTKOSagEqxvb3ffipvEDX2pl7E1TdqLqIc=
145152
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -161,6 +168,8 @@ golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RA
161168
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
162169
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI=
163170
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
171+
golang.org/x/sys v0.0.0-20221006211917-84dc82d7e875 h1:AzgQNqF+FKwyQ5LbVrVqOcuuFB67N47F9+htZYH0wFM=
172+
golang.org/x/sys v0.0.0-20221006211917-84dc82d7e875/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
164173
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
165174
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
166175
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=

capsulemodule/go.mod

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ replace (
1212
github.com/bots-garden/capsule v0.2.4 => ../
1313
github.com/bots-garden/capsule v0.2.5 => ../
1414
github.com/bots-garden/capsule v0.2.6 => ../
15+
github.com/bots-garden/capsule v0.2.7 => ../
1516
)
1617

1718
replace (
@@ -20,6 +21,7 @@ replace (
2021
github.com/bots-garden/capsule/commons v0.2.4 => ../commons
2122
github.com/bots-garden/capsule/commons v0.2.5 => ../commons
2223
github.com/bots-garden/capsule/commons v0.2.6 => ../commons
24+
github.com/bots-garden/capsule/commons v0.2.7 => ../commons
2325
)
2426

25-
require github.com/bots-garden/capsule/commons v0.2.5
27+
require github.com/bots-garden/capsule/commons v0.2.6

commons/go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ replace (
88
github.com/bots-garden/capsule v0.2.4 => ../
99
github.com/bots-garden/capsule v0.2.5 => ../
1010
github.com/bots-garden/capsule v0.2.6 => ../
11+
github.com/bots-garden/capsule v0.2.7 => ../
1112
)

commons/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package commons
22

33
func CapsuleVersion() string {
4-
return "v0.2.7 🦚 [peacock][dev]"
4+
return "v0.2.7 🦚 [peacock]"
55
//next "v0.2.7 🦚 [peacock][dev]"
66
}

install-capsule-launcher.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
LAST_CAPSULE_VERSION="v0.2.6"
2+
LAST_CAPSULE_VERSION="v0.2.7"
33
echo "System: ${OSTYPE} $(uname -m)"
44

55
if [ -z "$CAPSULE_PATH" ]

recreate-tags.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
TAG="v0.2.6"
3+
TAG="v0.2.7"
44

55
git add .
66
git commit -m "📦 updates modules for ${TAG}"

remove-tags.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
TAG="v0.2.6"
3+
TAG="v0.2.7"
44

55
git tag -d ${TAG}
66
git tag -d commons/${TAG}

sudo.install-capsule-launcher.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
LAST_CAPSULE_VERSION="v0.2.6"
2+
LAST_CAPSULE_VERSION="v0.2.7"
33
echo "System: ${OSTYPE} $(uname -m)"
44

55
if [[ $1 = "help" ]]

update-modules-for-release.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
TAG="v0.2.6"
3+
TAG="v0.2.7"
44
cd commons
55
go mod edit -replace github.com/bots-garden/capsule@${TAG}=../
66

0 commit comments

Comments
 (0)