Skip to content

Commit a9fdd31

Browse files
committed
🌺 gardening modules samples
1 parent 964aa3e commit a9fdd31

20 files changed

+63
-92
lines changed

.idea/webResources.xml

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wasm_modules/capsule-redis/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
capsule
2+
dump.rdb

wasm_modules/capsule-redis/README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Capsule Redis
22

3-
This wasm module is used by the `cli` mode
3+
This wasm module is used by the `cli` mode. You need to start a Redis server (`redis-server`)
44

55
```bash
6-
#!/bin/bash
7-
REDIS_ADDR="localhost:6379" REDIS_PWD="" go run main.go \
8-
-wasm=../wasm_modules/capsule-redis/hello.wasm \
6+
REDIS_ADDR="localhost:6379" REDIS_PWD="" ./capsule \
7+
-wasm=./hello.wasm \
98
-mode=cli
109
```

wasm_modules/capsule-redis/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ module github.com/bots-garden/capsule/wasm_modules/capsule-redis
22

33
go 1.18
44

5-
require github.com/bots-garden/capsule/capsulemodule v0.0.0-20220811130424-72fd5964059b
5+
require github.com/bots-garden/capsule/capsulemodule v0.0.0-20220815084835-9a0b98b22e4a
66

7-
require github.com/bots-garden/capsule/capsulelauncher v0.0.0-20220730154229-17372954e5a4 // indirect
7+
require github.com/bots-garden/capsule v0.0.0-20220815052111-84fb610d29f3 // indirect

wasm_modules/capsule-redis/go.sum

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
github.com/bots-garden/capsule/capsulelauncher v0.0.0-20220730154229-17372954e5a4 h1:jPl+aFqpmLMX3RYynGmw4l8juUo6XH2r3pJ0Cjm0qFo=
2-
github.com/bots-garden/capsule/capsulelauncher v0.0.0-20220730154229-17372954e5a4/go.mod h1:At1Ce+IGheweU8baD/ZvD0DS64O7fpNZzrXFuQjDO8I=
3-
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220811130424-72fd5964059b h1:7b6MN0FYPxwb47wxHF5bf+NhYbmHY6oVeLgYXxFvIKI=
4-
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220811130424-72fd5964059b/go.mod h1:qZelwEJdyedRkb15knTl7rf1uY2skrL6GiiXhVXJ9qE=
1+
github.com/bots-garden/capsule v0.0.0-20220815052111-84fb610d29f3 h1:jd6GhVtU6hJh2YhTOal46CxbSfGALQOw+QdwC4N/7eg=
2+
github.com/bots-garden/capsule v0.0.0-20220815052111-84fb610d29f3/go.mod h1:PBhXY24j6vjuYghjEt+9mXzDb2ZwD9m9PAh9e6FTXck=
3+
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220815084835-9a0b98b22e4a h1:eGcBQabgdwqG7oVjGJyqYYzJ7yf3eyRHniJROsBplQ0=
4+
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220815084835-9a0b98b22e4a/go.mod h1:tu9DYBPXGSfiDaCN1opAFZZ3FFt3TVFH5jkYnPypY64=

wasm_modules/capsule-redis/refresh_package.sh

-12
This file was deleted.

wasm_modules/capsule-redis/run-cli-test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
cd ../../capsulelauncher
2+
cd ../../capsule-launcher
33
REDIS_ADDR="localhost:6379" \
44
REDIS_PWD="" \
55
go run main.go \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
capsule

wasm_modules/capsules-couchbase/README.md

+10-24
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,29 @@ cd http-module
3535
### CLI version
3636

3737
This wasm module is used by the `cli` mode of the capsule launcher:
38-
```bash
39-
cd cli-module
40-
./run-cli-test.sh
41-
```
4238

43-
> source code of `run-cli-test.sh`
4439
```bash
45-
cd ../../../capsulelauncher
4640
COUCHBASE_CLUSTER="couchbase://localhost" \
4741
COUCHBASE_USER="admin" \
4842
COUCHBASE_PWD="ilovepandas" \
4943
COUCHBASE_BUCKET="wasm-data" \
50-
go run main.go \
51-
-wasm=../wasm_modules/capsules-couchbase/cli-module/hello.wasm \
44+
./capsule \
45+
-wasm=./cli-module/hello.wasm \
5246
-mode=cli
5347
```
5448

