mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-03-03 17:03:10 -06:00
Merge commit '60f6e4630fbfed90f0b7e2bbc2873dc646d991d6'
This commit is contained in:
commit
a3c5174598
|
|
@ -1,19 +1,19 @@
|
||||||
#syntax=docker/dockerfile:1.2
|
#syntax=docker/dockerfile:1.2
|
||||||
|
|
||||||
FROM golang:1.18-stretch as build
|
FROM golang:1.19-buster as build
|
||||||
RUN apt-get update && apt-get install -y postgresql
|
RUN apt-get update && apt-get install -y postgresql
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
# No password when connecting over localhost
|
# No password when connecting over localhost
|
||||||
RUN sed -i "s%127.0.0.1/32 md5%127.0.0.1/32 trust%g" /etc/postgresql/9.6/main/pg_hba.conf && \
|
RUN sed -i "s%127.0.0.1/32 md5%127.0.0.1/32 trust%g" /etc/postgresql/11/main/pg_hba.conf && \
|
||||||
# Bump up max conns for moar concurrency
|
# Bump up max conns for moar concurrency
|
||||||
sed -i 's/max_connections = 100/max_connections = 2000/g' /etc/postgresql/9.6/main/postgresql.conf
|
sed -i 's/max_connections = 100/max_connections = 2000/g' /etc/postgresql/11/main/postgresql.conf
|
||||||
|
|
||||||
# This entry script starts postgres, waits for it to be up then starts dendrite
|
# This entry script starts postgres, waits for it to be up then starts dendrite
|
||||||
RUN echo '\
|
RUN echo '\
|
||||||
#!/bin/bash -eu \n\
|
#!/bin/bash -eu \n\
|
||||||
pg_lsclusters \n\
|
pg_lsclusters \n\
|
||||||
pg_ctlcluster 9.6 main start \n\
|
pg_ctlcluster 11 main start \n\
|
||||||
\n\
|
\n\
|
||||||
until pg_isready \n\
|
until pg_isready \n\
|
||||||
do \n\
|
do \n\
|
||||||
|
|
@ -31,9 +31,9 @@ RUN mkdir /dendrite
|
||||||
RUN --mount=target=. \
|
RUN --mount=target=. \
|
||||||
--mount=type=cache,target=/go/pkg/mod \
|
--mount=type=cache,target=/go/pkg/mod \
|
||||||
--mount=type=cache,target=/root/.cache/go-build \
|
--mount=type=cache,target=/root/.cache/go-build \
|
||||||
go build -o /dendrite ./cmd/generate-config && \
|
go build --race -o /dendrite ./cmd/generate-config && \
|
||||||
go build -o /dendrite ./cmd/generate-keys && \
|
go build --race -o /dendrite ./cmd/generate-keys && \
|
||||||
go build -o /dendrite ./cmd/dendrite-monolith-server
|
go build --race -o /dendrite ./cmd/dendrite-monolith-server
|
||||||
|
|
||||||
WORKDIR /dendrite
|
WORKDIR /dendrite
|
||||||
RUN ./generate-keys --private-key matrix_key.pem
|
RUN ./generate-keys --private-key matrix_key.pem
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ const HEAD = "HEAD"
|
||||||
// due to the error:
|
// due to the error:
|
||||||
// When using COPY with more than one source file, the destination must be a directory and end with a /
|
// When using COPY with more than one source file, the destination must be a directory and end with a /
|
||||||
// We need to run a postgres anyway, so use the dockerfile associated with Complement instead.
|
// We need to run a postgres anyway, so use the dockerfile associated with Complement instead.
|
||||||
const Dockerfile = `FROM golang:1.18-stretch as build
|
const Dockerfile = `FROM golang:1.19-buster as build
|
||||||
RUN apt-get update && apt-get install -y postgresql
|
RUN apt-get update && apt-get install -y postgresql
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
|
|
@ -57,25 +57,25 @@ WORKDIR /build
|
||||||
# Complement Dockerfile which wgets a branch.
|
# Complement Dockerfile which wgets a branch.
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN go build ./cmd/dendrite-monolith-server
|
RUN go build --race ./cmd/dendrite-monolith-server
|
||||||
RUN go build ./cmd/generate-keys
|
RUN go build --race ./cmd/generate-keys
|
||||||
RUN go build ./cmd/generate-config
|
RUN go build --race ./cmd/generate-config
|
||||||
RUN ./generate-config --ci > dendrite.yaml
|
RUN ./generate-config --ci > dendrite.yaml
|
||||||
RUN ./generate-keys --private-key matrix_key.pem --tls-cert server.crt --tls-key server.key
|
RUN ./generate-keys --private-key matrix_key.pem --tls-cert server.crt --tls-key server.key
|
||||||
|
|
||||||
# Replace the connection string with a single postgres DB, using user/db = 'postgres' and no password
|
# Replace the connection string with a single postgres DB, using user/db = 'postgres' and no password
|
||||||
RUN sed -i "s%connection_string:.*$%connection_string: postgresql://postgres@localhost/postgres?sslmode=disable%g" dendrite.yaml
|
RUN sed -i "s%connection_string:.*$%connection_string: postgresql://postgres@localhost/postgres?sslmode=disable%g" dendrite.yaml
|
||||||
# No password when connecting over localhost
|
# No password when connecting over localhost
|
||||||
RUN sed -i "s%127.0.0.1/32 md5%127.0.0.1/32 trust%g" /etc/postgresql/9.6/main/pg_hba.conf
|
RUN sed -i "s%127.0.0.1/32 md5%127.0.0.1/32 trust%g" /etc/postgresql/11/main/pg_hba.conf
|
||||||
# Bump up max conns for moar concurrency
|
# Bump up max conns for moar concurrency
|
||||||
RUN sed -i 's/max_connections = 100/max_connections = 2000/g' /etc/postgresql/9.6/main/postgresql.conf
|
RUN sed -i 's/max_connections = 100/max_connections = 2000/g' /etc/postgresql/11/main/postgresql.conf
|
||||||
RUN sed -i 's/max_open_conns:.*$/max_open_conns: 100/g' dendrite.yaml
|
RUN sed -i 's/max_open_conns:.*$/max_open_conns: 100/g' dendrite.yaml
|
||||||
|
|
||||||
# This entry script starts postgres, waits for it to be up then starts dendrite
|
# This entry script starts postgres, waits for it to be up then starts dendrite
|
||||||
RUN echo '\
|
RUN echo '\
|
||||||
#!/bin/bash -eu \n\
|
#!/bin/bash -eu \n\
|
||||||
pg_lsclusters \n\
|
pg_lsclusters \n\
|
||||||
pg_ctlcluster 9.6 main start \n\
|
pg_ctlcluster 11 main start \n\
|
||||||
\n\
|
\n\
|
||||||
until pg_isready \n\
|
until pg_isready \n\
|
||||||
do \n\
|
do \n\
|
||||||
|
|
@ -341,7 +341,7 @@ func runImage(dockerClient *client.Client, volumeName, version, imageID string)
|
||||||
{
|
{
|
||||||
Type: mount.TypeVolume,
|
Type: mount.TypeVolume,
|
||||||
Source: volumeName,
|
Source: volumeName,
|
||||||
Target: "/var/lib/postgresql/9.6/main",
|
Target: "/var/lib/postgresql/11/main",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil, nil, "dendrite_upgrade_test_"+version)
|
}, nil, nil, "dendrite_upgrade_test_"+version)
|
||||||
|
|
@ -416,6 +416,9 @@ func loadAndRunTests(dockerClient *client.Client, volumeName, v string, branchTo
|
||||||
if err = runTests(csAPIURL, v); err != nil {
|
if err = runTests(csAPIURL, v); err != nil {
|
||||||
return fmt.Errorf("failed to run tests on version %s: %s", v, err)
|
return fmt.Errorf("failed to run tests on version %s: %s", v, err)
|
||||||
}
|
}
|
||||||
|
// Sleep to let the database sync before returning and destroying the dendrite container
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -178,14 +179,19 @@ func verifyTestsRan(baseURL string, branchNames []string) error {
|
||||||
}
|
}
|
||||||
// we expect 4 messages per version
|
// we expect 4 messages per version
|
||||||
msgCount := 0
|
msgCount := 0
|
||||||
|
// To aid debugging when some messages are missing
|
||||||
|
msgArray := make([]gomatrix.Event, 0)
|
||||||
|
|
||||||
for _, ev := range history.Chunk {
|
for _, ev := range history.Chunk {
|
||||||
if ev.Type == "m.room.message" {
|
if ev.Type == "m.room.message" {
|
||||||
msgCount += 1
|
msgCount += 1
|
||||||
|
msgArray = append(msgArray, ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wantMsgCount := len(branchNames) * 4
|
wantMsgCount := len(branchNames) * 4
|
||||||
if msgCount != wantMsgCount {
|
if msgCount != wantMsgCount {
|
||||||
return fmt.Errorf("got %d messages in global room, want %d", msgCount, wantMsgCount)
|
msgArrayJSON, _ := json.Marshal(msgArray)
|
||||||
|
return fmt.Errorf("got %d messages in global room, want %d msgArray %v", msgCount, wantMsgCount, string(msgArrayJSON))
|
||||||
}
|
}
|
||||||
log.Println(" messages exist: OK")
|
log.Println(" messages exist: OK")
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue