mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-26 08:11:55 -06:00
Fix dendrite-demo-pinecone
, /_dendrite
namespace setup
This commit is contained in:
parent
1be0afa181
commit
934056f21f
|
@ -336,6 +336,7 @@ func (m *DendriteMonolith) Start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
base := base.NewBaseDendrite(cfg, "Monolith")
|
base := base.NewBaseDendrite(cfg, "Monolith")
|
||||||
|
base.ConfigureAdminEndpoints()
|
||||||
defer base.Close() // nolint: errcheck
|
defer base.Close() // nolint: errcheck
|
||||||
|
|
||||||
federation := conn.CreateFederationClient(base, m.PineconeQUIC)
|
federation := conn.CreateFederationClient(base, m.PineconeQUIC)
|
||||||
|
|
|
@ -150,6 +150,7 @@ func (m *DendriteMonolith) Start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
base := base.NewBaseDendrite(cfg, "Monolith")
|
base := base.NewBaseDendrite(cfg, "Monolith")
|
||||||
|
base.ConfigureAdminEndpoints()
|
||||||
m.processContext = base.ProcessContext
|
m.processContext = base.ProcessContext
|
||||||
defer base.Close() // nolint: errcheck
|
defer base.Close() // nolint: errcheck
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,7 @@ func main() {
|
||||||
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
|
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
|
||||||
|
|
||||||
base := base.NewBaseDendrite(cfg, "Monolith")
|
base := base.NewBaseDendrite(cfg, "Monolith")
|
||||||
|
base.ConfigureAdminEndpoints()
|
||||||
defer base.Close() // nolint: errcheck
|
defer base.Close() // nolint: errcheck
|
||||||
|
|
||||||
pineconeEventChannel := make(chan pineconeEvents.Event)
|
pineconeEventChannel := make(chan pineconeEvents.Event)
|
||||||
|
@ -248,6 +249,8 @@ func main() {
|
||||||
httpRouter.PathPrefix(httputil.InternalPathPrefix).Handler(base.InternalAPIMux)
|
httpRouter.PathPrefix(httputil.InternalPathPrefix).Handler(base.InternalAPIMux)
|
||||||
httpRouter.PathPrefix(httputil.PublicClientPathPrefix).Handler(base.PublicClientAPIMux)
|
httpRouter.PathPrefix(httputil.PublicClientPathPrefix).Handler(base.PublicClientAPIMux)
|
||||||
httpRouter.PathPrefix(httputil.PublicMediaPathPrefix).Handler(base.PublicMediaAPIMux)
|
httpRouter.PathPrefix(httputil.PublicMediaPathPrefix).Handler(base.PublicMediaAPIMux)
|
||||||
|
httpRouter.PathPrefix(httputil.DendriteAdminPathPrefix).Handler(base.DendriteAdminMux)
|
||||||
|
httpRouter.PathPrefix(httputil.SynapseAdminPathPrefix).Handler(base.SynapseAdminMux)
|
||||||
httpRouter.HandleFunc("/ws", func(w http.ResponseWriter, r *http.Request) {
|
httpRouter.HandleFunc("/ws", func(w http.ResponseWriter, r *http.Request) {
|
||||||
c, err := wsUpgrader.Upgrade(w, r, nil)
|
c, err := wsUpgrader.Upgrade(w, r, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -270,8 +273,6 @@ func main() {
|
||||||
pMux.PathPrefix(users.PublicURL).HandlerFunc(userProvider.FederatedUserProfiles)
|
pMux.PathPrefix(users.PublicURL).HandlerFunc(userProvider.FederatedUserProfiles)
|
||||||
pMux.PathPrefix(httputil.PublicFederationPathPrefix).Handler(base.PublicFederationAPIMux)
|
pMux.PathPrefix(httputil.PublicFederationPathPrefix).Handler(base.PublicFederationAPIMux)
|
||||||
pMux.PathPrefix(httputil.PublicMediaPathPrefix).Handler(base.PublicMediaAPIMux)
|
pMux.PathPrefix(httputil.PublicMediaPathPrefix).Handler(base.PublicMediaAPIMux)
|
||||||
pMux.PathPrefix(httputil.DendriteAdminPathPrefix).Handler(base.DendriteAdminMux)
|
|
||||||
pMux.PathPrefix(httputil.SynapseAdminPathPrefix).Handler(base.SynapseAdminMux)
|
|
||||||
|
|
||||||
pHTTP := pQUIC.Protocol("matrix").HTTP()
|
pHTTP := pQUIC.Protocol("matrix").HTTP()
|
||||||
pHTTP.Mux().Handle(users.PublicURL, pMux)
|
pHTTP.Mux().Handle(users.PublicURL, pMux)
|
||||||
|
|
|
@ -144,6 +144,7 @@ func main() {
|
||||||
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
|
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
|
||||||
|
|
||||||
base := base.NewBaseDendrite(cfg, "Monolith")
|
base := base.NewBaseDendrite(cfg, "Monolith")
|
||||||
|
base.ConfigureAdminEndpoints()
|
||||||
defer base.Close() // nolint: errcheck
|
defer base.Close() // nolint: errcheck
|
||||||
|
|
||||||
ygg, err := yggconn.Setup(sk, *instanceName, ".", *instancePeer, *instanceListen)
|
ygg, err := yggconn.Setup(sk, *instanceName, ".", *instancePeer, *instanceListen)
|
||||||
|
|
|
@ -413,6 +413,24 @@ func (b *BaseDendrite) configureHTTPErrors() {
|
||||||
b.PublicClientAPIMux.MethodNotAllowedHandler = http.HandlerFunc(clientNotFoundHandler)
|
b.PublicClientAPIMux.MethodNotAllowedHandler = http.HandlerFunc(clientNotFoundHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *BaseDendrite) ConfigureAdminEndpoints() {
|
||||||
|
b.DendriteAdminMux.HandleFunc("/monitor/up", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.WriteHeader(200)
|
||||||
|
})
|
||||||
|
b.DendriteAdminMux.HandleFunc("/monitor/health", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if isDegraded, reasons := b.ProcessContext.IsDegraded(); isDegraded {
|
||||||
|
w.WriteHeader(503)
|
||||||
|
_ = json.NewEncoder(w).Encode(struct {
|
||||||
|
Warnings []string `json:"warnings"`
|
||||||
|
}{
|
||||||
|
Warnings: reasons,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
w.WriteHeader(200)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// SetupAndServeHTTP sets up the HTTP server to serve endpoints registered on
|
// SetupAndServeHTTP sets up the HTTP server to serve endpoints registered on
|
||||||
// ApiMux under /api/ and adds a prometheus handler under /metrics.
|
// ApiMux under /api/ and adds a prometheus handler under /metrics.
|
||||||
func (b *BaseDendrite) SetupAndServeHTTP(
|
func (b *BaseDendrite) SetupAndServeHTTP(
|
||||||
|
@ -463,21 +481,7 @@ func (b *BaseDendrite) SetupAndServeHTTP(
|
||||||
internalRouter.Handle("/metrics", httputil.WrapHandlerInBasicAuth(promhttp.Handler(), b.Cfg.Global.Metrics.BasicAuth))
|
internalRouter.Handle("/metrics", httputil.WrapHandlerInBasicAuth(promhttp.Handler(), b.Cfg.Global.Metrics.BasicAuth))
|
||||||
}
|
}
|
||||||
|
|
||||||
b.DendriteAdminMux.HandleFunc("/monitor/up", func(w http.ResponseWriter, r *http.Request) {
|
b.ConfigureAdminEndpoints()
|
||||||
w.WriteHeader(200)
|
|
||||||
})
|
|
||||||
b.DendriteAdminMux.HandleFunc("/monitor/health", func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
if isDegraded, reasons := b.ProcessContext.IsDegraded(); isDegraded {
|
|
||||||
w.WriteHeader(503)
|
|
||||||
_ = json.NewEncoder(w).Encode(struct {
|
|
||||||
Warnings []string `json:"warnings"`
|
|
||||||
}{
|
|
||||||
Warnings: reasons,
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
w.WriteHeader(200)
|
|
||||||
})
|
|
||||||
|
|
||||||
var clientHandler http.Handler
|
var clientHandler http.Handler
|
||||||
clientHandler = b.PublicClientAPIMux
|
clientHandler = b.PublicClientAPIMux
|
||||||
|
|
Loading…
Reference in a new issue