0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-12-14 21:53:49 +01:00

Make sure NATS uses own persistent directory (TODO: make this configurable)

This commit is contained in:
Neil Alexander 2021-07-14 10:23:04 +01:00
parent e2d562257c
commit beb2ddf03d
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
5 changed files with 10 additions and 4 deletions

2
go.mod
View file

@ -1,6 +1,6 @@
module github.com/matrix-org/dendrite
replace github.com/nats-io/nats-server/v2 => github.com/neilalexander/nats-server/v2 v2.3.3-0.20210713120756-c663f55fedeb
replace github.com/nats-io/nats-server/v2 => github.com/neilalexander/nats-server/v2 v2.3.3-0.20210714083537-9e5eeca686a2
replace github.com/nats-io/nats.go => github.com/neilalexander/nats.go v1.11.1-0.20210713114907-f78197deadf1

4
go.sum
View file

@ -1125,8 +1125,8 @@ github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uY
github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
github.com/neilalexander/nats-server/v2 v2.3.3-0.20210713120756-c663f55fedeb h1:fhQF1iw+4BbVlNDtJj202IJk0A2JeRfkqJ1OyJsGMIU=
github.com/neilalexander/nats-server/v2 v2.3.3-0.20210713120756-c663f55fedeb/go.mod h1:dUf7Cm5z5LbciFVwWx54owyCKm8x4/hL6p7rrljhLFY=
github.com/neilalexander/nats-server/v2 v2.3.3-0.20210714083537-9e5eeca686a2 h1:hy3Y+7o4B7U3lFrrjw0JMO2ayepMWkSVEZmu4d3cxUY=
github.com/neilalexander/nats-server/v2 v2.3.3-0.20210714083537-9e5eeca686a2/go.mod h1:dUf7Cm5z5LbciFVwWx54owyCKm8x4/hL6p7rrljhLFY=
github.com/neilalexander/nats.go v1.11.1-0.20210713114907-f78197deadf1 h1:bI5JbW/nR/3klqVi9UBFjLimzyw8XqkgwuFEG7ROMh4=
github.com/neilalexander/nats.go v1.11.1-0.20210713114907-f78197deadf1/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w=
github.com/neilalexander/utp v0.1.1-0.20210622132614-ee9a34a30488 h1:xZk82i6JK2d0SqRIXwaxj7J/NQB6ngq0PuMx3wXBaRQ=

View file

@ -329,6 +329,7 @@ func (c *Dendrite) Verify(configErrs *ConfigErrors, isMonolith bool) {
}
func (c *Dendrite) Wiring() {
c.Global.Kafka.Matrix = &c.Global
c.ClientAPI.Matrix = &c.Global
c.EDUServer.Matrix = &c.Global
c.FederationAPI.Matrix = &c.Global

View file

@ -23,6 +23,8 @@ var KafkaTopics = []string{
}
type Kafka struct {
Matrix *Global `yaml:"-"`
// A list of kafka/NATS addresses to connect to.
Addresses []string `yaml:"addresses"`
// The prefix to use for Kafka topic names for this homeserver - really only

View file

@ -37,6 +37,7 @@ func SetupConsumerProducer(cfg *config.Kafka) (sarama.Consumer, sarama.SyncProdu
ServerName: "monolith",
DontListen: true,
JetStream: true,
StoreDir: string(cfg.Matrix.ServerName),
LogFile: "nats.log",
Debug: true,
})
@ -48,7 +49,9 @@ func SetupConsumerProducer(cfg *config.Kafka) (sarama.Consumer, sarama.SyncProdu
s = natsServer
}
natsServerMutex.Unlock()
natsServer.WaitForStartup()
if !natsServer.ReadyForConnections(time.Second * 10) {
logrus.Fatalln("NATS did not start in time")
}
conn, err := s.InProcessConn()
if err != nil {
logrus.Fatalln("Failed to get a NATS in-process conn")