github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/service.md (about) 1 # service env manual 2 3 ## Purpose 4 5 The purpose of this document is to help SRE and co-developers quickly track service configuration changes. 6 7 ## Project build SOP 8 9 ### Building structure 10 11 ``` 12 └── root ## repo root 13 ├── Makefile 14 ├── build 15 │ ├── target1 16 │ ├── target2 17 │ ├── ... 18 │ └── targetN 19 └── cmd 20 ├── target1 21 │ ├── Makefile 22 │ └── Dockerfile 23 ├── target2 24 │ ├── Makefile 25 │ └── Dockerfile 26 ├── ... 27 └── targetN 28 ├── Makefile 29 └── Dockerfile 30 ``` 31 32 > flag * means the make entry is required 33 34 Entries in root/Makefile: 35 36 1. targets\*: for building all assets(binaries). in this entry, it will traverse all directories in `root/cmd/`, 37 if `Makefile` exists, run `make target` 38 2. images: for building all images(docker). in this entry, it will traverse all directories in `root/cmd/`, 39 if `Dockerfile` exists, run `make image` 40 3. test\*: project level testing entry. 41 42 Entries in root/cmd/Makefile: 43 44 1. target\*: building binary 45 2. image: build docker image 46 47 ## Env Format 48 49 ``` 50 [SERVICE_NAME]__[CONFIG_GROUP]_[CONFIG_ELEMENT] = [CONFIG_VALUE] 51 ``` 52 53 eg: 54 55 ```yaml 56 SRV_APPLET_MGR__Logger_Format: JSON 57 ``` 58 59 the configuration above means use `JSON` log format under `SRV_APPLET_MGR` 60 61 ## Config Description 62 63 ### RobotNotifier 64 65 ```yaml 66 SRV_APPLET_MGR__RobotNotifier_Env: "" ## service env. eg dev-staging, prod 67 SRV_APPLET_MGR__RobotNotifier_Secret: "" ## lark group secret, default '' 68 SRV_APPLET_MGR__RobotNotifier_URL: "" ## required: lark group webhook url, 69 SRV_APPLET_MGR__RobotNotifier_Vendor: "" ## robot vendor. eg Lark, DingTalk WeWork 70 ``` 71 72 ### WasmDBConfig 73 74 ```yaml 75 SRV_APPLET_MGR__WasmDBConfig_Endpoint: "" ## wasm database endpoint, default '' 76 SRV_APPLET_MGR__WasmDBConfig_MaxConnection: "2" ## wasm database max connection for each wasm instance, default 2 77 SRV_APPLET_MGR__WasmDBConfig_ConnMaxLifetime: "20s" ## wasm database max connection lifetime default 20 seconds 78 SRV_APPLET_MGR__WasmDBConfig_PoolSize: "2" ## wasm database connection pool size default 2 79 ``` 80 81 ### Logger 82 83 ```yaml 84 SRV_APPLET_MGR__NewLogger_Format: "JSON" ## log format default `JSON`, use `JSON` or `TEXT` 85 SRV_APPLET_MGR__NewLogger_Level: "info" ## enum in `error`, `warn`, `debug`, `info`, default `debug` suggested `info` 86 SRV_APPLET_MGR__NewLogger_Output: "ALWAYS" ## default `ALWAYS`, enums in `ALWAYS` `ON_FAILURE` and `NEVER`, output to trace collector 87 SRV_APPLET_MGR__NewLogger_Service: "srv-applet-mgr" ## service name 88 SRV_APPLET_MGR__NewLogger_Version: "unknown" ## service version 89 ``` 90 91 ### Tracer 92 93 ```yaml 94 SRV_APPLET_MGR__Tracer_DebugMode: "true" ## if enable tracer debug mode 95 SRV_APPLET_MGR__Tracer_GrpcEndpoint: "http://127.0.0.1:4317" ## GRPC collector endpoint, default use GRPC collector 96 SRV_APPLET_MGR__Tracer_HttpEndpoint: "http://127.0.0.1:4218" ## HTTP collector endpoint 97 SRV_APPLET_MGR__Tracer_InstanceID: "xxx" ## unique instance id to identify service 98 SRV_APPLET_MGR__Tracer_ServiceName: "srv-applet-mgr" ## service name 99 SRV_APPLET_MGR__Tracer_ServiceVersion: ## service version 100 SRV_APPLET_MGR__Tracer_TLS_Ca: "" ## endpoint TLS configurations, use `value` or `file path` 101 SRV_APPLET_MGR__Tracer_TLS_CaPath: "" 102 SRV_APPLET_MGR__Tracer_TLS_Crt: "" 103 SRV_APPLET_MGR__Tracer_TLS_CrtPath: "" 104 SRV_APPLET_MGR__Tracer_TLS_Key: "" 105 SRV_APPLET_MGR__Tracer_TLS_KeyPath: "" 106 ``` 107 108 ### risc server 109 110 ``` yaml 111 SRV_APPLET_MGR__Risc0Config_CreateProofPath: "/" 112 SRV_APPLET_MGR__Risc0Config_Endpoint: "127.0.0.1:3000" ## risc server endpoint, just ip and port 113 SRV_APPLET_MGR__Risc0Config_Websocket: "127.0.0.1:3001" 114 ``` 115 ### Task Manager MQ 116 117 ```yaml 118 SRV_APPLET_MGR__Mq_Channel: "" ## channel name, if empty use env `PRJ_NAME` 119 SRV_APPLET_MGR__Mq_Limit: "1024" ## queue limit default 1024 120 SRV_APPLET_MGR__Mq_PushQueueTimeout: "1s" ## push timeout default 1s 121 SRV_APPLET_MGR__Mq_Store: "MEM" ## support mem only now 122 SRV_APPLET_MGR__Mq_WorkerCount: "256" ## task worker count, default 256 123 ```