mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 03:31:41 +00:00
Multi-personality polylith binary (#1552)
* Initial work oon multipersonality binary * Remove old binaries * Monolith and polylith binaries * Better logging * dendrite-poly-multi * Fix path * Copyright notices etc * Tweaks * Update Docker, INSTALL.md * Take first argument if flags package doesn't find any args * Postgres 9.6 or later, fix some more Docker stuff * Don't create unnecessary e2ekey DB * Run go mod tidy
This commit is contained in:
parent
6c3c621de0
commit
39c7a8915c
@ -1,4 +1,4 @@
|
|||||||
FROM docker.io/golang:1.13.7-alpine3.11 AS builder
|
FROM docker.io/golang:1.15-alpine AS builder
|
||||||
|
|
||||||
RUN apk --update --no-cache add bash build-base
|
RUN apk --update --no-cache add bash build-base
|
||||||
|
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
FROM matrixdotorg/dendrite:latest AS base
|
|
||||||
|
|
||||||
FROM alpine:latest
|
|
||||||
|
|
||||||
ARG component=monolith
|
|
||||||
ENV entrypoint=${component}
|
|
||||||
|
|
||||||
COPY --from=base /build/bin/${component} /usr/bin
|
|
||||||
COPY --from=base /build/bin/goose /usr/bin
|
|
||||||
|
|
||||||
VOLUME /etc/dendrite
|
|
||||||
WORKDIR /etc/dendrite
|
|
||||||
|
|
||||||
ENTRYPOINT /usr/bin/${entrypoint} $@
|
|
13
build/docker/Dockerfile.monolith
Normal file
13
build/docker/Dockerfile.monolith
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM matrixdotorg/dendrite:latest AS base
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
COPY --from=base /build/bin/dendrite-monolith-server /usr/bin
|
||||||
|
COPY --from=base /build/bin/goose /usr/bin
|
||||||
|
COPY --from=base /build/bin/create-account /usr/bin
|
||||||
|
COPY --from=base /build/bin/generate-keys /usr/bin
|
||||||
|
|
||||||
|
VOLUME /etc/dendrite
|
||||||
|
WORKDIR /etc/dendrite
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/bin/dendrite-monolith-server"]
|
13
build/docker/Dockerfile.polylith
Normal file
13
build/docker/Dockerfile.polylith
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM matrixdotorg/dendrite:latest AS base
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
COPY --from=base /build/bin/dendrite-polylith-multi /usr/bin
|
||||||
|
COPY --from=base /build/bin/goose /usr/bin
|
||||||
|
COPY --from=base /build/bin/create-account /usr/bin
|
||||||
|
COPY --from=base /build/bin/generate-keys /usr/bin
|
||||||
|
|
||||||
|
VOLUME /etc/dendrite
|
||||||
|
WORKDIR /etc/dendrite
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/bin/dendrite-polylith-multi"]
|
@ -2,7 +2,7 @@ version: "3.4"
|
|||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
hostname: postgres
|
hostname: postgres
|
||||||
image: postgres:9.5
|
image: postgres:9.6
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./postgres/create_db.sh:/docker-entrypoint-initdb.d/20-create_db.sh
|
- ./postgres/create_db.sh:/docker-entrypoint-initdb.d/20-create_db.sh
|
||||||
|
@ -4,7 +4,6 @@ services:
|
|||||||
hostname: monolith
|
hostname: monolith
|
||||||
image: matrixdotorg/dendrite-monolith:latest
|
image: matrixdotorg/dendrite-monolith:latest
|
||||||
command: [
|
command: [
|
||||||
"--config=dendrite.yaml",
|
|
||||||
"--tls-cert=server.crt",
|
"--tls-cert=server.crt",
|
||||||
"--tls-key=server.key"
|
"--tls-key=server.key"
|
||||||
]
|
]
|
||||||
|
@ -2,22 +2,17 @@ version: "3.4"
|
|||||||
services:
|
services:
|
||||||
client_api:
|
client_api:
|
||||||
hostname: client_api
|
hostname: client_api
|
||||||
image: matrixdotorg/dendrite-clientapi:latest
|
image: matrixdotorg/dendrite-polylith:latest
|
||||||
command: [
|
command: clientapi
|
||||||
"--config=dendrite.yaml"
|
|
||||||
]
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/etc/dendrite
|
- ./config:/etc/dendrite
|
||||||
- room_server
|
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
|
|
||||||
media_api:
|
media_api:
|
||||||
hostname: media_api
|
hostname: media_api
|
||||||
image: matrixdotorg/dendrite-mediaapi:latest
|
image: matrixdotorg/dendrite-polylith:latest
|
||||||
command: [
|
command: mediaapi
|
||||||
"--config=dendrite.yaml"
|
|
||||||
]
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/etc/dendrite
|
- ./config:/etc/dendrite
|
||||||
networks:
|
networks:
|
||||||
@ -25,10 +20,8 @@ services:
|
|||||||
|
|
||||||
sync_api:
|
sync_api:
|
||||||
hostname: sync_api
|
hostname: sync_api
|
||||||
image: matrixdotorg/dendrite-syncapi:latest
|
image: matrixdotorg/dendrite-polylith:latest
|
||||||
command: [
|
command: syncapi
|
||||||
"--config=dendrite.yaml"
|
|
||||||
]
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/etc/dendrite
|
- ./config:/etc/dendrite
|
||||||
networks:
|
networks:
|
||||||
@ -36,10 +29,8 @@ services:
|
|||||||
|
|
||||||
room_server:
|
room_server:
|
||||||
hostname: room_server
|
hostname: room_server
|
||||||
image: matrixdotorg/dendrite-roomserver:latest
|
image: matrixdotorg/dendrite-polylith:latest
|
||||||
command: [
|
command: roomserver
|
||||||
"--config=dendrite.yaml"
|
|
||||||
]
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/etc/dendrite
|
- ./config:/etc/dendrite
|
||||||
networks:
|
networks:
|
||||||
@ -47,10 +38,8 @@ services:
|
|||||||
|
|
||||||
edu_server:
|
edu_server:
|
||||||
hostname: edu_server
|
hostname: edu_server
|
||||||
image: matrixdotorg/dendrite-eduserver:latest
|
image: matrixdotorg/dendrite-polylith:latest
|
||||||
command: [
|
command: eduserver
|
||||||
"--config=dendrite.yaml"
|
|
||||||
]
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/etc/dendrite
|
- ./config:/etc/dendrite
|
||||||
networks:
|
networks:
|
||||||
@ -58,10 +47,8 @@ services:
|
|||||||
|
|
||||||
federation_api:
|
federation_api:
|
||||||
hostname: federation_api
|
hostname: federation_api
|
||||||
image: matrixdotorg/dendrite-federationapi:latest
|
image: matrixdotorg/dendrite-polylith:latest
|
||||||
command: [
|
command: federationapi
|
||||||
"--config=dendrite.yaml"
|
|
||||||
]
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/etc/dendrite
|
- ./config:/etc/dendrite
|
||||||
networks:
|
networks:
|
||||||
@ -69,10 +56,8 @@ services:
|
|||||||
|
|
||||||
federation_sender:
|
federation_sender:
|
||||||
hostname: federation_sender
|
hostname: federation_sender
|
||||||
image: matrixdotorg/dendrite-federationsender:latest
|
image: matrixdotorg/dendrite-polylith:latest
|
||||||
command: [
|
command: federationsender
|
||||||
"--config=dendrite.yaml"
|
|
||||||
]
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/etc/dendrite
|
- ./config:/etc/dendrite
|
||||||
networks:
|
networks:
|
||||||
@ -80,10 +65,8 @@ services:
|
|||||||
|
|
||||||
key_server:
|
key_server:
|
||||||
hostname: key_server
|
hostname: key_server
|
||||||
image: matrixdotorg/dendrite-keyserver:latest
|
image: matrixdotorg/dendrite-polylith:latest
|
||||||
command: [
|
command: keyserver
|
||||||
"--config=dendrite.yaml"
|
|
||||||
]
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/etc/dendrite
|
- ./config:/etc/dendrite
|
||||||
networks:
|
networks:
|
||||||
@ -91,10 +74,8 @@ services:
|
|||||||
|
|
||||||
signing_key_server:
|
signing_key_server:
|
||||||
hostname: signing_key_server
|
hostname: signing_key_server
|
||||||
image: matrixdotorg/dendrite-signingkeyserver:latest
|
image: matrixdotorg/dendrite-polylith:latest
|
||||||
command: [
|
command: signingkeyserver
|
||||||
"--config=dendrite.yaml"
|
|
||||||
]
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/etc/dendrite
|
- ./config:/etc/dendrite
|
||||||
networks:
|
networks:
|
||||||
@ -102,10 +83,8 @@ services:
|
|||||||
|
|
||||||
user_api:
|
user_api:
|
||||||
hostname: user_api
|
hostname: user_api
|
||||||
image: matrixdotorg/dendrite-userapi:latest
|
image: matrixdotorg/dendrite-polylith:latest
|
||||||
command: [
|
command: userapi
|
||||||
"--config=dendrite.yaml"
|
|
||||||
]
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/etc/dendrite
|
- ./config:/etc/dendrite
|
||||||
networks:
|
networks:
|
||||||
@ -113,10 +92,8 @@ services:
|
|||||||
|
|
||||||
appservice_api:
|
appservice_api:
|
||||||
hostname: appservice_api
|
hostname: appservice_api
|
||||||
image: matrixdotorg/dendrite-appservice:latest
|
image: matrixdotorg/dendrite-polylith:latest
|
||||||
command: [
|
command: appservice
|
||||||
"--config=dendrite.yaml"
|
|
||||||
]
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/etc/dendrite
|
- ./config:/etc/dendrite
|
||||||
networks:
|
networks:
|
||||||
|
@ -8,16 +8,5 @@ echo "Building tag '${TAG}'"
|
|||||||
|
|
||||||
docker build -f build/docker/Dockerfile -t matrixdotorg/dendrite:${TAG} .
|
docker build -f build/docker/Dockerfile -t matrixdotorg/dendrite:${TAG} .
|
||||||
|
|
||||||
docker build -t matrixdotorg/dendrite-monolith:${TAG} --build-arg component=dendrite-monolith-server -f build/docker/Dockerfile.component .
|
docker build -t matrixdotorg/dendrite-monolith:${TAG} -f build/docker/Dockerfile.monolith .
|
||||||
|
docker build -t matrixdotorg/dendrite-polylith:${TAG} -f build/docker/Dockerfile.polylith .
|
||||||
docker build -t matrixdotorg/dendrite-appservice:${TAG} --build-arg component=dendrite-appservice-server -f build/docker/Dockerfile.component .
|
|
||||||
docker build -t matrixdotorg/dendrite-clientapi:${TAG} --build-arg component=dendrite-client-api-server -f build/docker/Dockerfile.component .
|
|
||||||
docker build -t matrixdotorg/dendrite-eduserver:${TAG} --build-arg component=dendrite-edu-server -f build/docker/Dockerfile.component .
|
|
||||||
docker build -t matrixdotorg/dendrite-federationapi:${TAG} --build-arg component=dendrite-federation-api-server -f build/docker/Dockerfile.component .
|
|
||||||
docker build -t matrixdotorg/dendrite-federationsender:${TAG} --build-arg component=dendrite-federation-sender-server -f build/docker/Dockerfile.component .
|
|
||||||
docker build -t matrixdotorg/dendrite-keyserver:${TAG} --build-arg component=dendrite-key-server -f build/docker/Dockerfile.component .
|
|
||||||
docker build -t matrixdotorg/dendrite-mediaapi:${TAG} --build-arg component=dendrite-media-api-server -f build/docker/Dockerfile.component .
|
|
||||||
docker build -t matrixdotorg/dendrite-roomserver:${TAG} --build-arg component=dendrite-room-server -f build/docker/Dockerfile.component .
|
|
||||||
docker build -t matrixdotorg/dendrite-syncapi:${TAG} --build-arg component=dendrite-sync-api-server -f build/docker/Dockerfile.component .
|
|
||||||
docker build -t matrixdotorg/dendrite-signingkeyserver:${TAG} --build-arg component=dendrite-signing-key-server -f build/docker/Dockerfile.component .
|
|
||||||
docker build -t matrixdotorg/dendrite-userapi:${TAG} --build-arg component=dendrite-user-api-server -f build/docker/Dockerfile.component .
|
|
@ -5,15 +5,4 @@ TAG=${1:-latest}
|
|||||||
echo "Pulling tag '${TAG}'"
|
echo "Pulling tag '${TAG}'"
|
||||||
|
|
||||||
docker pull matrixdotorg/dendrite-monolith:${TAG}
|
docker pull matrixdotorg/dendrite-monolith:${TAG}
|
||||||
|
docker pull matrixdotorg/dendrite-polylith:${TAG}
|
||||||
docker pull matrixdotorg/dendrite-appservice:${TAG}
|
|
||||||
docker pull matrixdotorg/dendrite-clientapi:${TAG}
|
|
||||||
docker pull matrixdotorg/dendrite-eduserver:${TAG}
|
|
||||||
docker pull matrixdotorg/dendrite-federationapi:${TAG}
|
|
||||||
docker pull matrixdotorg/dendrite-federationsender:${TAG}
|
|
||||||
docker pull matrixdotorg/dendrite-keyserver:${TAG}
|
|
||||||
docker pull matrixdotorg/dendrite-mediaapi:${TAG}
|
|
||||||
docker pull matrixdotorg/dendrite-roomserver:${TAG}
|
|
||||||
docker pull matrixdotorg/dendrite-syncapi:${TAG}
|
|
||||||
docker pull matrixdotorg/dendrite-signingkeyserver:${TAG}
|
|
||||||
docker pull matrixdotorg/dendrite-userapi:${TAG}
|
|
@ -5,15 +5,4 @@ TAG=${1:-latest}
|
|||||||
echo "Pushing tag '${TAG}'"
|
echo "Pushing tag '${TAG}'"
|
||||||
|
|
||||||
docker push matrixdotorg/dendrite-monolith:${TAG}
|
docker push matrixdotorg/dendrite-monolith:${TAG}
|
||||||
|
docker push matrixdotorg/dendrite-polylith:${TAG}
|
||||||
docker push matrixdotorg/dendrite-appservice:${TAG}
|
|
||||||
docker push matrixdotorg/dendrite-clientapi:${TAG}
|
|
||||||
docker push matrixdotorg/dendrite-eduserver:${TAG}
|
|
||||||
docker push matrixdotorg/dendrite-federationapi:${TAG}
|
|
||||||
docker push matrixdotorg/dendrite-federationsender:${TAG}
|
|
||||||
docker push matrixdotorg/dendrite-keyserver:${TAG}
|
|
||||||
docker push matrixdotorg/dendrite-mediaapi:${TAG}
|
|
||||||
docker push matrixdotorg/dendrite-roomserver:${TAG}
|
|
||||||
docker push matrixdotorg/dendrite-syncapi:${TAG}
|
|
||||||
docker push matrixdotorg/dendrite-signingkeyserver:${TAG}
|
|
||||||
docker push matrixdotorg/dendrite-userapi:${TAG}
|
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
for db in account device mediaapi syncapi roomserver signingkeyserver keyserver federationsender appservice e2ekey naffka; do
|
for db in account device mediaapi syncapi roomserver signingkeyserver keyserver federationsender appservice naffka; do
|
||||||
createdb -U dendrite -O dendrite dendrite_$db
|
createdb -U dendrite -O dendrite dendrite_$db
|
||||||
done
|
done
|
||||||
|
78
cmd/dendrite-polylith-multi/main.go
Normal file
78
cmd/dendrite-polylith-multi/main.go
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/matrix-org/dendrite/cmd/dendrite-polylith-multi/personalities"
|
||||||
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
type entrypoint func(base *setup.BaseDendrite, cfg *config.Dendrite)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
cfg := setup.ParseFlags(true)
|
||||||
|
|
||||||
|
component := ""
|
||||||
|
if flag.NFlag() > 0 {
|
||||||
|
component = flag.Arg(0) // ./dendrite-polylith-multi --config=... clientapi
|
||||||
|
} else if len(os.Args) > 1 {
|
||||||
|
component = os.Args[1] // ./dendrite-polylith-multi clientapi
|
||||||
|
}
|
||||||
|
|
||||||
|
components := map[string]entrypoint{
|
||||||
|
"appservice": personalities.Appservice,
|
||||||
|
"clientapi": personalities.ClientAPI,
|
||||||
|
"eduserver": personalities.EDUServer,
|
||||||
|
"federationapi": personalities.FederationAPI,
|
||||||
|
"federationsender": personalities.FederationSender,
|
||||||
|
"keyserver": personalities.KeyServer,
|
||||||
|
"mediaapi": personalities.MediaAPI,
|
||||||
|
"roomserver": personalities.RoomServer,
|
||||||
|
"signingkeyserver": personalities.SigningKeyServer,
|
||||||
|
"syncapi": personalities.SyncAPI,
|
||||||
|
"userapi": personalities.UserAPI,
|
||||||
|
}
|
||||||
|
|
||||||
|
start, ok := components[component]
|
||||||
|
if !ok {
|
||||||
|
if component == "" {
|
||||||
|
logrus.Errorf("No component specified")
|
||||||
|
logrus.Info("The first argument on the command line must be the name of the component to run")
|
||||||
|
} else {
|
||||||
|
logrus.Errorf("Unknown component %q specified", component)
|
||||||
|
}
|
||||||
|
|
||||||
|
var list []string
|
||||||
|
for c := range components {
|
||||||
|
list = append(list, c)
|
||||||
|
}
|
||||||
|
logrus.Infof("Valid components: %s", strings.Join(list, ", "))
|
||||||
|
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Infof("Starting %q component", component)
|
||||||
|
|
||||||
|
base := setup.NewBaseDendrite(cfg, component, false) // TODO
|
||||||
|
defer base.Close() // nolint: errcheck
|
||||||
|
|
||||||
|
start(base, cfg)
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2018 Vector Creations Ltd
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@ -12,18 +12,15 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package main
|
package personalities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/matrix-org/dendrite/appservice"
|
"github.com/matrix-org/dendrite/appservice"
|
||||||
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func Appservice(base *setup.BaseDendrite, cfg *config.Dendrite) {
|
||||||
cfg := setup.ParseFlags(false)
|
|
||||||
base := setup.NewBaseDendrite(cfg, "AppServiceAPI", true)
|
|
||||||
|
|
||||||
defer base.Close() // nolint: errcheck
|
|
||||||
userAPI := base.UserAPIClient()
|
userAPI := base.UserAPIClient()
|
||||||
rsAPI := base.RoomserverHTTPClient()
|
rsAPI := base.RoomserverHTTPClient()
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017 Vector Creations Ltd
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@ -12,20 +12,16 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package main
|
package personalities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/matrix-org/dendrite/clientapi"
|
"github.com/matrix-org/dendrite/clientapi"
|
||||||
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
"github.com/matrix-org/dendrite/internal/transactions"
|
"github.com/matrix-org/dendrite/internal/transactions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func ClientAPI(base *setup.BaseDendrite, cfg *config.Dendrite) {
|
||||||
cfg := setup.ParseFlags(false)
|
|
||||||
|
|
||||||
base := setup.NewBaseDendrite(cfg, "ClientAPI", true)
|
|
||||||
defer base.Close() // nolint: errcheck
|
|
||||||
|
|
||||||
accountDB := base.CreateAccountsDB()
|
accountDB := base.CreateAccountsDB()
|
||||||
federation := base.CreateFederationClient()
|
federation := base.CreateFederationClient()
|
||||||
|
|
@ -1,3 +1,5 @@
|
|||||||
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
@ -10,26 +12,16 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package main
|
package personalities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "net/http/pprof"
|
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/eduserver"
|
"github.com/matrix-org/dendrite/eduserver"
|
||||||
"github.com/matrix-org/dendrite/eduserver/cache"
|
"github.com/matrix-org/dendrite/eduserver/cache"
|
||||||
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func EDUServer(base *setup.BaseDendrite, cfg *config.Dendrite) {
|
||||||
cfg := setup.ParseFlags(false)
|
|
||||||
base := setup.NewBaseDendrite(cfg, "EDUServerAPI", true)
|
|
||||||
defer func() {
|
|
||||||
if err := base.Close(); err != nil {
|
|
||||||
logrus.WithError(err).Warn("BaseDendrite close failed")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
intAPI := eduserver.NewInternalAPI(base, cache.New(), base.UserAPIClient())
|
intAPI := eduserver.NewInternalAPI(base, cache.New(), base.UserAPIClient())
|
||||||
eduserver.AddInternalRoutes(base.InternalAPIMux, intAPI)
|
eduserver.AddInternalRoutes(base.InternalAPIMux, intAPI)
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017 Vector Creations Ltd
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@ -12,18 +12,15 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package main
|
package personalities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/matrix-org/dendrite/federationapi"
|
"github.com/matrix-org/dendrite/federationapi"
|
||||||
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func FederationAPI(base *setup.BaseDendrite, cfg *config.Dendrite) {
|
||||||
cfg := setup.ParseFlags(false)
|
|
||||||
base := setup.NewBaseDendrite(cfg, "FederationAPI", true)
|
|
||||||
defer base.Close() // nolint: errcheck
|
|
||||||
|
|
||||||
userAPI := base.UserAPIClient()
|
userAPI := base.UserAPIClient()
|
||||||
federation := base.CreateFederationClient()
|
federation := base.CreateFederationClient()
|
||||||
serverKeyAPI := base.SigningKeyServerHTTPClient()
|
serverKeyAPI := base.SigningKeyServerHTTPClient()
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017 Vector Creations Ltd
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@ -12,18 +12,15 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package main
|
package personalities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/matrix-org/dendrite/federationsender"
|
"github.com/matrix-org/dendrite/federationsender"
|
||||||
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func FederationSender(base *setup.BaseDendrite, cfg *config.Dendrite) {
|
||||||
cfg := setup.ParseFlags(false)
|
|
||||||
base := setup.NewBaseDendrite(cfg, "FederationSender", true)
|
|
||||||
defer base.Close() // nolint: errcheck
|
|
||||||
|
|
||||||
federation := base.CreateFederationClient()
|
federation := base.CreateFederationClient()
|
||||||
|
|
||||||
serverKeyAPI := base.SigningKeyServerHTTPClient()
|
serverKeyAPI := base.SigningKeyServerHTTPClient()
|
@ -12,18 +12,15 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package main
|
package personalities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
"github.com/matrix-org/dendrite/keyserver"
|
"github.com/matrix-org/dendrite/keyserver"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func KeyServer(base *setup.BaseDendrite, cfg *config.Dendrite) {
|
||||||
cfg := setup.ParseFlags(false)
|
|
||||||
base := setup.NewBaseDendrite(cfg, "KeyServer", true)
|
|
||||||
defer base.Close() // nolint: errcheck
|
|
||||||
|
|
||||||
intAPI := keyserver.NewInternalAPI(&base.Cfg.KeyServer, base.CreateFederationClient())
|
intAPI := keyserver.NewInternalAPI(&base.Cfg.KeyServer, base.CreateFederationClient())
|
||||||
intAPI.SetUserAPI(base.UserAPIClient())
|
intAPI.SetUserAPI(base.UserAPIClient())
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017 Vector Creations Ltd
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@ -12,18 +12,15 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package main
|
package personalities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
"github.com/matrix-org/dendrite/mediaapi"
|
"github.com/matrix-org/dendrite/mediaapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func MediaAPI(base *setup.BaseDendrite, cfg *config.Dendrite) {
|
||||||
cfg := setup.ParseFlags(false)
|
|
||||||
base := setup.NewBaseDendrite(cfg, "MediaAPI", true)
|
|
||||||
defer base.Close() // nolint: errcheck
|
|
||||||
|
|
||||||
userAPI := base.UserAPIClient()
|
userAPI := base.UserAPIClient()
|
||||||
client := base.CreateClient()
|
client := base.CreateClient()
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017 Vector Creations Ltd
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@ -12,18 +12,15 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package main
|
package personalities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
"github.com/matrix-org/dendrite/roomserver"
|
"github.com/matrix-org/dendrite/roomserver"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func RoomServer(base *setup.BaseDendrite, cfg *config.Dendrite) {
|
||||||
cfg := setup.ParseFlags(false)
|
|
||||||
base := setup.NewBaseDendrite(cfg, "RoomServerAPI", true)
|
|
||||||
defer base.Close() // nolint: errcheck
|
|
||||||
|
|
||||||
serverKeyAPI := base.SigningKeyServerHTTPClient()
|
serverKeyAPI := base.SigningKeyServerHTTPClient()
|
||||||
keyRing := serverKeyAPI.KeyRing()
|
keyRing := serverKeyAPI.KeyRing()
|
||||||
|
|
@ -12,18 +12,15 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package main
|
package personalities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
"github.com/matrix-org/dendrite/signingkeyserver"
|
"github.com/matrix-org/dendrite/signingkeyserver"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func SigningKeyServer(base *setup.BaseDendrite, cfg *config.Dendrite) {
|
||||||
cfg := setup.ParseFlags(false)
|
|
||||||
base := setup.NewBaseDendrite(cfg, "SigningKeyServer", true)
|
|
||||||
defer base.Close() // nolint: errcheck
|
|
||||||
|
|
||||||
federation := base.CreateFederationClient()
|
federation := base.CreateFederationClient()
|
||||||
|
|
||||||
intAPI := signingkeyserver.NewInternalAPI(&base.Cfg.SigningKeyServer, federation, base.Caches)
|
intAPI := signingkeyserver.NewInternalAPI(&base.Cfg.SigningKeyServer, federation, base.Caches)
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017 Vector Creations Ltd
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@ -12,19 +12,15 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package main
|
package personalities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
"github.com/matrix-org/dendrite/syncapi"
|
"github.com/matrix-org/dendrite/syncapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func SyncAPI(base *setup.BaseDendrite, cfg *config.Dendrite) {
|
||||||
cfg := setup.ParseFlags(false)
|
|
||||||
|
|
||||||
base := setup.NewBaseDendrite(cfg, "SyncAPI", true)
|
|
||||||
defer base.Close() // nolint: errcheck
|
|
||||||
|
|
||||||
userAPI := base.UserAPIClient()
|
userAPI := base.UserAPIClient()
|
||||||
federation := base.CreateFederationClient()
|
federation := base.CreateFederationClient()
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017 Vector Creations Ltd
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@ -12,18 +12,15 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package main
|
package personalities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
"github.com/matrix-org/dendrite/userapi"
|
"github.com/matrix-org/dendrite/userapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func UserAPI(base *setup.BaseDendrite, cfg *config.Dendrite) {
|
||||||
cfg := setup.ParseFlags(false)
|
|
||||||
base := setup.NewBaseDendrite(cfg, "UserAPI", true)
|
|
||||||
defer base.Close() // nolint: errcheck
|
|
||||||
|
|
||||||
accountDB := base.CreateAccountsDB()
|
accountDB := base.CreateAccountsDB()
|
||||||
|
|
||||||
userAPI := userapi.NewInternalAPI(accountDB, &cfg.UserAPI, cfg.Derived.ApplicationServices, base.KeyServerHTTPClient())
|
userAPI := userapi.NewInternalAPI(accountDB, &cfg.UserAPI, cfg.Derived.ApplicationServices, base.KeyServerHTTPClient())
|
@ -24,7 +24,7 @@ use in production environments just yet!
|
|||||||
Dendrite requires:
|
Dendrite requires:
|
||||||
|
|
||||||
* Go 1.13 or higher
|
* Go 1.13 or higher
|
||||||
* Postgres 9.5 or higher (if using Postgres databases, not needed for SQLite)
|
* Postgres 9.6 or higher (if using Postgres databases, not needed for SQLite)
|
||||||
|
|
||||||
If you want to run a polylith deployment, you also need:
|
If you want to run a polylith deployment, you also need:
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ create them automatically at startup.
|
|||||||
|
|
||||||
### Postgres database setup
|
### Postgres database setup
|
||||||
|
|
||||||
Assuming that Postgres 9.5 (or later) is installed:
|
Assuming that Postgres 9.6 (or later) is installed:
|
||||||
|
|
||||||
* Create role, choosing a new password when prompted:
|
* Create role, choosing a new password when prompted:
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ This is what implements CS API endpoints. Clients talk to this via the proxy in
|
|||||||
order to send messages, create and join rooms, etc.
|
order to send messages, create and join rooms, etc.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/dendrite-client-api-server --config dendrite.yaml
|
./bin/dendrite-polylith-multi --config=dendrite.yaml clientapi
|
||||||
```
|
```
|
||||||
|
|
||||||
### Sync server
|
### Sync server
|
||||||
@ -198,7 +198,7 @@ This is what implements `/sync` requests. Clients talk to this via the proxy
|
|||||||
in order to receive messages.
|
in order to receive messages.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/dendrite-sync-api-server --config dendrite.yaml
|
./bin/dendrite-polylith-multi --config=dendrite.yaml syncapi
|
||||||
```
|
```
|
||||||
|
|
||||||
### Media server
|
### Media server
|
||||||
@ -207,7 +207,7 @@ This implements `/media` requests. Clients talk to this via the proxy in
|
|||||||
order to upload and retrieve media.
|
order to upload and retrieve media.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/dendrite-media-api-server --config dendrite.yaml
|
./bin/dendrite-polylith-multi --config=dendrite.yaml mediaapi
|
||||||
```
|
```
|
||||||
|
|
||||||
### Federation API server
|
### Federation API server
|
||||||
@ -217,7 +217,7 @@ order to send transactions. This is only required if you want to support
|
|||||||
federation.
|
federation.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/dendrite-federation-api-server --config dendrite.yaml
|
./bin/dendrite-polylith-multi --config=dendrite.yaml federationapi
|
||||||
```
|
```
|
||||||
|
|
||||||
### Internal components
|
### Internal components
|
||||||
@ -230,7 +230,7 @@ contacted by other components. This includes the following components.
|
|||||||
This is what implements the room DAG. Clients do not talk to this.
|
This is what implements the room DAG. Clients do not talk to this.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/dendrite-room-server --config dendrite.yaml
|
./bin/dendrite-polylith-multi --config=dendrite.yaml roomserver
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Federation sender
|
#### Federation sender
|
||||||
@ -239,7 +239,7 @@ This sends events from our users to other servers. This is only required if
|
|||||||
you want to support federation.
|
you want to support federation.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/dendrite-federation-sender-server --config dendrite.yaml
|
./bin/dendrite-polylith-multi --config=dendrite.yaml federationsender
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Appservice server
|
#### Appservice server
|
||||||
@ -250,7 +250,7 @@ running locally. This is only required if you want to support running
|
|||||||
application services on your homeserver.
|
application services on your homeserver.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/dendrite-appservice-server --config dendrite.yaml
|
./bin/dendrite-polylith-multi --config=dendrite.yaml appservice
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Key server
|
#### Key server
|
||||||
@ -258,7 +258,7 @@ application services on your homeserver.
|
|||||||
This manages end-to-end encryption keys for users.
|
This manages end-to-end encryption keys for users.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/dendrite-key-server --config dendrite.yaml
|
./bin/dendrite-polylith-multi --config=dendrite.yaml keyserver
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Signing key server
|
#### Signing key server
|
||||||
@ -266,7 +266,7 @@ This manages end-to-end encryption keys for users.
|
|||||||
This manages signing keys for servers.
|
This manages signing keys for servers.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/dendrite-signing-key-server --config dendrite.yaml
|
./bin/dendrite-polylith-multi --config=dendrite.yaml signingkeyserver
|
||||||
```
|
```
|
||||||
|
|
||||||
#### EDU server
|
#### EDU server
|
||||||
@ -274,7 +274,7 @@ This manages signing keys for servers.
|
|||||||
This manages processing EDUs such as typing, send-to-device events and presence. Clients do not talk to
|
This manages processing EDUs such as typing, send-to-device events and presence. Clients do not talk to
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/dendrite-edu-server --config dendrite.yaml
|
./bin/dendrite-polylith-multi --config=dendrite.yaml eduserver
|
||||||
```
|
```
|
||||||
|
|
||||||
#### User server
|
#### User server
|
||||||
@ -283,6 +283,6 @@ This manages user accounts, device access tokens and user account data,
|
|||||||
amongst other things.
|
amongst other things.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/dendrite-user-api-server --config dendrite.yaml
|
./bin/dendrite-polylith-multi --config=dendrite.yaml userapi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user