Skip to content

Commit

Permalink
Use static membership for devserver
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanos committed Aug 9, 2024
1 parent fd68f38 commit 96d9e10
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion temporalcli/devserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ import (
"go.temporal.io/server/common/cluster"
"go.temporal.io/server/common/config"
"go.temporal.io/server/common/dynamicconfig"
"go.temporal.io/server/common/membership/static"
"go.temporal.io/server/common/metrics"
sqliteplugin "go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite"
"go.temporal.io/server/common/primitives"
"go.temporal.io/server/schema/sqlite"
sqliteschema "go.temporal.io/server/schema/sqlite"
"go.temporal.io/server/temporal"
Expand Down Expand Up @@ -195,6 +197,16 @@ func (s *StartOptions) buildServerOptions() ([]temporal.ServerOption, error) {
opts := []temporal.ServerOption{
temporal.WithConfig(conf),
temporal.ForServices(temporal.DefaultServices),
temporal.WithStaticHosts(map[primitives.ServiceName]static.Hosts{
primitives.FrontendService: static.SingleLocalHost(
fmt.Sprintf("127.0.0.1:%v", conf.Services[string(primitives.FrontendService)].RPC.GRPCPort)),
primitives.MatchingService: static.SingleLocalHost(
fmt.Sprintf("127.0.0.1:%v", conf.Services[string(primitives.MatchingService)].RPC.GRPCPort)),
primitives.HistoryService: static.SingleLocalHost(
fmt.Sprintf("127.0.0.1:%v", conf.Services[string(primitives.HistoryService)].RPC.GRPCPort)),
primitives.WorkerService: static.SingleLocalHost(
fmt.Sprintf("127.0.0.1:%v", conf.Services[string(primitives.WorkerService)].RPC.GRPCPort)),
}),
temporal.WithLogger(logger),
temporal.WithAuthorizer(authorizer),
temporal.WithClaimMapper(func(*config.Config) authorization.ClaimMapper { return claimMapper }),
Expand Down Expand Up @@ -332,6 +344,5 @@ func (s *StartOptions) buildServiceConfig(frontend bool) config.Service {
conf.RPC.GRPCPort = MustGetFreePort(s.FrontendIP)
conf.RPC.BindOnIP = s.FrontendIP
}
conf.RPC.MembershipPort = MustGetFreePort(s.FrontendIP)
return conf
}

0 comments on commit 96d9e10

Please sign in to comment.