feat(registry): add service discovery and health check capabilities

- Integrate tonic-health for gRPC service health monitoring
- Add etcd-based service registration with automatic keep-alive
- Implement dynamic configuration loading from etcd with fallback
- Remove external dependencies from docker-compose for simplified deployment
- Refactor service registration logic with improved lease management
- Add health service to gRPC server with serving status reporting
This commit is contained in:
zhenyi
2026-06-11 22:50:40 +08:00
parent 1ccfd3d626
commit b797e360c0
8 changed files with 73 additions and 326 deletions
+8
View File
@@ -21,6 +21,8 @@ use crate::pb::im::member_service_server::MemberServiceServer;
use crate::pb::im::permission_service_server::PermissionServiceServer;
use crate::pb::im::stage_service_server::StageServiceServer;
use crate::pb::im::voice_service_server::VoiceServiceServer;
use tonic_health::ServingStatus;
use crate::service::AppService;
pub async fn start_grpc_server(
@@ -34,9 +36,15 @@ pub async fn start_grpc_server(
let cs = channel_settings::ChannelSettingsServices::new(service);
let (health_reporter, health_service) = tonic_health::server::health_reporter();
health_reporter
.set_service_status("", ServingStatus::Serving)
.await;
tracing::info!(%addr, "gRPC server listening");
tonic::transport::Server::builder()
.add_service(health_service)
.add_service(TokenServiceServer::new(token_svc))
.add_service(ChannelServiceServer::new(channel_svc))
.add_service(MemberServiceServer::new(member_svc))