mirror of
https://github.com/Lore09/Tesi-Magistrale.git
synced 2025-12-19 04:14:35 +00:00
pipeline scheme
This commit is contained in:
BIN
project/img/pipeline.png
Normal file
BIN
project/img/pipeline.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 811 KiB |
File diff suppressed because one or more lines are too long
112
readme.md
112
readme.md
@@ -44,3 +44,115 @@ tasks:
|
||||
version: 1.0.0 # Component version
|
||||
...
|
||||
```
|
||||
#### Task files
|
||||
|
||||
I file con il codice all'interno della cartella `task` devono seguire il formato
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
)
|
||||
|
||||
func exec_task(arg string) string{
|
||||
|
||||
... your code ...
|
||||
|
||||
return response // must me string
|
||||
}
|
||||
```
|
||||
|
||||
### Generazione del codice
|
||||
|
||||
Il parser utilizza il campo `type` del workflow per selezionare il corretto template fra quelli implementati (per ora)
|
||||
- producer -- produzione di dati e scrittura di essi in un topic NATS
|
||||
- processor -- lettura di dati da un topic, processamento dei dati e scrittura su un altro topic
|
||||
- dbsync -- lettura di dati da un topic e scrittura su un DB (Postgres)
|
||||
|
||||
Viene sostituito il file delle task con quello del template, i campi del file `workflow` vengono utilizzati per compilare il file `wadm.yaml`.
|
||||
|
||||
### Build componente WASM
|
||||
|
||||
Viene utilizzato il Dockerfile del template per buildare il componente WASM e pusharlo al registry configurato utilizzando il nome e la versione specificati nel `workflow.yaml`
|
||||
|
||||
|
||||
## Deploy componenti WASM su Wasmcloud
|
||||
|
||||
In fase di deployment vengono utilizzati i file `wadm.yaml` compilati in precedenza per effettuare il deployment dell'applicazione, eccone un esempio
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: go-data-stream
|
||||
annotations:
|
||||
description: 'Data stream processing using NATS topic in Golang (TinyGo), using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)'
|
||||
wasmcloud.dev/authors: Lorenzo Venerandi
|
||||
wasmcloud.dev/source-url: https://gitea.rebus.ninja/lore/wasm-nats-stream-client.git/wadm.yaml
|
||||
wasmcloud.dev/readme-md-url: https://gitea.rebus.ninja/lore/wasm-nats-stream-client.git/README.md
|
||||
wasmcloud.dev/homepage: https://gitea.rebus.ninja/lore/wasm-nats-stream-client.git
|
||||
wasmcloud.dev/categories: |
|
||||
stream-processing,nats-client,tinygo,golang
|
||||
spec:
|
||||
components:
|
||||
- name: go_stream_processor
|
||||
type: component
|
||||
properties:
|
||||
image: gitea.rebus.ninja/lore/wasm-nats-stream-client:1.0.3
|
||||
id: stream
|
||||
config:
|
||||
- name: nats-topic
|
||||
properties:
|
||||
dest-topic: wasmcloud.echo.reply
|
||||
traits:
|
||||
- type: spreadscaler
|
||||
properties:
|
||||
instances: 1
|
||||
spread:
|
||||
- name: cloud
|
||||
weight: 100
|
||||
requirements:
|
||||
host-type: cloud
|
||||
- name: edge
|
||||
weight: 0
|
||||
requirements:
|
||||
host-type: edge
|
||||
- type: link
|
||||
properties:
|
||||
target: nats
|
||||
namespace: wasmcloud
|
||||
package: messaging
|
||||
interfaces: [consumer]
|
||||
- name: nats
|
||||
type: capability
|
||||
properties:
|
||||
image: ghcr.io/wasmcloud/messaging-nats:0.23.1
|
||||
traits:
|
||||
- type: link
|
||||
properties:
|
||||
target: go_stream_processor
|
||||
namespace: wasmcloud
|
||||
package: messaging
|
||||
interfaces: [handler]
|
||||
source_config:
|
||||
- name: simple-subscription
|
||||
properties:
|
||||
subscriptions: streaming
|
||||
- type: spreadscaler
|
||||
properties:
|
||||
instances: 1
|
||||
spread:
|
||||
- name: cloud
|
||||
weight: 100
|
||||
requirements:
|
||||
host-type: cloud
|
||||
- name: edge
|
||||
weight: 0
|
||||
requirements:
|
||||
host-type: edge
|
||||
```
|
||||
Il target del deployment viene selezionato tramite il campo `spreadscaler`, che indirizza i componenti nell'host con il tag corrispondente.
|
||||
|
||||
### Pipeline scheme
|
||||

|
||||
Reference in New Issue
Block a user