From f44acc81f6eeea7f8f0654eaf9f0f3add757530c Mon Sep 17 00:00:00 2001 From: seeflood Date: Wed, 25 May 2022 16:17:19 +0800 Subject: [PATCH 1/8] remove redundant json files Signed-off-by: seeflood --- cmd/layotto/main.go | 2 +- cmd/layotto_multiple_api/main.go | 2 +- configs/config_apollo_health.json | 94 -------- configs/config_bindings.json | 48 ---- ...ig_lock_consul.json => config_consul.json} | 0 configs/config_integration_redis_etcd.json | 220 ------------------ configs/config_lock_etcd.json | 80 ------- configs/config_lock_mongo.json | 81 ------- configs/config_lock_redis.json | 77 ------ configs/config_lock_redis_cluster.json | 78 ------- configs/config_lock_zookeeper.json | 79 ------- ...sequencer_mongo.json => config_mongo.json} | 13 ++ configs/config_secret_file.json | 82 ------- configs/config_sequencer_etcd.json | 81 ------- configs/config_sequencer_redis.json | 77 ------ ..._in_memory.json => config_standalone.json} | 21 ++ configs/config_state_redis.json | 89 ------- ...r_zookeeper.json => config_zookeeper.json} | 13 +- configs/integrate_config.json | 62 ----- configs/runtime_config.json | 25 ++ configs/wrong/config_apollo_health.json | 91 -------- docs/en/component_specs/lock/common.md | 2 +- docs/en/component_specs/lock/consul.md | 2 +- docs/en/component_specs/lock/etcd.md | 4 +- docs/en/component_specs/lock/mongo.md | 2 +- docs/en/component_specs/lock/redis.md | 2 +- docs/en/component_specs/lock/zookeeper.md | 4 +- docs/en/component_specs/sequencer/common.md | 2 +- docs/en/component_specs/sequencer/etcd.md | 4 +- .../en/component_specs/sequencer/in-memory.md | 4 +- docs/en/component_specs/sequencer/mongo.md | 2 +- docs/en/component_specs/sequencer/redis.md | 4 +- .../en/component_specs/sequencer/zookeeper.md | 4 +- docs/en/component_specs/state/common.md | 2 +- docs/en/component_specs/state/redis.md | 2 +- docs/en/development/developing-component.md | 2 +- docs/en/start/actuator/start.md | 2 +- docs/en/start/api_plugin/helloworld.md | 2 +- docs/en/start/lock/start.md | 2 +- docs/en/start/secret/start.md | 2 +- docs/en/start/sequencer/start.md | 2 +- docs/en/start/state/start.md | 2 +- docs/zh/component_specs/custom/common.md | 2 +- docs/zh/component_specs/lock/common.md | 2 +- docs/zh/component_specs/lock/consul.md | 2 +- docs/zh/component_specs/lock/etcd.md | 4 +- docs/zh/component_specs/lock/in-memory.md | 4 +- docs/zh/component_specs/lock/mongo.md | 2 +- docs/zh/component_specs/lock/redis.md | 3 +- docs/zh/component_specs/lock/zookeeper.md | 4 +- docs/zh/component_specs/sequencer/common.md | 2 +- docs/zh/component_specs/sequencer/etcd.md | 4 +- .../zh/component_specs/sequencer/in-memory.md | 4 +- docs/zh/component_specs/sequencer/mongo.md | 2 +- docs/zh/component_specs/sequencer/redis.md | 4 +- .../zh/component_specs/sequencer/zookeeper.md | 4 +- docs/zh/component_specs/state/common.md | 2 +- docs/zh/component_specs/state/redis.md | 2 +- docs/zh/design/api_plugin/design.md | 2 +- docs/zh/development/developing-component.md | 2 +- docs/zh/development/test-quickstart.md | 8 +- docs/zh/start/actuator/start.md | 2 +- docs/zh/start/api_plugin/helloworld.md | 2 +- docs/zh/start/lock/start.md | 2 +- docs/zh/start/secret/start.md | 2 +- docs/zh/start/sequencer/start.md | 2 +- docs/zh/start/state/start.md | 2 +- sdk/go-sdk/test/runtime/integrate_test.sh | 4 +- 68 files changed, 138 insertions(+), 1306 deletions(-) delete mode 100644 configs/config_apollo_health.json delete mode 100644 configs/config_bindings.json rename configs/{config_lock_consul.json => config_consul.json} (100%) delete mode 100644 configs/config_integration_redis_etcd.json delete mode 100644 configs/config_lock_etcd.json delete mode 100644 configs/config_lock_mongo.json delete mode 100644 configs/config_lock_redis.json delete mode 100644 configs/config_lock_redis_cluster.json delete mode 100644 configs/config_lock_zookeeper.json rename configs/{config_sequencer_mongo.json => config_mongo.json} (80%) delete mode 100644 configs/config_secret_file.json delete mode 100644 configs/config_sequencer_etcd.json delete mode 100644 configs/config_sequencer_redis.json rename configs/{config_in_memory.json => config_standalone.json} (78%) delete mode 100644 configs/config_state_redis.json rename configs/{config_sequencer_zookeeper.json => config_zookeeper.json} (81%) delete mode 100644 configs/integrate_config.json delete mode 100644 configs/wrong/config_apollo_health.json diff --git a/cmd/layotto/main.go b/cmd/layotto/main.go index 14dfa1e27a..4e433e27d9 100644 --- a/cmd/layotto/main.go +++ b/cmd/layotto/main.go @@ -430,7 +430,7 @@ func NewRuntimeGrpcServer(data json.RawMessage, opts ...grpc.ServerOption) (mgrp var cmdStart = cli.Command{ Name: "start", - Usage: "start runtime. For example: ./layotto start -c configs/config_in_memory.json", + Usage: "start runtime. For example: ./layotto start -c configs/config_standalone.json", Flags: []cli.Flag{ cli.StringFlag{ Name: "config, c", diff --git a/cmd/layotto_multiple_api/main.go b/cmd/layotto_multiple_api/main.go index 5bbf6b0ee8..5586b56168 100644 --- a/cmd/layotto_multiple_api/main.go +++ b/cmd/layotto_multiple_api/main.go @@ -403,7 +403,7 @@ func NewRuntimeGrpcServer(data json.RawMessage, opts ...grpc.ServerOption) (mgrp var cmdStart = cli.Command{ Name: "start", - Usage: "start runtime. For example: ./layotto start -c configs/config_in_memory.json", + Usage: "start runtime. For example: ./layotto start -c configs/config_standalone.json", Flags: []cli.Flag{ cli.StringFlag{ Name: "config, c", diff --git a/configs/config_apollo_health.json b/configs/config_apollo_health.json deleted file mode 100644 index 9570acd529..0000000000 --- a/configs/config_apollo_health.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "routers": [ - { - "router_config_name": "actuator_dont_need_router" - } - ], - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34904", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "tcpcopy", - "config": { - "strategy": { - "switch": "ON", - "interval": 30, - "duration": 10, - "cpu_max_rate": 80, - "mem_max_rate": 80 - } - } - }, - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "greeting" - } - }, - "config_store": { - "config_demo": { - "type": "apollo", - "address": [ - "http://106.54.227.205:8080" - ], - "metadata": { - "app_id": "testApplication_yang", - "cluster": "default", - "namespace_name": "dubbo,product.joe,application", - "is_backup_config": "true", - "secret": "6ce3ff7e96a24335a9634fe9abca6d51", - "open_api_token": "947b0db097d2931ba5bf503f1e33c10394f90d11", - "open_api_address": "http://106.54.227.205", - "open_api_user": "apollo" - } - } - } - } - } - } - ] - } - ] - }, - { - "name": "actuator", - "address": "127.0.0.1:34999", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "upstream_protocol": "Http1", - "router_config_name": "actuator_dont_need_router" - } - } - ] - } - ], - "stream_filters": [ - { - "type": "actuator_filter" - } - ] - } - ] - } - ] -} diff --git a/configs/config_bindings.json b/configs/config_bindings.json deleted file mode 100644 index 2cab9d88ba..0000000000 --- a/configs/config_bindings.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34904", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "greeting" - } - }, - "bindings": { - "bindings_demo": { - "type": "http", - "metadata": - { - "url": "https://github.com/mosn/layotto" - } - } - } - } - } - } - ] - } - ] - } - ] - } - ], - "pprof": { - "debug": true, - "port_value": 34902 - } -} diff --git a/configs/config_lock_consul.json b/configs/config_consul.json similarity index 100% rename from configs/config_lock_consul.json rename to configs/config_consul.json diff --git a/configs/config_integration_redis_etcd.json b/configs/config_integration_redis_etcd.json deleted file mode 100644 index ae5d7c73bf..0000000000 --- a/configs/config_integration_redis_etcd.json +++ /dev/null @@ -1,220 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "routers": [ - { - "router_config_name": "http_router", - "virtual_hosts": [ - { - "name": "http_host", - "domains": [ - "*" - ], - "routers": [ - { - "match": { - "headers": [ - { - "name": "id", - "value": "HelloService:1.0" - } - ] - }, - "route": { - "cluster_name": "http_server" - } - } - ] - } - ] - }, - { - "router_config_name": "actuator_dont_need_router" - } - ], - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34904", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "rpcs": { - "mosn": { - "config": { - "channel": [ - { - "size": 16, - "protocol": "http", - "listener": "egress_runtime_http" - } - ] - } - } - }, - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "greeting" - } - }, - "bindings": { - "bindings_demo": { - "type": "http", - "metadata": { - "url": "https://registry.npmmirror.com/layotto/0.0.0" - } - } - }, - "config_store": { - "config_demo": { - "type": "etcd", - "address": [ - "127.0.0.1:2379" - ], - "timeout": "10" - } - }, - "state": { - "state_demo": { - "type": "redis", - "metadata": { - "redisHost": "localhost:6380", - "redisPassword": "" - } - } - }, - "sequencer": { - "sequencer_demo1": { - "type": "etcd", - "metadata": { - "endpoints": "localhost:2379", - "segmentCacheEnable": "false", - "segmentStep": "1", - "username": "", - "password": "", - "dialTimeout": "5" - } - }, - "sequencer_demo2": { - "type": "redis", - "metadata": { - "redisHost": "127.0.0.1:6380", - "redisPassword": "" - } - } - }, - "lock": { - "lock_demo1": { - "type": "etcd", - "metadata": { - "endpoints": "localhost:2379", - "username": "", - "password": "", - "keyPrefixPath": "/lock", - "dialTimeout": "5" - } - }, - "lock_demo2": { - "type": "redis", - "metadata": { - "redisHost": "localhost:6380", - "redisPassword": "" - } - } - }, - "pub_subs": { - "pub_subs_demo": { - "type": "redis", - "metadata": { - "redisHost": "localhost:6380", - "redisPassword": "" - } - } - }, - "app": { - "app_id": "app1", - "grpc_callback_port": 9999 - } - } - } - } - ] - } - ] - }, - { - "name": "actuator", - "address": "127.0.0.1:34999", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "upstream_protocol": "Http1", - "router_config_name": "actuator_dont_need_router" - } - } - ] - } - ], - "stream_filters": [ - { - "type": "actuator_filter" - } - ] - }, - { - "name": "egress_runtime_http", - "type": "egress", - "address": "0.0.0.0:12221", - "bind_port": true, - "network": "tcp", - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "name": "proxy_config", - "router_config_name": "http_router", - "upstream_protocol": "Http1" - } - } - ] - } - ] - } - ] - } - ], - "cluster_manager": { - "tls_context": {}, - "clusters": [ - { - "name": "http_server", - "type": "SIMPLE", - "lb_type": "LB_RANDOM", - "hosts": [ - { - "address": "127.0.0.1:8889", - "hostname": "downstream_machine1", - "weight": 1 - } - ] - } - ] - } -} diff --git a/configs/config_lock_etcd.json b/configs/config_lock_etcd.json deleted file mode 100644 index acc7b94deb..0000000000 --- a/configs/config_lock_etcd.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "routers": [ - { - "router_config_name": "actuator_dont_need_router" - } - ], - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34904", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "greeting" - } - }, - "lock": { - "lock_demo": { - "type": "etcd", - "metadata": { - "endpoints": "localhost:2379", - "username": "", - "password": "", - "keyPrefixPath": "/lock", - "dialTimeout": "5" - } - } - }, - "app": { - "app_id": "app1", - "grpc_callback_port": 9999 - } - } - } - } - ] - } - ] - }, - { - "name": "actuator", - "address": "127.0.0.1:34999", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "upstream_protocol": "Http1", - "router_config_name": "actuator_dont_need_router" - } - } - ] - } - ], - "stream_filters": [ - { - "type": "actuator_filter" - } - ] - } - ] - } - ] -} diff --git a/configs/config_lock_mongo.json b/configs/config_lock_mongo.json deleted file mode 100644 index 9a3a046627..0000000000 --- a/configs/config_lock_mongo.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "routers": [ - { - "router_config_name": "actuator_dont_need_router" - } - ], - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34904", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "greeting" - } - }, - "lock": { - "lock_demo": { - "type": "mongo", - "metadata": { - "mongoHost": "localhost:27017", - "mongoPassword": "", - "username": "", - "databaseName ": "", - "collecttionName": "", - "params": "" - } - } - }, - "app": { - "app_id": "app1", - "grpc_callback_port": 9999 - } - } - } - } - ] - } - ] - }, - { - "name": "actuator", - "address": "127.0.0.1:34999", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "upstream_protocol": "Http1", - "router_config_name": "actuator_dont_need_router" - } - } - ] - } - ], - "stream_filters": [ - { - "type": "actuator_filter" - } - ] - } - ] - } - ] -} diff --git a/configs/config_lock_redis.json b/configs/config_lock_redis.json deleted file mode 100644 index 0f6c121f65..0000000000 --- a/configs/config_lock_redis.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "routers": [ - { - "router_config_name": "actuator_dont_need_router" - } - ], - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34904", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "greeting" - } - }, - "lock": { - "lock_demo": { - "type": "redis", - "metadata": { - "redisHost": "localhost:6380", - "redisPassword": "" - } - } - }, - "app": { - "app_id": "app1", - "grpc_callback_port": 9999 - } - } - } - } - ] - } - ] - }, - { - "name": "actuator", - "address": "127.0.0.1:34999", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "upstream_protocol": "Http1", - "router_config_name": "actuator_dont_need_router" - } - } - ] - } - ], - "stream_filters": [ - { - "type": "actuator_filter" - } - ] - } - ] - } - ] -} diff --git a/configs/config_lock_redis_cluster.json b/configs/config_lock_redis_cluster.json deleted file mode 100644 index 572946d474..0000000000 --- a/configs/config_lock_redis_cluster.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "routers": [ - { - "router_config_name": "actuator_dont_need_router" - } - ], - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34904", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "greeting" - } - }, - "lock": { - "lock_demo": { - "type": "redis_cluster", - "metadata": { - "concurrency": "0", - "redisHosts": "localhost:6381,localhost:6382,localhost:6383,localhost:6384,localhost:6385", - "redisPassword": "" - } - } - }, - "app": { - "app_id": "app1", - "grpc_callback_port": 9999 - } - } - } - } - ] - } - ] - }, - { - "name": "actuator", - "address": "127.0.0.1:34999", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "upstream_protocol": "Http1", - "router_config_name": "actuator_dont_need_router" - } - } - ] - } - ], - "stream_filters": [ - { - "type": "actuator_filter" - } - ] - } - ] - } - ] -} diff --git a/configs/config_lock_zookeeper.json b/configs/config_lock_zookeeper.json deleted file mode 100644 index ac6cde3482..0000000000 --- a/configs/config_lock_zookeeper.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "routers": [ - { - "router_config_name": "actuator_dont_need_router" - } - ], - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34904", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "greeting" - } - }, - "lock": { - "lock_demo": { - "type": "zookeeper", - "metadata": { - "zookeeperHosts": "127.0.0.1", - "zookeeperPassword": "", - "sessionTimeout": "3", - "logInfo":"false" - } - } - }, - "app": { - "app_id": "app1", - "grpc_callback_port": 9999 - } - } - } - } - ] - } - ] - }, - { - "name": "actuator", - "address": "127.0.0.1:34999", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "upstream_protocol": "Http1", - "router_config_name": "actuator_dont_need_router" - } - } - ] - } - ], - "stream_filters": [ - { - "type": "actuator_filter" - } - ] - } - ] - } - ] -} diff --git a/configs/config_sequencer_mongo.json b/configs/config_mongo.json similarity index 80% rename from configs/config_sequencer_mongo.json rename to configs/config_mongo.json index beb5b984b9..2cc0e621bd 100644 --- a/configs/config_sequencer_mongo.json +++ b/configs/config_mongo.json @@ -40,6 +40,19 @@ } } }, + "lock": { + "lock_demo": { + "type": "mongo", + "metadata": { + "mongoHost": "localhost:27017", + "mongoPassword": "", + "username": "", + "databaseName ": "", + "collecttionName": "", + "params": "" + } + } + }, "app": { "app_id": "app1", "grpc_callback_port": 9999 diff --git a/configs/config_secret_file.json b/configs/config_secret_file.json deleted file mode 100644 index b734e26cf6..0000000000 --- a/configs/config_secret_file.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "routers": [ - { - "router_config_name": "actuator_dont_need_router" - } - ], - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34904", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "greeting" - } - }, - "secret_store": { - "secret_demo": { - "type": "local.file", - "metadata": { - "secretsFile": "../../configs/secret/config_secret_local_file.json" - } - }, - "secret_demo1": { - "type": "local.env", - "metadata": { - } - } - }, - "app": { - "app_id": "app1", - "grpc_callback_port": 9999 - } - } - } - } - ] - } - ] - }, - { - "name": "actuator", - "address": "127.0.0.1:34999", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "upstream_protocol": "Http1", - "router_config_name": "actuator_dont_need_router" - } - } - ] - } - ], - "stream_filters": [ - { - "type": "actuator_filter" - } - ] - } - ] - } - ] -} - diff --git a/configs/config_sequencer_etcd.json b/configs/config_sequencer_etcd.json deleted file mode 100644 index 7ebcaf4dee..0000000000 --- a/configs/config_sequencer_etcd.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "routers": [ - { - "router_config_name": "actuator_dont_need_router" - } - ], - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34904", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "greeting" - } - }, - "sequencer": { - "sequencer_demo": { - "type": "etcd", - "metadata": { - "endpoints": "localhost:2379", - "segmentCacheEnable": "false", - "segmentStep": "1", - "username": "", - "password": "", - "dialTimeout": "5" - } - } - }, - "app": { - "app_id": "app1", - "grpc_callback_port": 9999 - } - } - } - } - ] - } - ] - }, - { - "name": "actuator", - "address": "127.0.0.1:34999", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "upstream_protocol": "Http1", - "router_config_name": "actuator_dont_need_router" - } - } - ] - } - ], - "stream_filters": [ - { - "type": "actuator_filter" - } - ] - } - ] - } - ] -} diff --git a/configs/config_sequencer_redis.json b/configs/config_sequencer_redis.json deleted file mode 100644 index 332cbd92a6..0000000000 --- a/configs/config_sequencer_redis.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "routers": [ - { - "router_config_name": "actuator_dont_need_router" - } - ], - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34904", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "greeting" - } - }, - "sequencer": { - "sequencer_demo": { - "type": "redis", - "metadata": { - "redisHost": "127.0.0.1:6379", - "redisPassword": "" - } - } - }, - "app": { - "app_id": "app1", - "grpc_callback_port": 9999 - } - } - } - } - ] - } - ] - }, - { - "name": "actuator", - "address": "127.0.0.1:34999", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "upstream_protocol": "Http1", - "router_config_name": "actuator_dont_need_router" - } - } - ] - } - ], - "stream_filters": [ - { - "type": "actuator_filter" - } - ] - } - ] - } - ] -} diff --git a/configs/config_in_memory.json b/configs/config_standalone.json similarity index 78% rename from configs/config_in_memory.json rename to configs/config_standalone.json index 98ddf984ad..b4eb45784f 100644 --- a/configs/config_in_memory.json +++ b/configs/config_standalone.json @@ -55,6 +55,27 @@ "metadata": {} } }, + "secret_store": { + "secret_demo": { + "type": "local.file", + "metadata": { + "secretsFile": "../../configs/secret/config_secret_local_file.json" + } + }, + "secret_demo1": { + "type": "local.env", + "metadata": { + } + } + }, + "bindings": { + "bindings_demo": { + "type": "http", + "metadata": { + "url": "https://mosn.io/layotto" + } + } + }, "custom_component": { "helloworld": { "demo": { diff --git a/configs/config_state_redis.json b/configs/config_state_redis.json deleted file mode 100644 index f6eace10bb..0000000000 --- a/configs/config_state_redis.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "routers": [ - { - "router_config_name": "actuator_dont_need_router" - } - ], - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34904", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "tcpcopy", - "config": { - "strategy": { - "switch": "ON", - "interval": 30, - "duration": 10, - "cpu_max_rate": 80, - "mem_max_rate": 80 - } - } - }, - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "greeting" - } - }, - "state": { - "state_demo": { - "type": "redis", - "metadata": { - "redisHost": "localhost:6380", - "redisPassword": "" - } - } - }, - "app": { - "app_id": "app1", - "grpc_callback_port": 9999 - } - } - } - } - ] - } - ] - }, - { - "name": "actuator", - "address": "127.0.0.1:34999", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "upstream_protocol": "Http1", - "router_config_name": "actuator_dont_need_router" - } - } - ] - } - ], - "stream_filters": [ - { - "type": "actuator_filter" - } - ] - } - ] - } - ] -} diff --git a/configs/config_sequencer_zookeeper.json b/configs/config_zookeeper.json similarity index 81% rename from configs/config_sequencer_zookeeper.json rename to configs/config_zookeeper.json index 9018b515ee..2829a8b6a9 100644 --- a/configs/config_sequencer_zookeeper.json +++ b/configs/config_zookeeper.json @@ -34,7 +34,18 @@ "zookeeperHosts": "127.0.0.1", "zookeeperPassword": "", "sessionTimeout": "3", - "logInfo":"false" + "logInfo": "false" + } + } + }, + "lock": { + "lock_demo": { + "type": "zookeeper", + "metadata": { + "zookeeperHosts": "127.0.0.1", + "zookeeperPassword": "", + "sessionTimeout": "3", + "logInfo": "false" } } }, diff --git a/configs/integrate_config.json b/configs/integrate_config.json deleted file mode 100644 index b0538337b0..0000000000 --- a/configs/integrate_config.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "INFO", - "listeners": [ - { - "name": "grpc", - "address": "0.0.0.0:11104", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "quick_start_demo": { - "type": "helloworld", - "hello": "welcome layotto" - } - }, - "state": { - "state_demo": { - "type": "redis", - "metadata": { - "redisHost": "localhost:6379", - "redisPassword": "" - } - } - }, - "lock": { - "lock_demo": { - "type": "redis", - "metadata": { - "redisHost": "localhost:6379", - "redisPassword": "" - } - } - }, - "sequencer": { - "sequencer_demo": { - "type": "redis", - "metadata": { - "redisHost": "127.0.0.1:6379", - "redisPassword": "" - } - } - } - } - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/configs/runtime_config.json b/configs/runtime_config.json index c778efe4aa..2d72c76289 100644 --- a/configs/runtime_config.json +++ b/configs/runtime_config.json @@ -30,6 +30,31 @@ ], "timeout": "10" } + }, + "sequencer": { + "sequencer_demo": { + "type": "etcd", + "metadata": { + "endpoints": "localhost:2379", + "segmentCacheEnable": "false", + "segmentStep": "1", + "username": "", + "password": "", + "dialTimeout": "5" + } + } + }, + "lock": { + "lock_demo": { + "type": "etcd", + "metadata": { + "endpoints": "localhost:2379", + "username": "", + "password": "", + "keyPrefixPath": "/lock", + "dialTimeout": "5" + } + } } } } diff --git a/configs/wrong/config_apollo_health.json b/configs/wrong/config_apollo_health.json deleted file mode 100644 index 1ac3d64f1f..0000000000 --- a/configs/wrong/config_apollo_health.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "servers": [ - { - "default_log_path": "stdout", - "default_log_level": "DEBUG", - "routers": [ - { - "router_config_name": "actuator_dont_need_router" - } - ], - "listeners": [ - { - "name": "grpc", - "address": "127.0.0.1:34905", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "tcpcopy", - "config": { - "strategy": { - "switch": "ON", - "interval": 30, - "duration": 10, - "cpu_max_rate": 80, - "mem_max_rate": 80 - } - } - }, - { - "type": "grpc", - "config": { - "server_name": "runtime", - "grpc_config": { - "hellos": { - "helloworld": { - "hello": "greeting" - } - }, - "config_store": { - "apollo": { - "address": [ - "http://106.54.227.205:8080" - ], - "metadata": { - "app_id": "testApplication_yang", - "cluster": "default", - "namespace_name": "dubbo,product.joe,application", - "is_backup_config": "true", - "secret": "6ce3ff7e96a24335a9634fe9abca6d51", - "open_api_address": "http://106.54.227.205", - "open_api_user": "apollo" - } - } - } - } - } - } - ] - } - ] - }, - { - "name": "actuator", - "address": "127.0.0.1:34888", - "bind_port": true, - "filter_chains": [ - { - "filters": [ - { - "type": "proxy", - "config": { - "downstream_protocol": "Http1", - "upstream_protocol": "Http1", - "router_config_name": "actuator_dont_need_router" - } - } - ] - } - ], - "stream_filters": [ - { - "type": "actuator_filter" - } - ] - } - ] - } - ] -} diff --git a/docs/en/component_specs/lock/common.md b/docs/en/component_specs/lock/common.md index 115971905c..8b83e9e6af 100644 --- a/docs/en/component_specs/lock/common.md +++ b/docs/en/component_specs/lock/common.md @@ -20,7 +20,7 @@ The json configuration file has the following structure: } } ``` -You can configure the key/value configuration items that the component cares about in the metadata. For example, [redis component configuration](https://github.com/mosn/layotto/blob/main/configs/config_lock_redis.json) is as follows: +You can configure the key/value configuration items that the component cares about in the metadata. For example, [redis component configuration](https://github.com/mosn/layotto/blob/main/configs/config_redis.json) is as follows: ```json "lock": { diff --git a/docs/en/component_specs/lock/consul.md b/docs/en/component_specs/lock/consul.md index 20cfad5822..4a1954c4f5 100644 --- a/docs/en/component_specs/lock/consul.md +++ b/docs/en/component_specs/lock/consul.md @@ -2,7 +2,7 @@ ## metadata fields -Example:configs/config_lock_consul.json +Example:configs/config_consul.json | Field | Required | Description | | --- | --- | --- | diff --git a/docs/en/component_specs/lock/etcd.md b/docs/en/component_specs/lock/etcd.md index 5e523ae0e1..6b090add7f 100644 --- a/docs/en/component_specs/lock/etcd.md +++ b/docs/en/component_specs/lock/etcd.md @@ -1,7 +1,7 @@ # Etcd ## metadata fields -Example: configs/config_lock_etcd.json +Example: configs/runtime_config.json | Field | Required | Description | | --- | --- | --- | @@ -39,7 +39,7 @@ go build Execute after the compilation is successful: ```shell @background -./layotto start -c ../../configs/config_lock_etcd.json +./layotto start -c ../../configs/runtime_config.json ``` ## Run Demo diff --git a/docs/en/component_specs/lock/mongo.md b/docs/en/component_specs/lock/mongo.md index 15ae848dd8..1489f1d7d8 100644 --- a/docs/en/component_specs/lock/mongo.md +++ b/docs/en/component_specs/lock/mongo.md @@ -2,7 +2,7 @@ ## metadata fields -Example:configs/config_lock_mongo.json +Example:configs/config_mongo.json | Field | Required | Description | | --- | --- | --- | diff --git a/docs/en/component_specs/lock/redis.md b/docs/en/component_specs/lock/redis.md index e02fd1b616..89dd5f88fb 100644 --- a/docs/en/component_specs/lock/redis.md +++ b/docs/en/component_specs/lock/redis.md @@ -1,7 +1,7 @@ # Redis ## metadata fields -Example: configs/config_lock_redis.json +Example: configs/config_redis.json | Field | Required | Description | | --- | --- | --- | diff --git a/docs/en/component_specs/lock/zookeeper.md b/docs/en/component_specs/lock/zookeeper.md index 47fe9433c6..07f7e0a215 100644 --- a/docs/en/component_specs/lock/zookeeper.md +++ b/docs/en/component_specs/lock/zookeeper.md @@ -1,7 +1,7 @@ # Zookeeper ## metadata fields -Example: configs/config_lock_zookeeper.json +Example: configs/config_zookeeper.json | Field | Required | Description | | --- | --- | --- | @@ -29,7 +29,7 @@ go build Execute after the compilation is successful: ````shell -./layotto start -c ../../configs/config_lock_zookeeper.json +./layotto start -c ../../configs/config_zookeeper.json ```` ## Run Demo diff --git a/docs/en/component_specs/sequencer/common.md b/docs/en/component_specs/sequencer/common.md index f899713b4f..35b4426558 100644 --- a/docs/en/component_specs/sequencer/common.md +++ b/docs/en/component_specs/sequencer/common.md @@ -28,7 +28,7 @@ The json configuration file has the following structure: } } ``` -You can configure the key/value configuration items that the component cares about in the metadata. For example, [Etcd component configuration](https://github.com/mosn/layotto/blob/main/configs/config_sequencer_etcd.json) is as follows: +You can configure the key/value configuration items that the component cares about in the metadata. For example, [Etcd component configuration](https://github.com/mosn/layotto/blob/main/configs/runtime_config.json) is as follows: ```json diff --git a/docs/en/component_specs/sequencer/etcd.md b/docs/en/component_specs/sequencer/etcd.md index afbbc4811b..5d230a4f12 100644 --- a/docs/en/component_specs/sequencer/etcd.md +++ b/docs/en/component_specs/sequencer/etcd.md @@ -1,7 +1,7 @@ # Etcd ## metadata fields -Example: configs/config_sequencer_etcd.json +Example: configs/runtime_config.json | Field | Required | Description | | --- | --- | --- | @@ -38,7 +38,7 @@ go build Execute after the compilation is successful: ````shell -./layotto start -c ../../configs/config_sequencer_etcd.json +./layotto start -c ../../configs/runtime_config.json ```` ## Run Demo diff --git a/docs/en/component_specs/sequencer/in-memory.md b/docs/en/component_specs/sequencer/in-memory.md index 57499cbbad..73fc93de80 100644 --- a/docs/en/component_specs/sequencer/in-memory.md +++ b/docs/en/component_specs/sequencer/in-memory.md @@ -2,7 +2,7 @@ ## Example -You can use `configs/config_in_memory.json` +You can use `configs/config_standalone.json` ## Start Layotto Download Layotto: @@ -26,7 +26,7 @@ go build Run Layotto: ```shell @background -./layotto start -c ../../configs/config_in_memory.json +./layotto start -c ../../configs/config_standalone.json ``` ## Run Demo diff --git a/docs/en/component_specs/sequencer/mongo.md b/docs/en/component_specs/sequencer/mongo.md index 68a433ba4c..1489f1d7d8 100644 --- a/docs/en/component_specs/sequencer/mongo.md +++ b/docs/en/component_specs/sequencer/mongo.md @@ -2,7 +2,7 @@ ## metadata fields -Example:configs/config_sequencer_mongo.json +Example:configs/config_mongo.json | Field | Required | Description | | --- | --- | --- | diff --git a/docs/en/component_specs/sequencer/redis.md b/docs/en/component_specs/sequencer/redis.md index c5db57bc61..3c1facd86c 100644 --- a/docs/en/component_specs/sequencer/redis.md +++ b/docs/en/component_specs/sequencer/redis.md @@ -1,7 +1,7 @@ # Redis ## metadata fields -Example: configs/config_sequencer_redis.json +Example: configs/config_redis.json | Field | Required | Description | | --- | --- | --- | @@ -35,7 +35,7 @@ go build Execute after the compilation is successful: ````shell -./layotto start -c ../../configs/config_sequencer_redis.json +./layotto start -c ../../configs/config_redis.json ```` ## Run Demo diff --git a/docs/en/component_specs/sequencer/zookeeper.md b/docs/en/component_specs/sequencer/zookeeper.md index 60022c4cf5..e99b5fd73d 100644 --- a/docs/en/component_specs/sequencer/zookeeper.md +++ b/docs/en/component_specs/sequencer/zookeeper.md @@ -1,7 +1,7 @@ # Zookeeper ## metadata fields -Example: configs/config_sequencer_zookeeper.json +Example: configs/config_zookeeper.json | Field | Required | Description | | --- | --- | --- | @@ -34,7 +34,7 @@ go build Execute after the compilation is successful: ````shell -./layotto start -c ../../configs/config_sequencer_zookeeper.json +./layotto start -c ../../configs/config_zookeeper.json ```` ## Run Demo diff --git a/docs/en/component_specs/state/common.md b/docs/en/component_specs/state/common.md index f880372c34..de5fb40c59 100644 --- a/docs/en/component_specs/state/common.md +++ b/docs/en/component_specs/state/common.md @@ -20,7 +20,7 @@ The json configuration file has the following structure: } } ``` -You can configure the key/value configuration items that the component cares about in the metadata. For example, [redis component configuration](https://github.com/mosn/layotto/blob/main/configs/config_state_redis.json) is as follows: +You can configure the key/value configuration items that the component cares about in the metadata. For example, [redis component configuration](https://github.com/mosn/layotto/blob/main/configs/config_redis.json) is as follows: ```json "state": { diff --git a/docs/en/component_specs/state/redis.md b/docs/en/component_specs/state/redis.md index 6da6a85ea8..89dd5f88fb 100644 --- a/docs/en/component_specs/state/redis.md +++ b/docs/en/component_specs/state/redis.md @@ -1,7 +1,7 @@ # Redis ## metadata fields -Example: configs/config_state_redis.json +Example: configs/config_redis.json | Field | Required | Description | | --- | --- | --- | diff --git a/docs/en/development/developing-component.md b/docs/en/development/developing-component.md index 10d16ed074..dba84e7e35 100644 --- a/docs/en/development/developing-component.md +++ b/docs/en/development/developing-component.md @@ -90,7 +90,7 @@ As mentioned above: So how to configure when users want to use Zookeeper? We need to provide a sample configuration, for both user reference and running integration tests -We can copy a json configuration file from another component. For example, copy configs/config_lock_redis.json and paste it into configs/config_lock_zookeeper.json when developing a plug-in component +We can copy a json configuration file from another component. For example, copy configs/config_redis.json and paste it into configs/config_zookeeper.json when developing a plug-in component Then edit and modify the configuration shown below: ![img_3.png](../../img/development/component/img_3.png) diff --git a/docs/en/start/actuator/start.md b/docs/en/start/actuator/start.md index b3f4020aaa..33153eb6c7 100644 --- a/docs/en/start/actuator/start.md +++ b/docs/en/start/actuator/start.md @@ -27,7 +27,7 @@ go build After completion, the layotto file will be generated in the directory, run it: ```shell @background -./layotto start -c ../../configs/config_in_memory.json +./layotto start -c ../../configs/config_standalone.json ``` >Q: The demo report an error? diff --git a/docs/en/start/api_plugin/helloworld.md b/docs/en/start/api_plugin/helloworld.md index 5e1af4fdff..285bc57836 100644 --- a/docs/en/start/api_plugin/helloworld.md +++ b/docs/en/start/api_plugin/helloworld.md @@ -20,7 +20,7 @@ go build -o layotto Run Layotto: ```shell @background -./layotto start -c ../../configs/config_in_memory.json +./layotto start -c ../../configs/config_standalone.json ``` Q: What happened? diff --git a/docs/en/start/lock/start.md b/docs/en/start/lock/start.md index f1779819e8..813514631e 100644 --- a/docs/en/start/lock/start.md +++ b/docs/en/start/lock/start.md @@ -52,7 +52,7 @@ go build The layotto file will be generated in the directory, run it: ```shell @background -./layotto start -c ../../configs/config_lock_redis.json +./layotto start -c ../../configs/config_redis.json ``` ### Step 3. Run the client program, call Layotto to add, delete, modify and query diff --git a/docs/en/start/secret/start.md b/docs/en/start/secret/start.md index 919c013623..db00579c0f 100644 --- a/docs/en/start/secret/start.md +++ b/docs/en/start/secret/start.md @@ -25,7 +25,7 @@ go build -o layotto Once finished, the layotto file will be generated in the directory, run it: ```shell @background -./layotto start -c ../../configs/config_secret_file.json +./layotto start -c ../../configs/config_standalone.json ``` ### Step 2: Run the client program and call Layotto to generate a unique id diff --git a/docs/en/start/sequencer/start.md b/docs/en/start/sequencer/start.md index 63f3508370..a6d2e6642b 100644 --- a/docs/en/start/sequencer/start.md +++ b/docs/en/start/sequencer/start.md @@ -42,7 +42,7 @@ go build Once finished, the layotto file will be generated in the directory, run it: ```shell @background -./layotto start -c ../../configs/config_sequencer_etcd.json +./layotto start -c ../../configs/runtime_config.json ``` ### Step 3: Run the client program and call Layotto to generate a unique id diff --git a/docs/en/start/state/start.md b/docs/en/start/state/start.md index 133d8227ce..0aac9b368b 100644 --- a/docs/en/start/state/start.md +++ b/docs/en/start/state/start.md @@ -58,7 +58,7 @@ go build -o layotto The layotto file will be generated in the directory, run it: ```shell @background -./layotto start -c ../../configs/config_state_redis.json +./layotto start -c ../../configs/config_redis.json ``` ### step 3. Run the client program, call Layotto to add, delete, modify and query diff --git a/docs/zh/component_specs/custom/common.md b/docs/zh/component_specs/custom/common.md index 9481eeb498..f7558eb58b 100644 --- a/docs/zh/component_specs/custom/common.md +++ b/docs/zh/component_specs/custom/common.md @@ -35,7 +35,7 @@ Layotto 中的组件分为两种: 您可以在metadata里配置组件关心的key/value配置。 ## 示例 -例如,在`configs/config_in_memory.json` 中,配置了 kind 是`helloworld` 的 `CustomComponent`,只有一个组件,其组件名是 `demo`, type 是 `in-memory`: +例如,在`configs/config_standalone.json` 中,配置了 kind 是`helloworld` 的 `CustomComponent`,只有一个组件,其组件名是 `demo`, type 是 `in-memory`: ```json "custom_component": { diff --git a/docs/zh/component_specs/lock/common.md b/docs/zh/component_specs/lock/common.md index cb15d5eece..3b8cb65b04 100644 --- a/docs/zh/component_specs/lock/common.md +++ b/docs/zh/component_specs/lock/common.md @@ -21,7 +21,7 @@ json配置文件有如下结构: } ``` -您可以在metadata里配置组件关心的key/value配置。例如[redis组件的配置](https://github.com/mosn/layotto/blob/main/configs/config_lock_redis.json) 如下: +您可以在metadata里配置组件关心的key/value配置。例如[redis组件的配置](https://github.com/mosn/layotto/blob/main/configs/config_redis.json) 如下: ```json "lock": { diff --git a/docs/zh/component_specs/lock/consul.md b/docs/zh/component_specs/lock/consul.md index 0093040a88..a602cbff4d 100644 --- a/docs/zh/component_specs/lock/consul.md +++ b/docs/zh/component_specs/lock/consul.md @@ -2,7 +2,7 @@ ## 配置项说明 -示例:configs/config_lock_consul.json +示例:configs/config_consul.json | 字段 | 必填 | 说明 | | --- | --- | --- | diff --git a/docs/zh/component_specs/lock/etcd.md b/docs/zh/component_specs/lock/etcd.md index 56927b89ce..4a65e87990 100644 --- a/docs/zh/component_specs/lock/etcd.md +++ b/docs/zh/component_specs/lock/etcd.md @@ -1,7 +1,7 @@ # Etcd ## 配置项说明 -示例:configs/config_lock_etcd.json +示例:configs/runtime_config.json | 字段 | 必填 | 说明 | | --- | --- | --- | @@ -39,7 +39,7 @@ go build 编译成功后执行: ````shell -./layotto start -c ../../configs/config_lock_etcd.json +./layotto start -c ../../configs/runtime_config.json ```` ## 运行 Demo diff --git a/docs/zh/component_specs/lock/in-memory.md b/docs/zh/component_specs/lock/in-memory.md index cffe4e40ff..802d6b9047 100644 --- a/docs/zh/component_specs/lock/in-memory.md +++ b/docs/zh/component_specs/lock/in-memory.md @@ -2,7 +2,7 @@ ## 配置项说明 -直接使用配置:configs/config_in_memory.json +直接使用配置:configs/config_standalone.json ## 启动 layotto @@ -13,7 +13,7 @@ go build ```` 编译成功后执行: ````shell -./layotto start -c ../../configs/config_in_memory.json +./layotto start -c ../../configs/config_standalone.json ```` ## 运行 Demo diff --git a/docs/zh/component_specs/lock/mongo.md b/docs/zh/component_specs/lock/mongo.md index 930f673a90..78f17eec41 100644 --- a/docs/zh/component_specs/lock/mongo.md +++ b/docs/zh/component_specs/lock/mongo.md @@ -2,7 +2,7 @@ ## 配置项说明 -示例:configs/config_lock_mongo.json +示例:configs/config_mongo.json | 字段 | 必填 | 说明 | | --- | --- | --- | diff --git a/docs/zh/component_specs/lock/redis.md b/docs/zh/component_specs/lock/redis.md index 2cd8dafc99..67cedf3e1a 100644 --- a/docs/zh/component_specs/lock/redis.md +++ b/docs/zh/component_specs/lock/redis.md @@ -1,7 +1,7 @@ # Redis ## 配置项说明 -示例:configs/config_lock_redis.json +示例:configs/config_redis.json | 字段 | 必填 | 说明 | | --- | --- | --- | @@ -20,6 +20,7 @@ docker run -itd --name redis-test -p 6380:6379 redis ## 配置项说明 示例:configs/config_lock_redis_cluter.json + | 字段 | 必填 | 说明 | | --- | --- | --- | | redisHosts | Y | redis节点地址,多个节点以','隔开,例如localhost:6381,localhost:6382 | diff --git a/docs/zh/component_specs/lock/zookeeper.md b/docs/zh/component_specs/lock/zookeeper.md index b7b6ae3199..a26dda7acb 100644 --- a/docs/zh/component_specs/lock/zookeeper.md +++ b/docs/zh/component_specs/lock/zookeeper.md @@ -2,7 +2,7 @@ ## 配置项说明 -示例:configs/config_lock_zookeeper.json +示例:configs/config_zookeeper.json | 字段 | 必填 | 说明 | | --- | --- | --- | @@ -32,7 +32,7 @@ go build 编译成功后执行: ````shell -./layotto start -c ../../configs/config_lock_zookeeper.json +./layotto start -c ../../configs/config_zookeeper.json ```` ## 运行 Demo diff --git a/docs/zh/component_specs/sequencer/common.md b/docs/zh/component_specs/sequencer/common.md index e5308862fa..8ce82b73bb 100644 --- a/docs/zh/component_specs/sequencer/common.md +++ b/docs/zh/component_specs/sequencer/common.md @@ -29,7 +29,7 @@ json配置文件有如下结构: } ``` -您可以在metadata里配置组件关心的key/value配置。例如[etcd组件的配置](https://github.com/mosn/layotto/blob/main/configs/config_sequencer_etcd.json) 如下: +您可以在metadata里配置组件关心的key/value配置。例如[etcd组件的配置](https://github.com/mosn/layotto/blob/main/configs/runtime_config.json) 如下: ```json "sequencer": { diff --git a/docs/zh/component_specs/sequencer/etcd.md b/docs/zh/component_specs/sequencer/etcd.md index 9ce8147fac..d7123d291f 100644 --- a/docs/zh/component_specs/sequencer/etcd.md +++ b/docs/zh/component_specs/sequencer/etcd.md @@ -1,7 +1,7 @@ # Etcd ## 配置项说明 -示例:configs/config_sequencer_etcd.json +示例:configs/runtime_config.json | 字段 | 必填 | 说明 | | --- | --- | --- | @@ -39,7 +39,7 @@ go build 编译成功后执行: ````shell -./layotto start -c ../../configs/config_sequencer_etcd.json +./layotto start -c ../../configs/runtime_config.json ```` ## 运行 Demo diff --git a/docs/zh/component_specs/sequencer/in-memory.md b/docs/zh/component_specs/sequencer/in-memory.md index f8a86536fa..ff1217d287 100644 --- a/docs/zh/component_specs/sequencer/in-memory.md +++ b/docs/zh/component_specs/sequencer/in-memory.md @@ -2,7 +2,7 @@ ## 配置项说明 -直接使用配置:configs/config_in_memory.json +直接使用配置:configs/config_standalone.json ## 启动 layotto @@ -13,7 +13,7 @@ go build 编译成功后执行: ```shell @background -./layotto start -c ../../configs/config_in_memory.json +./layotto start -c ../../configs/config_standalone.json ``` ## 运行 Demo diff --git a/docs/zh/component_specs/sequencer/mongo.md b/docs/zh/component_specs/sequencer/mongo.md index 1310ed743d..895eade2cc 100644 --- a/docs/zh/component_specs/sequencer/mongo.md +++ b/docs/zh/component_specs/sequencer/mongo.md @@ -1,7 +1,7 @@ # MongoDB ## 配置项说明 -示例:configs/config_sequencer_mongo.json +示例:configs/config_mongo.json | 字段 | 必填 | 说明 | | --- | --- | --- | diff --git a/docs/zh/component_specs/sequencer/redis.md b/docs/zh/component_specs/sequencer/redis.md index 4659a5f080..4ec751e731 100644 --- a/docs/zh/component_specs/sequencer/redis.md +++ b/docs/zh/component_specs/sequencer/redis.md @@ -1,7 +1,7 @@ # Redis ## 配置项说明 -示例:configs/config_sequencer_redis.json +示例:configs/config_redis.json | 字段 | 必填 | 说明 | | --- | --- | --- | @@ -32,7 +32,7 @@ go build 编译成功后执行: ````shell -./layotto start -c ../../configs/config_sequencer_redis.json +./layotto start -c ../../configs/config_redis.json ```` ## 运行 Demo diff --git a/docs/zh/component_specs/sequencer/zookeeper.md b/docs/zh/component_specs/sequencer/zookeeper.md index fd44773a56..38b1dc3b77 100644 --- a/docs/zh/component_specs/sequencer/zookeeper.md +++ b/docs/zh/component_specs/sequencer/zookeeper.md @@ -2,7 +2,7 @@ ## 配置项说明 -示例:configs/config_sequencer_zookeeper.json +示例:configs/config_zookeeper.json | 字段 | 必填 | 说明 | | --- | --- | --- | @@ -37,7 +37,7 @@ go build 编译成功后执行: ````shell -./layotto start -c ../../configs/config_sequencer_zookeeper.json +./layotto start -c ../../configs/config_zookeeper.json ```` ## 运行 Demo diff --git a/docs/zh/component_specs/state/common.md b/docs/zh/component_specs/state/common.md index 6da16cc14a..80b013288b 100644 --- a/docs/zh/component_specs/state/common.md +++ b/docs/zh/component_specs/state/common.md @@ -21,7 +21,7 @@ json配置文件有如下结构: } ``` -您可以在metadata里配置组件关心的key/value配置。例如[redis组件的配置](https://github.com/mosn/layotto/blob/main/configs/config_state_redis.json) 如下: +您可以在metadata里配置组件关心的key/value配置。例如[redis组件的配置](https://github.com/mosn/layotto/blob/main/configs/config_redis.json) 如下: ```json "state": { diff --git a/docs/zh/component_specs/state/redis.md b/docs/zh/component_specs/state/redis.md index 78890ac55a..5d33ce0d5d 100644 --- a/docs/zh/component_specs/state/redis.md +++ b/docs/zh/component_specs/state/redis.md @@ -1,7 +1,7 @@ # Redis ## 配置项说明 -示例:configs/config_state_redis.json +示例:configs/config_redis.json | 字段 | 必填 | 说明 | | --- | --- | --- | diff --git a/docs/zh/design/api_plugin/design.md b/docs/zh/design/api_plugin/design.md index 7f56191253..ab4a208c50 100644 --- a/docs/zh/design/api_plugin/design.md +++ b/docs/zh/design/api_plugin/design.md @@ -325,7 +325,7 @@ func NewRuntimeGrpcServer(data json.RawMessage, opts ...grpc.ServerOption) (mgrp cd ${project_path}/cmd/layotto_multiple_api go build -o layotto # run it -./layotto start -c ../../configs/config_in_memory.json +./layotto start -c ../../configs/config_standalone.json ``` Layotto 启动过程中,会回调每个注册进来的 API 的生命周期方法(Init,Register) diff --git a/docs/zh/development/developing-component.md b/docs/zh/development/developing-component.md index 2d55b9383f..657f57984e 100644 --- a/docs/zh/development/developing-component.md +++ b/docs/zh/development/developing-component.md @@ -89,7 +89,7 @@ 那么用户怎么配"我要用zookeeper"呢? 我们需要给一个示例配置,一方面供用户参考,一方面拿来跑集成测试 -可以复制一份别的组件的json配置文件,例如开发分布式锁组件的时候,复制configs/config_lock_redis.json,粘贴成configs/config_lock_zookeeper.json +可以复制一份别的组件的json配置文件,例如开发分布式锁组件的时候,复制configs/config_redis.json,粘贴成configs/config_zookeeper.json 之后编辑修改一下图中的配置: diff --git a/docs/zh/development/test-quickstart.md b/docs/zh/development/test-quickstart.md index e3a4e11268..b8bd4d3d93 100644 --- a/docs/zh/development/test-quickstart.md +++ b/docs/zh/development/test-quickstart.md @@ -119,7 +119,7 @@ docker rm -f redis-test 其中有一段脚本会运行 Layotto, 但是如果运行它就会 hang 住,导致测试工具没法继续运行下一条命令: ```bash -./layotto start -c ../../configs/config_state_redis.json +./layotto start -c ../../configs/config_redis.json ``` 怎么办呢? @@ -130,7 +130,7 @@ docker rm -f redis-test ~~~ ```shell @background -./layotto start -c ../../configs/config_in_memory.json +./layotto start -c ../../configs/config_standalone.json ``` ~~~ @@ -140,12 +140,12 @@ docker rm -f redis-test ```bash ```bash - ./layotto start -c ../../configs/config_state_redis.json + ./layotto start -c ../../configs/config_redis.json ``` ``` diff --git a/docs/zh/start/actuator/start.md b/docs/zh/start/actuator/start.md index b6d5ee4175..5d74bdf7aa 100644 --- a/docs/zh/start/actuator/start.md +++ b/docs/zh/start/actuator/start.md @@ -26,7 +26,7 @@ go build -o layotto 完成后目录下会生成 layotto 文件,运行它: ```shell @background -./layotto start -c ../../configs/config_in_memory.json +./layotto start -c ../../configs/config_standalone.json ``` ### 访问健康检查接口 diff --git a/docs/zh/start/api_plugin/helloworld.md b/docs/zh/start/api_plugin/helloworld.md index 5e1af4fdff..285bc57836 100644 --- a/docs/zh/start/api_plugin/helloworld.md +++ b/docs/zh/start/api_plugin/helloworld.md @@ -20,7 +20,7 @@ go build -o layotto Run Layotto: ```shell @background -./layotto start -c ../../configs/config_in_memory.json +./layotto start -c ../../configs/config_standalone.json ``` Q: What happened? diff --git a/docs/zh/start/lock/start.md b/docs/zh/start/lock/start.md index a8127c539e..bdafd11685 100644 --- a/docs/zh/start/lock/start.md +++ b/docs/zh/start/lock/start.md @@ -53,7 +53,7 @@ go build -o layotto 完成后目录下会生成layotto文件,运行它: ```shell @background -./layotto start -c ../../configs/config_lock_redis.json +./layotto start -c ../../configs/config_redis.json ``` ### 第三步:运行客户端程序,调用Layotto抢锁/解锁 diff --git a/docs/zh/start/secret/start.md b/docs/zh/start/secret/start.md index f43e4f9a55..a881397b56 100644 --- a/docs/zh/start/secret/start.md +++ b/docs/zh/start/secret/start.md @@ -22,7 +22,7 @@ go build -o layotto 完成后目录下会生成layotto文件,运行它: ```shell @background -./layotto start -c ../../configs/config_secret_file.json +./layotto start -c ../../configs/config_standalone.json ``` ### 第二步:运行客户端程序,调用Layotto生成唯一id diff --git a/docs/zh/start/sequencer/start.md b/docs/zh/start/sequencer/start.md index 599db161f2..08af7292ae 100644 --- a/docs/zh/start/sequencer/start.md +++ b/docs/zh/start/sequencer/start.md @@ -44,7 +44,7 @@ go build -o layotto 完成后目录下会生成layotto文件,运行它: ```shell @background -./layotto start -c ../../configs/config_sequencer_etcd.json +./layotto start -c ../../configs/runtime_config.json ``` ### 第三步:运行客户端程序,调用Layotto生成唯一id diff --git a/docs/zh/start/state/start.md b/docs/zh/start/state/start.md index 67f125958e..44e4cc7c66 100644 --- a/docs/zh/start/state/start.md +++ b/docs/zh/start/state/start.md @@ -61,7 +61,7 @@ go build -o layotto 完成后目录下会生成layotto文件,运行它: ```shell @background -./layotto start -c ../../configs/config_state_redis.json +./layotto start -c ../../configs/config_redis.json ``` ### 第三步:运行客户端程序,调用Layotto进行增删改查 diff --git a/sdk/go-sdk/test/runtime/integrate_test.sh b/sdk/go-sdk/test/runtime/integrate_test.sh index 03e25551da..cd32bd12cf 100644 --- a/sdk/go-sdk/test/runtime/integrate_test.sh +++ b/sdk/go-sdk/test/runtime/integrate_test.sh @@ -15,7 +15,7 @@ # go build ./cmd/layotto -nohup redis-server & -nohup ./layotto start -c ./configs/integrate_config.json & +nohup redis-server -p 6380 & +nohup ./layotto start -c ./configs/runtime_config.json & cd sdk/go-sdk/test/runtime go test -p 1 -v ./... \ No newline at end of file From 3d7ba877ade8c4d08e2f2d5dda08fd196e0a8235 Mon Sep 17 00:00:00 2001 From: seeflood Date: Wed, 25 May 2022 16:21:07 +0800 Subject: [PATCH 2/8] fix command Signed-off-by: seeflood --- sdk/go-sdk/test/runtime/integrate_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/go-sdk/test/runtime/integrate_test.sh b/sdk/go-sdk/test/runtime/integrate_test.sh index cd32bd12cf..274839eba3 100644 --- a/sdk/go-sdk/test/runtime/integrate_test.sh +++ b/sdk/go-sdk/test/runtime/integrate_test.sh @@ -15,7 +15,7 @@ # go build ./cmd/layotto -nohup redis-server -p 6380 & +nohup redis-server --port 6380 & nohup ./layotto start -c ./configs/runtime_config.json & cd sdk/go-sdk/test/runtime go test -p 1 -v ./... \ No newline at end of file From 384da91307a42434e890ecd6123154e7ce3e7808 Mon Sep 17 00:00:00 2001 From: seeflood Date: Wed, 25 May 2022 16:59:19 +0800 Subject: [PATCH 3/8] use 34904 instead Signed-off-by: seeflood --- sdk/go-sdk/test/runtime/redis_integrate_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/go-sdk/test/runtime/redis_integrate_test.go b/sdk/go-sdk/test/runtime/redis_integrate_test.go index 506e2222c1..0dd1c22c64 100644 --- a/sdk/go-sdk/test/runtime/redis_integrate_test.go +++ b/sdk/go-sdk/test/runtime/redis_integrate_test.go @@ -31,7 +31,7 @@ import ( var componentName = "state_demo" func TestHelloApi(t *testing.T) { - cli, err := client.NewClientWithAddress("127.0.0.1:11104") + cli, err := client.NewClientWithAddress("127.0.0.1:34904") if err != nil { t.Fatal(err) } @@ -44,11 +44,11 @@ func TestHelloApi(t *testing.T) { } helloResp, err := cli.SayHello(ctx, helloReq) assert.Nil(t, err) - assert.Equal(t, "welcome layotto", helloResp.Hello) + assert.Equal(t, "greeting", helloResp.Hello) } func TestStateApi(t *testing.T) { - cli, err := client.NewClientWithAddress("127.0.0.1:11104") + cli, err := client.NewClientWithAddress("127.0.0.1:34904") if err != nil { t.Fatal(err) } @@ -67,7 +67,7 @@ func TestStateApi(t *testing.T) { } func TestLockApi(t *testing.T) { - cli, err := client.NewClientWithAddress("127.0.0.1:11104") + cli, err := client.NewClientWithAddress("127.0.0.1:34904") if err != nil { t.Fatal(err) } @@ -138,7 +138,7 @@ func TestLockApi(t *testing.T) { } func TestSequencerApi(t *testing.T) { - cli, err := client.NewClientWithAddress("127.0.0.1:11104") + cli, err := client.NewClientWithAddress("127.0.0.1:34904") if err != nil { t.Fatal(err) } From 819a29a4249830487f05b128df6fb10a55b4e051 Mon Sep 17 00:00:00 2001 From: seeflood Date: Wed, 25 May 2022 17:12:36 +0800 Subject: [PATCH 4/8] fix script Signed-off-by: seeflood --- sdk/go-sdk/test/runtime/integrate_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/go-sdk/test/runtime/integrate_test.sh b/sdk/go-sdk/test/runtime/integrate_test.sh index 274839eba3..ff0625d000 100644 --- a/sdk/go-sdk/test/runtime/integrate_test.sh +++ b/sdk/go-sdk/test/runtime/integrate_test.sh @@ -16,6 +16,6 @@ go build ./cmd/layotto nohup redis-server --port 6380 & -nohup ./layotto start -c ./configs/runtime_config.json & +nohup ./layotto start -c ./configs/config_redis.json & cd sdk/go-sdk/test/runtime go test -p 1 -v ./... \ No newline at end of file From 3935029ed591e81260102c43a8176c7d171361f9 Mon Sep 17 00:00:00 2001 From: seeflood Date: Wed, 25 May 2022 18:33:12 +0800 Subject: [PATCH 5/8] fix demo Signed-off-by: seeflood --- cmd/layotto_multiple_api/client/main.go | 3 ++ .../helloworld/grpc_api.go | 2 +- cmd/layotto_multiple_api/main.go | 39 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/cmd/layotto_multiple_api/client/main.go b/cmd/layotto_multiple_api/client/main.go index 1182a71859..0d67ecabfe 100644 --- a/cmd/layotto_multiple_api/client/main.go +++ b/cmd/layotto_multiple_api/client/main.go @@ -55,4 +55,7 @@ func main() { log.Fatalf("could not greet: %v", err) } log.Printf("Greeting: %s", r.GetMessage()) + if r.GetMessage() != "Hello world" { + panic("Response message is not `Hello world`. I don't know why!") + } } diff --git a/cmd/layotto_multiple_api/helloworld/grpc_api.go b/cmd/layotto_multiple_api/helloworld/grpc_api.go index 435e79ba34..5b53a6a34b 100644 --- a/cmd/layotto_multiple_api/helloworld/grpc_api.go +++ b/cmd/layotto_multiple_api/helloworld/grpc_api.go @@ -33,7 +33,7 @@ import ( const kind = "helloworld" // This demo will always use this component name. -const componentName = "in-memory" +const componentName = "demo" func NewHelloWorldAPI(ac *grpc_api.ApplicationContext) grpc.GrpcAPI { // 1. convert custom components diff --git a/cmd/layotto_multiple_api/main.go b/cmd/layotto_multiple_api/main.go index 5586b56168..aef59ed762 100644 --- a/cmd/layotto_multiple_api/main.go +++ b/cmd/layotto_multiple_api/main.go @@ -22,6 +22,18 @@ import ( "strconv" "time" + "github.com/dapr/components-contrib/secretstores" + "github.com/dapr/components-contrib/secretstores/aws/parameterstore" + "github.com/dapr/components-contrib/secretstores/aws/secretmanager" + "github.com/dapr/components-contrib/secretstores/azure/keyvault" + gcp_secretmanager "github.com/dapr/components-contrib/secretstores/gcp/secretmanager" + "github.com/dapr/components-contrib/secretstores/hashicorp/vault" + sercetstores_kubernetes "github.com/dapr/components-contrib/secretstores/kubernetes" + secretstore_env "github.com/dapr/components-contrib/secretstores/local/env" + secretstore_file "github.com/dapr/components-contrib/secretstores/local/file" + + secretstores_loader "mosn.io/layotto/pkg/runtime/secretstores" + "mosn.io/api" _ "mosn.io/mosn/pkg/filter/stream/grpcmetric" "mosn.io/mosn/pkg/stagemanager" @@ -392,6 +404,33 @@ func NewRuntimeGrpcServer(data json.RawMessage, opts ...grpc.ServerOption) (mgrp return sequencer_inmemory.NewInMemorySequencer() }), ), + // secretstores + runtime.WithSecretStoresFactory( + secretstores_loader.NewFactory("kubernetes", func() secretstores.SecretStore { + return sercetstores_kubernetes.NewKubernetesSecretStore(loggerForDaprComp) + }), + secretstores_loader.NewFactory("azure.keyvault", func() secretstores.SecretStore { + return keyvault.NewAzureKeyvaultSecretStore(loggerForDaprComp) + }), + secretstores_loader.NewFactory("hashicorp.vault", func() secretstores.SecretStore { + return vault.NewHashiCorpVaultSecretStore(loggerForDaprComp) + }), + secretstores_loader.NewFactory("aws.secretmanager", func() secretstores.SecretStore { + return secretmanager.NewSecretManager(loggerForDaprComp) + }), + secretstores_loader.NewFactory("aws.parameterstore", func() secretstores.SecretStore { + return parameterstore.NewParameterStore(loggerForDaprComp) + }), + secretstores_loader.NewFactory("gcp.secretmanager", func() secretstores.SecretStore { + return gcp_secretmanager.NewSecreteManager(loggerForDaprComp) + }), + secretstores_loader.NewFactory("local.file", func() secretstores.SecretStore { + return secretstore_file.NewLocalSecretStore(loggerForDaprComp) + }), + secretstores_loader.NewFactory("local.env", func() secretstores.SecretStore { + return secretstore_env.NewEnvSecretStore(loggerForDaprComp) + }), + ), // Custom components runtime.WithCustomComponentFactory("helloworld", custom.NewComponentFactory("in-memory", component.NewInMemoryHelloWorld), From 403d61858cc8dd151dcc3be1ae93adbef4cd285b Mon Sep 17 00:00:00 2001 From: seeflood Date: Thu, 26 May 2022 11:03:47 +0800 Subject: [PATCH 6/8] fix tracing quickstart Signed-off-by: seeflood --- configs/config_standalone.json | 22 +++++++++++++++++++++- docs/en/start/api_plugin/helloworld.md | 1 + docs/en/start/trace/trace.md | 12 ++++++------ docs/zh/start/trace/trace.md | 18 +++++++++--------- 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/configs/config_standalone.json b/configs/config_standalone.json index b4eb45784f..5e83dd51d6 100644 --- a/configs/config_standalone.json +++ b/configs/config_standalone.json @@ -121,5 +121,25 @@ } ] } - ] + ], + "tracing": { + "enable": true, + "driver": "SOFATracer", + "config": { + "generator": "mosntracing", + "exporter": [ + "stdout" + ] + } + }, + "metrics": { + "sinks": [ + { + "type": "prometheus", + "config": { + "port": 34903 + } + } + ] + } } diff --git a/docs/en/start/api_plugin/helloworld.md b/docs/en/start/api_plugin/helloworld.md index 285bc57836..84284a5da8 100644 --- a/docs/en/start/api_plugin/helloworld.md +++ b/docs/en/start/api_plugin/helloworld.md @@ -19,6 +19,7 @@ go build -o layotto ``` Run Layotto: + ```shell @background ./layotto start -c ../../configs/config_standalone.json ``` diff --git a/docs/en/start/trace/trace.md b/docs/en/start/trace/trace.md index 8a068bdad2..89eb152c31 100644 --- a/docs/en/start/trace/trace.md +++ b/docs/en/start/trace/trace.md @@ -1,10 +1,10 @@ -# Observability (trace, metric) +# Observability (Tracing, Metrics) -## trace +## 1. Tracing ### Features -In [runtime_config.json](https://github.com/mosn/layotto/blob/main/configs/runtime_config.json), there is a paragraph about trace configuration as follows: +In [config_standalone.json](https://github.com/mosn/layotto/blob/main/configs/config_standalone.json), there is a paragraph about trace configuration as follows: ```json [ @@ -36,7 +36,7 @@ go build -o layotto - Run it ```shell @background -./layotto start -c ../../configs/runtime_config.json +./layotto start -c ../../configs/config_standalone.json ``` The corresponding client demo is in [client.go](https://github.com/mosn/layotto/blob/main/demo/flowcontrol/client.go), running it will call the SayHello API of layotto: @@ -151,9 +151,9 @@ The results printed by trace are as follows: ![img.png](../../../img/trace/trace.png) -## Metric +## 2. Metrics -Layotto's metric reuses mosn's metric, and connects to prometheus. An example of metric configuration is provided in [runtime_config.json](https://github.com/mosn/layotto/blob/main/configs/runtime_config.json), follow the above steps to start layotto After that, you can read the metric information through the following command: +Layotto's metric reuses mosn's metric, and connects to prometheus. An example of metric configuration is provided in [config_standalone.json](https://github.com/mosn/layotto/blob/main/configs/config_standalone.json), follow the above steps to start layotto After that, you can read the metric information through the following command: ```shell curl --location --request GET 'http://127.0.0.1:34903/metrics' diff --git a/docs/zh/start/trace/trace.md b/docs/zh/start/trace/trace.md index 1ce554752d..4157bdac1d 100644 --- a/docs/zh/start/trace/trace.md +++ b/docs/zh/start/trace/trace.md @@ -1,10 +1,10 @@ # 可观测性 -## Trace管理 +## 1. Trace管理 ### 功能介绍 -在[runtime_config.json](https://github.com/mosn/layotto/blob/main/configs/runtime_config.json) 中,有一段关于trace的配置如下: +在[config_standalone.json](https://github.com/mosn/layotto/blob/main/configs/config_standalone.json) 中,有一段关于trace的配置如下: ```json [ @@ -36,7 +36,7 @@ go build -o layotto 运行: ```shell @background -./layotto start -c ../../configs/runtime_config.json +./layotto start -c ../../configs/config_standalone.json ``` 对应的调用端代码在[client.go](https://github.com/mosn/layotto/blob/main/demo/flowcontrol/client.go) 中,运行它会调用layotto的SayHello接口: @@ -71,9 +71,9 @@ trace拓展配置: ### Trace 原理 -Layotto中的 Tracing 主要是对grpc调用进行记录,依赖于在grpc里添加的两个拦截器: [UnaryInterceptorFilter](https://github.com/mosn/layotto/blob/main/diagnostics/grpc_tracing.go) 、 [StreamInterceptorFilter](https://github.com/mosn/layotto/blob/main/diagnostics/grpc_tracing.go) +Layotto中的 Tracing 会对grpc调用进行记录,依赖于在grpc里添加的两个拦截器: [UnaryInterceptorFilter](https://github.com/mosn/layotto/blob/main/diagnostics/grpc_tracing.go) 、 [StreamInterceptorFilter](https://github.com/mosn/layotto/blob/main/diagnostics/grpc_tracing.go) -拦截器在每次grpc方法调用时都会开启一次tracing,生成traceId spanId、新的context,记录方法名、时间,并且会将tracing信息通过context透传下去,方法返回时将span信息导出。 +拦截器在每次grpc方法调用时都会开启一次tracing,生成traceId spanId、新的context,记录方法名、时间,并且会将tracing信息通过context透传下去,请求处理结束后会将span信息导出。 ### Trace 框架的设计 @@ -151,11 +151,11 @@ trace打印的结果如下: ![img.png](../../../img/trace/trace.png) -## Metrics管理 +## 2. Metrics管理 -layotto的metrics复用的mosn的metrics,对接prometheus。 +layotto 复用了 mosn 的 Metrics 功能,可以对接各种 Metrics 平台,比如 prometheus。 -[runtime_config.json](https://github.com/mosn/layotto/blob/main/configs/runtime_config.json) 中提供了metric配置的示例,按照上述步骤启动layotto后,可以通过以下指令读取 metrics 信息: +[config_standalone.json](https://github.com/mosn/layotto/blob/main/configs/config_standalone.json) 中提供了metric配置的示例,按照上述步骤启动layotto后,可以通过以下指令读取 metrics 信息: ```shell @@ -167,7 +167,7 @@ curl --location --request GET 'http://127.0.0.1:34903/metrics' ![img.png](../../../img/trace/metric.png) ### 配置解释 -解释一下[runtime_config.json](https://github.com/mosn/layotto/blob/main/configs/runtime_config.json) 里 metrics 相关配置 +解释一下[config_standalone.json](https://github.com/mosn/layotto/blob/main/configs/config_standalone.json) 里 metrics 相关配置 #### 埋点、统计 From 38fcee75802caf24aade1f3b6201f7ad451f869e Mon Sep 17 00:00:00 2001 From: seeflood Date: Thu, 26 May 2022 11:24:12 +0800 Subject: [PATCH 7/8] fix prometheus.md Signed-off-by: seeflood --- demo/flowcontrol/client.go | 2 +- docs/en/start/trace/prometheus.md | 2 +- docs/zh/start/trace/prometheus.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demo/flowcontrol/client.go b/demo/flowcontrol/client.go index f4c881c007..870abc07ca 100644 --- a/demo/flowcontrol/client.go +++ b/demo/flowcontrol/client.go @@ -27,7 +27,7 @@ import ( ) func main() { - conn, err := grpc.Dial("127.0.0.1:34904", grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(time.Second)) + conn, err := grpc.Dial("127.0.0.1:34904", grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(2*time.Second)) if err != nil { panic(err) } diff --git a/docs/en/start/trace/prometheus.md b/docs/en/start/trace/prometheus.md index 2629219588..a91094c4aa 100644 --- a/docs/en/start/trace/prometheus.md +++ b/docs/en/start/trace/prometheus.md @@ -29,7 +29,7 @@ go build -o layotto Run it: ```shell @background -./layotto start -c ../../configs/config_trace_skywalking.json +./layotto start -c ../../configs/config_standalone.json ``` ## Run Demo diff --git a/docs/zh/start/trace/prometheus.md b/docs/zh/start/trace/prometheus.md index 5945b3d454..6a8648ab9e 100644 --- a/docs/zh/start/trace/prometheus.md +++ b/docs/zh/start/trace/prometheus.md @@ -31,7 +31,7 @@ go build -o layotto 运行: ```shell @background -./layotto start -c ../../configs/runtime_config.json +./layotto start -c ../../configs/config_standalone.json ``` ## 运行 Demo From 8d863b548b425488e8021efe2ac090d9ab6cdd67 Mon Sep 17 00:00:00 2001 From: seeflood Date: Thu, 26 May 2022 14:21:30 +0800 Subject: [PATCH 8/8] fix doc Signed-off-by: seeflood --- demo/pubsub/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/demo/pubsub/README.md b/demo/pubsub/README.md index af504b69c2..1a45e305bb 100644 --- a/demo/pubsub/README.md +++ b/demo/pubsub/README.md @@ -3,16 +3,16 @@ It is worth noting that both server and client demo should set the same store na For example: ```shell cd ${project_path}/demo/pubsub/server/ -// 1. start subscriber +# 1. start subscriber go build -o subscriber /.subscriber -s pub_subs_demo -// 2. start layotto +# 2. start layotto cd ${project_path}/cmd/layotto go build -o layotto -./layotto start -c ../../configs/config_in_memory.json +./layotto start -c ../../configs/config_standalone.json -// 3. start publisher +# 3. start publisher cd ${project_path}/demo/pubsub/client/ go build -o publisher ./publisher -s pub_subs_demo