From bf109f5be6f991b9eb62872063eedf99630520a1 Mon Sep 17 00:00:00 2001 From: Tine Date: Mon, 19 Feb 2024 15:23:17 +0100 Subject: [PATCH] feat(temporal): temporal needs server worker --- internal/handlers/settings.go | 2 +- pkg/server/server.go | 6 ++---- pkg/temporal/config.go | 22 ++++++++++++++++++---- pkg/temporal/server.go | 2 ++ pkg/temporal/ui.go | 2 +- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/internal/handlers/settings.go b/internal/handlers/settings.go index 86a1731..601cd0f 100644 --- a/internal/handlers/settings.go +++ b/internal/handlers/settings.go @@ -36,7 +36,7 @@ var SettingsPages = []*components.Page{ {Path: "/settings/cronjobs", Title: "Cronjobs", Breadcrumb: "Cronjobs"}, {Path: "/settings/workers", Title: "Workers", Breadcrumb: "Workers"}, {Path: "/settings/workers/create", Title: "Workers Create", Breadcrumb: "Create"}, - {Path: "/temporal", Title: "Temporal", Breadcrumb: "Temporal"}, + {Path: "/settings/temporal", Title: "Temporal", Breadcrumb: "Temporal"}, {Path: "/oauth2/logout", Title: "Logout", Breadcrumb: "Logout"}, } diff --git a/pkg/server/server.go b/pkg/server/server.go index 89ee554..2caba2f 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -66,7 +66,7 @@ func (s *Server) Start() error { r.HandleFunc("/", h.Index).Methods("GET") - // Authenticated routes + // Settings r.HandleFunc("/settings", h.Authenticated(h.SettingsOverviewGET)).Methods("GET") r.HandleFunc("/settings/healthchecks", h.Authenticated(h.SettingsHealthchecksGET)).Methods("GET") r.HandleFunc("/settings/healthchecks/create", h.Authenticated(h.SettingsHealthchecksCreateGET)).Methods("GET") @@ -77,15 +77,13 @@ func (s *Server) Start() error { r.HandleFunc("/settings/workers/create", h.Authenticated(h.SettingsWorkersCreatePOST)).Methods("POST") r.HandleFunc("/settings/workers/{slug}", h.Authenticated(h.SettingsWorkersDescribeGET)).Methods("GET") r.HandleFunc("/settings/workers/{slug}/token", h.Authenticated(h.SettingsWorkersTokenGET)).Methods("GET") + r.PathPrefix("/settings/temporal").HandlerFunc(h.Authenticated(h.Temporal)) // OAuth2 r.HandleFunc("/oauth2/login", h.OAuth2LoginGET).Methods("GET") r.HandleFunc("/oauth2/callback", h.OAuth2CallbackGET).Methods("GET") r.HandleFunc("/oauth2/logout", h.Authenticated(h.OAuth2LogoutGET)).Methods("GET") - // Temporal UI - r.PathPrefix("/temporal").HandlerFunc(h.Authenticated(h.Temporal)) - // API r.HandleFunc("/api/v1/workers/connect", h.Authenticated(h.ApiV1WorkersConnectGET)).Methods("GET") diff --git a/pkg/temporal/config.go b/pkg/temporal/config.go index e5c54a7..41610f0 100644 --- a/pkg/temporal/config.go +++ b/pkg/temporal/config.go @@ -22,6 +22,7 @@ const FrontendPort = 7233 const HistoryPort = 7234 const MatchingPort = 7235 const WorkerPort = 7236 +const InternalFrontendPort = 7237 type TokenKeyProvider struct { config *internal.TemporalConfig @@ -96,6 +97,22 @@ func NewServerConfig(cfg *internal.TemporalConfig) *config.Config { BindOnIP: "", }, }, + "worker": { + RPC: config.RPC{ + GRPCPort: WorkerPort, + MembershipPort: WorkerPort + 100, + BindOnLocalHost: true, + BindOnIP: "", + }, + }, + "internal-frontend": { + RPC: config.RPC{ + GRPCPort: InternalFrontendPort, + MembershipPort: InternalFrontendPort + 100, + BindOnLocalHost: true, + BindOnIP: "", + }, + }, }, ClusterMetadata: &cluster.Config{ EnableGlobalNamespace: false, @@ -106,7 +123,7 @@ func NewServerConfig(cfg *internal.TemporalConfig) *config.Config { "active": { Enabled: true, InitialFailoverVersion: 1, - RPCAddress: fmt.Sprintf("%s:%d", BroadcastAddress, FrontendPort), + RPCAddress: fmt.Sprintf("%s:%d", BroadcastAddress, InternalFrontendPort), ClusterID: "todo", }, }, @@ -126,9 +143,6 @@ func NewServerConfig(cfg *internal.TemporalConfig) *config.Config { Provider: nil, }, }, - PublicClient: config.PublicClient{ - HostPort: fmt.Sprintf("%s:%d", BroadcastAddress, FrontendPort), - }, NamespaceDefaults: config.NamespaceDefaults{ Archival: config.ArchivalNamespaceDefaults{ History: config.HistoryArchivalNamespaceDefaults{ diff --git a/pkg/temporal/server.go b/pkg/temporal/server.go index 68d64dc..a92625a 100644 --- a/pkg/temporal/server.go +++ b/pkg/temporal/server.go @@ -65,6 +65,8 @@ func NewServer(cfg *config.Config, tokenKeyProvider authorization.TokenKeyProvid string(primitives.FrontendService), string(primitives.HistoryService), string(primitives.MatchingService), + string(primitives.WorkerService), + string(primitives.InternalFrontendService), }), t.WithLogger(logger), t.InterruptOn(interruptChan), diff --git a/pkg/temporal/ui.go b/pkg/temporal/ui.go index 0556f80..bbc9972 100644 --- a/pkg/temporal/ui.go +++ b/pkg/temporal/ui.go @@ -13,7 +13,7 @@ func NewUiConfig(cfg *internal.TemporalConfig) *config.Config { Port: 8223, TemporalGRPCAddress: "localhost:7233", EnableUI: true, - PublicPath: "/temporal", + PublicPath: "/settings/temporal", ForwardHeaders: []string{"Authorization"}, Codec: config.Codec{ Endpoint: "",