mirror of
https://github.com/fluencelabs/examples
synced 2024-12-12 14:45:33 +00:00
Merge remote-tracking branch 'origin/main' into js-unit-tests
This commit is contained in:
commit
90ac9a62c3
@ -12,7 +12,7 @@ In this example, we develop an adapter for the Ceramic [CLI API](https://develop
|
||||
|
||||
Our adapter service mounts the Ceramic CLI with the [MountedBinaryResult](https://doc.fluence.dev/docs/knowledge_aquamarine/marine/marine-rs-sdk#mountedbinaryresult) interface requiring the availability of [Ceramic tools](https://developers.ceramic.network/build/cli/installation/) as a sidecar. In addition, a limited Ceramic HTTP API implementation is also available using the Marine [curl adapter](https://doc.fluence.dev/docs/tutorials_tutorials/curl-as-a-service). Since the HTTP API is limited and won't let users create streams, it is offered primarily for educational purposes, although it may be useful in scenarios where a ceramic daemon deployment is not feasible.
|
||||
|
||||
**Please note that Ceramic binary access is currently only available at Fluence's `stage` network environment (`--env stage`) with path `/usr/bin/ceramic`.**
|
||||
**Please note that Ceramic binary access is currently only available at Fluence's `stage` network environment (`aqua env stage`) with path `/usr/bin/ceramic`.**
|
||||
|
||||
ToDos:
|
||||
|
||||
|
@ -97,10 +97,10 @@ result: String("Bye, yah")
|
||||
elapsed time: 49.64µs
|
||||
```
|
||||
|
||||
Looks like all is working as planned and we're ready to deploy our services to the Fluence testnet. To deploy a service, we need the peer id of our desired host node, which we can get with `fldist env`:
|
||||
Looks like all is working as planned and we're ready to deploy our services to the Fluence testnet. To deploy a service, we need the peer id of our desired host node, which we can get with `aqua env`:
|
||||
|
||||
```text
|
||||
% fldist env
|
||||
% aqua env
|
||||
/dns4/kras-00.fluence.dev/tcp/19990/wss/p2p/12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e
|
||||
/dns4/kras-00.fluence.dev/tcp/19001/wss/p2p/12D3KooWR4cv1a8tv7pps4HH6wePNaK6gf1Hww5wcCMzeWxyNw51
|
||||
/dns4/kras-01.fluence.dev/tcp/19001/wss/p2p/12D3KooWKnEqMfYo9zvfHmqTLpLdiHXPe4SVqUWcWHDJdFGrSmcA
|
||||
|
@ -11,7 +11,7 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "^0.6.0-272",
|
||||
"@fluencelabs/aqua": "^0.6.1-278",
|
||||
"@fluencelabs/aqua-lib": "^0.3.4",
|
||||
"chokidar-cli": "^3.0.0",
|
||||
"ts-node": "^10.4.0",
|
||||
|
@ -152,10 +152,10 @@ We now have our code in place and area ready to compile and our compilation inst
|
||||
|
||||
which gives you the updated Wasm modules in the `artifacts` directory.
|
||||
|
||||
The next step is to deploy the two services to one or more peers and we use the `fldist` tool to get this done. First, we need to now what peers are available and we can get an enumeration from:
|
||||
The next step is to deploy the two services to one or more peers and we use the `aqua` cli tool to get this done. First, we need to now what peers are available and we can get an enumeration from:
|
||||
|
||||
```bash
|
||||
fldist env
|
||||
aqua env
|
||||
```
|
||||
|
||||
*Please note that multiple service instances have been already deployed and the (peer id, service id) tuples can be found in [data]("./data/deployed_services.json) json file. While your more than welcome to deploy your services, you don't have to in order to use them.*
|
||||
|
77460
aqua-examples/price-oracle/web/package-lock.json
generated
77460
aqua-examples/price-oracle/web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -11,5 +11,7 @@ Example that shows how to work with disk access and how to link several Wasm mod
|
||||
# Call it
|
||||
|
||||
```shell
|
||||
fldist run_air -p download.air -d '{"service": "f7db6966-2d75-4424-812e-85e2ec5cb61b"}'
|
||||
aqua run \
|
||||
--addr /dns4/kras-06.fluence.dev/tcp/19001/wss/p2p/12D3KooWDUszU2NeWyUVjCXhGEt1MoZrhvdmaQQwtZUriuGN1jTr \
|
||||
-i download_url.aqua -f'download("https://fluence.network/img/svg/logo_new.svg", "logo.svg", "12D3KooWDUszU2NeWyUVjCXhGEt1MoZrhvdmaQQwtZUriuGN1jTr", "e693d1c3-3fbc-4ccd-8eae-1ba9c767e2f5")'
|
||||
```
|
||||
|
25
marine-examples/url-downloader/deployment_cfg.json
Normal file
25
marine-examples/url-downloader/deployment_cfg.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"url-downloader": {
|
||||
"name": "url-downloader",
|
||||
"modules": [
|
||||
{
|
||||
"name": "curl_adapter",
|
||||
"path": "./artifacts/curl_adapter.wasm",
|
||||
"mounted_binaries": [["curl", "/usr/bin/curl"]],
|
||||
"logger_enabled": [true]
|
||||
},
|
||||
{
|
||||
"name": "local_storage",
|
||||
"path": "./artifacts/local_storage.wasm",
|
||||
"preopened_files": ["/tmp"],
|
||||
"mapped_dirs": [["sites", "/tmp"]],
|
||||
"logger_enabled": [true]
|
||||
},
|
||||
{
|
||||
"name": "url_dowloader",
|
||||
"path": "./artifacts/facade.wasm",
|
||||
"logger_enabled": [true]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
23
marine-examples/url-downloader/deployment_data.txt
Normal file
23
marine-examples/url-downloader/deployment_data.txt
Normal file
@ -0,0 +1,23 @@
|
||||
aqua dist deploy \
|
||||
--addr /dns4/kras-06.fluence.dev/tcp/19001/wss/p2p/12D3KooWDUszU2NeWyUVjCXhGEt1MoZrhvdmaQQwtZUriuGN1jTr \
|
||||
--data-path deployment_cfg.json \
|
||||
--service url-downloader
|
||||
|
||||
Your peerId: 12D3KooWRPELv7DNPJvd7uG79etrvzN7VUaQGUt58qBWu4c58UHb
|
||||
"Going to upload a module..."
|
||||
2022.02.16 08:12:50 [INFO] created ipfs client to /ip4/161.35.212.85/tcp/5001
|
||||
2022.02.16 08:12:50 [INFO] connected to ipfs
|
||||
2022.02.16 08:12:51 [INFO] file uploaded
|
||||
"Going to upload a module..."
|
||||
2022.02.16 08:12:51 [INFO] created ipfs client to /ip4/161.35.212.85/tcp/5001
|
||||
2022.02.16 08:12:51 [INFO] connected to ipfs
|
||||
2022.02.16 08:12:53 [INFO] file uploaded
|
||||
"Going to upload a module..."
|
||||
2022.02.16 08:12:53 [INFO] created ipfs client to /ip4/161.35.212.85/tcp/5001
|
||||
2022.02.16 08:12:53 [INFO] connected to ipfs
|
||||
2022.02.16 08:12:55 [INFO] file uploaded
|
||||
"Now time to make a blueprint..."
|
||||
"Blueprint id:"
|
||||
"0c6b16c004adadb5b239f97029c050e1728258aea2c7c117c6c31e326cbd0fea"
|
||||
"And your service id is:"
|
||||
"e693d1c3-3fbc-4ccd-8eae-1ba9c767e2f5"
|
8
marine-examples/url-downloader/download_url.aqua
Normal file
8
marine-examples/url-downloader/download_url.aqua
Normal file
@ -0,0 +1,8 @@
|
||||
service UrlDownloader:
|
||||
get_n_save(url: string, file_name: string) -> string
|
||||
|
||||
func download(target_url: string, fname: string, node:string, service_id:string) -> string:
|
||||
on node:
|
||||
UrlDownloader service_id
|
||||
res <- UrlDownloader.get_n_save(target_url, fname)
|
||||
<- res
|
Loading…
Reference in New Issue
Block a user