mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
compose.network.yml brings up three ghcr.io/hanzoai/base:dev pods in a
quasar quorum (N=3, k=2) plus a gateway using the base-network upstream
type (shipped in hanzo/gateway). Ports 18080 (gateway), 18090-18092
(direct pod access). Kill any one base-* to exercise quorum failure
tolerance.
hack/gateway.network.json configures the gateway side of the stack:
three endpoints (GET/POST/DELETE on /api/{path}) backed by the
base-network upstream with shard_key_source=header:X-User-Id so the
dev loop doesn't require IAM/Casdoor.
hack/smoke-compose.sh is the end-to-end check: spin up, write a row
through the gateway, kill base-b, read it back, tear down. Exits 0 on
success; exit 2 documents the "Agent #1 /-/base/members not yet in
image" condition so the script is runnable pre-merge.
78 lines
1.8 KiB
JSON
78 lines
1.8 KiB
JSON
{
|
|
"$schema": "https://gateway.hanzo.ai/schema/v3.json",
|
|
"version": 3,
|
|
"name": "Base Network dev gateway",
|
|
"port": 8080,
|
|
"timeout": "30s",
|
|
"output_encoding": "no-op",
|
|
"extra_config": {
|
|
"router": {
|
|
"return_error_msg": true
|
|
},
|
|
"telemetry/logging": {
|
|
"level": "INFO",
|
|
"prefix": "[GATEWAY]",
|
|
"stdout": true
|
|
}
|
|
},
|
|
"endpoints": [
|
|
{
|
|
"endpoint": "/api/{path}",
|
|
"method": "GET",
|
|
"input_headers": ["*"],
|
|
"output_encoding": "no-op",
|
|
"backend": [
|
|
{
|
|
"url_pattern": "/api/{path}",
|
|
"host": ["http://base-a:8090"],
|
|
"encoding": "no-op",
|
|
"extra_config": {
|
|
"github.com/hanzoai/gateway/base-network": {
|
|
"shard_key": "user_id",
|
|
"shard_key_source": "header:X-User-Id"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"endpoint": "/api/{path}",
|
|
"method": "POST",
|
|
"input_headers": ["*"],
|
|
"output_encoding": "no-op",
|
|
"backend": [
|
|
{
|
|
"url_pattern": "/api/{path}",
|
|
"host": ["http://base-a:8090"],
|
|
"encoding": "no-op",
|
|
"extra_config": {
|
|
"github.com/hanzoai/gateway/base-network": {
|
|
"shard_key": "user_id",
|
|
"shard_key_source": "header:X-User-Id"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"endpoint": "/api/{path}",
|
|
"method": "DELETE",
|
|
"input_headers": ["*"],
|
|
"output_encoding": "no-op",
|
|
"backend": [
|
|
{
|
|
"url_pattern": "/api/{path}",
|
|
"host": ["http://base-a:8090"],
|
|
"encoding": "no-op",
|
|
"extra_config": {
|
|
"github.com/hanzoai/gateway/base-network": {
|
|
"shard_key": "user_id",
|
|
"shard_key_source": "header:X-User-Id"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|