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:
Neil Alexander 2020-10-20 16:11:24 +01:00 committed by GitHub
parent 6c3c621de0
commit 39c7a8915c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 189 additions and 196 deletions

View file

@ -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

View file

@ -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} $@

View 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"]

View 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"]

View file

@ -2,7 +2,7 @@ version: "3.4"
services:
postgres:
hostname: postgres
image: postgres:9.5
image: postgres:9.6
restart: always
volumes:
- ./postgres/create_db.sh:/docker-entrypoint-initdb.d/20-create_db.sh

View file

@ -4,7 +4,6 @@ services:
hostname: monolith
image: matrixdotorg/dendrite-monolith:latest
command: [
"--config=dendrite.yaml",
"--tls-cert=server.crt",
"--tls-key=server.key"
]

View file

@ -2,22 +2,17 @@ version: "3.4"
services:
client_api:
hostname: client_api
image: matrixdotorg/dendrite-clientapi:latest
command: [
"--config=dendrite.yaml"
]
image: matrixdotorg/dendrite-polylith:latest
command: clientapi
volumes:
- ./config:/etc/dendrite
- room_server
networks:
- internal
media_api:
hostname: media_api
image: matrixdotorg/dendrite-mediaapi:latest
command: [
"--config=dendrite.yaml"
]
image: matrixdotorg/dendrite-polylith:latest
command: mediaapi
volumes:
- ./config:/etc/dendrite
networks:
@ -25,10 +20,8 @@ services:
sync_api:
hostname: sync_api
image: matrixdotorg/dendrite-syncapi:latest
command: [
"--config=dendrite.yaml"
]
image: matrixdotorg/dendrite-polylith:latest
command: syncapi
volumes:
- ./config:/etc/dendrite
networks:
@ -36,10 +29,8 @@ services:
room_server:
hostname: room_server
image: matrixdotorg/dendrite-roomserver:latest
command: [
"--config=dendrite.yaml"
]
image: matrixdotorg/dendrite-polylith:latest
command: roomserver
volumes:
- ./config:/etc/dendrite
networks:
@ -47,10 +38,8 @@ services:
edu_server:
hostname: edu_server
image: matrixdotorg/dendrite-eduserver:latest
command: [
"--config=dendrite.yaml"
]
image: matrixdotorg/dendrite-polylith:latest
command: eduserver
volumes:
- ./config:/etc/dendrite
networks:
@ -58,10 +47,8 @@ services:
federation_api:
hostname: federation_api
image: matrixdotorg/dendrite-federationapi:latest
command: [
"--config=dendrite.yaml"
]
image: matrixdotorg/dendrite-polylith:latest
command: federationapi
volumes:
- ./config:/etc/dendrite
networks:
@ -69,10 +56,8 @@ services:
federation_sender:
hostname: federation_sender
image: matrixdotorg/dendrite-federationsender:latest
command: [
"--config=dendrite.yaml"
]
image: matrixdotorg/dendrite-polylith:latest
command: federationsender
volumes:
- ./config:/etc/dendrite
networks:
@ -80,10 +65,8 @@ services:
key_server:
hostname: key_server
image: matrixdotorg/dendrite-keyserver:latest
command: [
"--config=dendrite.yaml"
]
image: matrixdotorg/dendrite-polylith:latest
command: keyserver
volumes:
- ./config:/etc/dendrite
networks:
@ -91,10 +74,8 @@ services:
signing_key_server:
hostname: signing_key_server
image: matrixdotorg/dendrite-signingkeyserver:latest
command: [
"--config=dendrite.yaml"
]
image: matrixdotorg/dendrite-polylith:latest
command: signingkeyserver
volumes:
- ./config:/etc/dendrite
networks:
@ -102,10 +83,8 @@ services:
user_api:
hostname: user_api
image: matrixdotorg/dendrite-userapi:latest
command: [
"--config=dendrite.yaml"
]
image: matrixdotorg/dendrite-polylith:latest
command: userapi
volumes:
- ./config:/etc/dendrite
networks:
@ -113,10 +92,8 @@ services:
appservice_api:
hostname: appservice_api
image: matrixdotorg/dendrite-appservice:latest
command: [
"--config=dendrite.yaml"
]
image: matrixdotorg/dendrite-polylith:latest
command: appservice
volumes:
- ./config:/etc/dendrite
networks:

View file

@ -8,16 +8,5 @@ echo "Building tag '${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-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 .
docker build -t matrixdotorg/dendrite-monolith:${TAG} -f build/docker/Dockerfile.monolith .
docker build -t matrixdotorg/dendrite-polylith:${TAG} -f build/docker/Dockerfile.polylith .

View file

@ -5,15 +5,4 @@ TAG=${1:-latest}
echo "Pulling tag '${TAG}'"
docker pull matrixdotorg/dendrite-monolith:${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}
docker pull matrixdotorg/dendrite-polylith:${TAG}

View file

@ -5,15 +5,4 @@ TAG=${1:-latest}
echo "Pushing tag '${TAG}'"
docker push matrixdotorg/dendrite-monolith:${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}
docker push matrixdotorg/dendrite-polylith:${TAG}

View file

@ -1,5 +1,5 @@
#!/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
done