5549
### HTTP version
5650

5751
This wasm module is used by the `http` mode of the capsule launcher:
5852
```bash
59-
cd http-module
60-
./run-htt-test.sh
53+
COUCHBASE_CLUSTER="couchbase://localhost" \
54+
COUCHBASE_USER="admin" \
55+
COUCHBASE_PWD="ilovepandas" \
56+
COUCHBASE_BUCKET="wasm-data" \
57+
./capsule \
58+
-wasm=./http-module/hello.wasm \
59+
-mode=http \
60+
-httpPort=7070
6161
```
6262

6363
Then launch an HTTP request:
@@ -72,18 +72,4 @@ You should get something like this:
7272
[{"docs":{"name":"this is an info","type":"info"}},{"docs":{"name":"this is another info","type":"info"}},{"docs":{"name":"👋 hello world 🌍","type":"message"}},{"docs":{"name":"👋 greetings 🎉","type":"message"}}]
7373
```
7474

75-
> source code of `run-htt-test.sh`
76-
```bash
77-
#!/bin/bash
78-
cd ../../../capsulelauncher
79-
COUCHBASE_CLUSTER="couchbase://localhost" \
80-
COUCHBASE_USER="admin" \
81-
COUCHBASE_PWD="ilovepandas" \
82-
COUCHBASE_BUCKET="wasm-data" \
83-
go run main.go \
84-
-wasm=../wasm_modules/capsules-couchbase/http-module/hello.wasm \
85-
-mode=http \
86-
-httpPort=7070
87-
```
88-
8975

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
#tinygo build -o hello.wasm -scheduler=none --no-debug -target wasi ./hello.go
32
tinygo build -o hello.wasm -scheduler=none -target wasi ./hello.go
43

54
ls -lh *.wasm

wasm_modules/capsules-couchbase/cli-module/go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ module github.com/bots-garden/capsule/wasm_modules/capsule-couchbase/cli-module
33
go 1.18
44

55
require (
6-
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220730132531-d288ee6b97a4
7-
github.com/tidwall/gjson v1.14.1
6+
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220815092415-964aa3e0fdc2
7+
github.com/tidwall/gjson v1.14.2
88
)
99

1010
require (
11-
github.com/bots-garden/capsule/capsulelauncher v0.0.0-20220730130303-2f1fc7ff9b42 // indirect
11+
github.com/bots-garden/capsule v0.0.0-20220815052111-84fb610d29f3 // indirect
1212
github.com/tidwall/match v1.1.1 // indirect
1313
github.com/tidwall/pretty v1.2.0 // indirect
1414
)

wasm_modules/capsules-couchbase/cli-module/go.sum

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
github.com/bots-garden/capsule/capsulelauncher v0.0.0-20220730130303-2f1fc7ff9b42 h1:kKuAszSBijZengtPIVapkk049SXE5wzklcP64v42zHw=
2-
github.com/bots-garden/capsule/capsulelauncher v0.0.0-20220730130303-2f1fc7ff9b42/go.mod h1:At1Ce+IGheweU8baD/ZvD0DS64O7fpNZzrXFuQjDO8I=
3-
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220730132531-d288ee6b97a4 h1:px42oVTpc/FntKs4fCcbfzLk7z6PorlUTlxRivd/Tvo=
4-
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220730132531-d288ee6b97a4/go.mod h1:CFuO1UNMvehwFZImG7hyN8rEpX+rE8fSazyvUNaueEQ=
5-
github.com/tidwall/gjson v1.14.1 h1:iymTbGkQBhveq21bEvAQ81I0LEBork8BFe1CUZXdyuo=
6-
github.com/tidwall/gjson v1.14.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
1+
github.com/bots-garden/capsule v0.0.0-20220815052111-84fb610d29f3 h1:jd6GhVtU6hJh2YhTOal46CxbSfGALQOw+QdwC4N/7eg=
2+
github.com/bots-garden/capsule v0.0.0-20220815052111-84fb610d29f3/go.mod h1:PBhXY24j6vjuYghjEt+9mXzDb2ZwD9m9PAh9e6FTXck=
3+
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220815092415-964aa3e0fdc2 h1:SfgCTdHbmOkcrxlgvdjJiQaue9LsxAW6doCGOI2wxBE=
4+
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220815092415-964aa3e0fdc2/go.mod h1:tu9DYBPXGSfiDaCN1opAFZZ3FFt3TVFH5jkYnPypY64=
5+
github.com/tidwall/gjson v1.14.2 h1:6BBkirS0rAHjumnjHF6qgy5d2YAJ1TLIaFE2lzfOLqo=
6+
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
77
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
88
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
99
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=

wasm_modules/capsules-couchbase/cli-module/refresh_package.sh

-12
This file was deleted.

wasm_modules/capsules-couchbase/cli-module/run-cli-test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
cd ../../../capsulelauncher
2+
cd ../../../capsule-launcher
33
COUCHBASE_CLUSTER="couchbase://localhost" \
44
COUCHBASE_USER="admin" \
55
COUCHBASE_PWD="ilovepandas" \
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
#tinygo build -o hello.wasm -scheduler=none --no-debug -target wasi ./hello.go
32
tinygo build -o hello.wasm -scheduler=none -target wasi ./hello.go
43

54
ls -lh *.wasm

wasm_modules/capsules-couchbase/http-module/go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ module github.com/bots-garden/capsule/wasm_modules/capsule-couchbase/http-module
33
go 1.18
44

55
require (
6-
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220730132531-d288ee6b97a4
7-
github.com/tidwall/gjson v1.14.1
6+
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220815092415-964aa3e0fdc2
7+
github.com/tidwall/gjson v1.14.2
88
)
99

1010
require (
11-
github.com/bots-garden/capsule/capsulelauncher v0.0.0-20220730130303-2f1fc7ff9b42 // indirect
11+
github.com/bots-garden/capsule v0.0.0-20220815052111-84fb610d29f3 // indirect
1212
github.com/tidwall/match v1.1.1 // indirect
1313
github.com/tidwall/pretty v1.2.0 // indirect
1414
)

wasm_modules/capsules-couchbase/http-module/go.sum

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
github.com/bots-garden/capsule/capsulelauncher v0.0.0-20220730130303-2f1fc7ff9b42 h1:kKuAszSBijZengtPIVapkk049SXE5wzklcP64v42zHw=
2-
github.com/bots-garden/capsule/capsulelauncher v0.0.0-20220730130303-2f1fc7ff9b42/go.mod h1:At1Ce+IGheweU8baD/ZvD0DS64O7fpNZzrXFuQjDO8I=
3-
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220730132531-d288ee6b97a4 h1:px42oVTpc/FntKs4fCcbfzLk7z6PorlUTlxRivd/Tvo=
4-
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220730132531-d288ee6b97a4/go.mod h1:CFuO1UNMvehwFZImG7hyN8rEpX+rE8fSazyvUNaueEQ=
5-
github.com/tidwall/gjson v1.14.1 h1:iymTbGkQBhveq21bEvAQ81I0LEBork8BFe1CUZXdyuo=
6-
github.com/tidwall/gjson v1.14.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
1+
github.com/bots-garden/capsule v0.0.0-20220815052111-84fb610d29f3 h1:jd6GhVtU6hJh2YhTOal46CxbSfGALQOw+QdwC4N/7eg=
2+
github.com/bots-garden/capsule v0.0.0-20220815052111-84fb610d29f3/go.mod h1:PBhXY24j6vjuYghjEt+9mXzDb2ZwD9m9PAh9e6FTXck=
3+
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220815092415-964aa3e0fdc2 h1:SfgCTdHbmOkcrxlgvdjJiQaue9LsxAW6doCGOI2wxBE=
4+
github.com/bots-garden/capsule/capsulemodule v0.0.0-20220815092415-964aa3e0fdc2/go.mod h1:tu9DYBPXGSfiDaCN1opAFZZ3FFt3TVFH5jkYnPypY64=
5+
github.com/tidwall/gjson v1.14.2 h1:6BBkirS0rAHjumnjHF6qgy5d2YAJ1TLIaFE2lzfOLqo=
6+
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
77
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
88
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
99
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=

wasm_modules/capsules-couchbase/http-module/refresh_package.sh

-12
This file was deleted.

wasm_modules/registry-demo/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
capsule
2+
cc
3+
capsule-registry

wasm_modules/registry-demo/capsule

-16.5 MB
Binary file not shown.

0 commit comments

Comments
 (0)