aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-10-20 16:11:24 +0100
committerGitHub <noreply@github.com>2020-10-20 16:11:24 +0100
commit39c7a8915ccba3ac4d281ae7938f2e912ad966b4 (patch)
tree321ebe39b305dea1d844e9bd922939aa0ea4d70d /build
parent6c3c621de09a62c7ec8d89b2d8e6a9d73833fd0b (diff)
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
Diffstat (limited to 'build')
-rw-r--r--build/docker/Dockerfile2
-rw-r--r--build/docker/Dockerfile.component14
-rw-r--r--build/docker/Dockerfile.monolith13
-rw-r--r--build/docker/Dockerfile.polylith13
-rw-r--r--build/docker/docker-compose.deps.yml2
-rw-r--r--build/docker/docker-compose.monolith.yml1
-rw-r--r--build/docker/docker-compose.polylith.yml67
-rwxr-xr-xbuild/docker/images-build.sh15
-rwxr-xr-xbuild/docker/images-pull.sh13
-rwxr-xr-xbuild/docker/images-push.sh13
-rwxr-xr-xbuild/docker/postgres/create_db.sh2
11 files changed, 55 insertions, 100 deletions
diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile
index d8e07681..5cab0530 100644
--- a/build/docker/Dockerfile
+++ b/build/docker/Dockerfile
@@ -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
diff --git a/build/docker/Dockerfile.component b/build/docker/Dockerfile.component
deleted file mode 100644
index 1acf510f..00000000
--- a/build/docker/Dockerfile.component
+++ /dev/null
@@ -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} $@ \ No newline at end of file
diff --git a/build/docker/Dockerfile.monolith b/build/docker/Dockerfile.monolith
new file mode 100644
index 00000000..3e9d0cba
--- /dev/null
+++ b/build/docker/Dockerfile.monolith
@@ -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"] \ No newline at end of file
diff --git a/build/docker/Dockerfile.polylith b/build/docker/Dockerfile.polylith
new file mode 100644
index 00000000..dd4cbd38
--- /dev/null
+++ b/build/docker/Dockerfile.polylith
@@ -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"] \ No newline at end of file
diff --git a/build/docker/docker-compose.deps.yml b/build/docker/docker-compose.deps.yml
index 74e478a8..1a27ffac 100644
--- a/build/docker/docker-compose.deps.yml
+++ b/build/docker/docker-compose.deps.yml
@@ -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
diff --git a/build/docker/docker-compose.monolith.yml b/build/docker/docker-compose.monolith.yml
index 7d63e1c6..8fb79834 100644
--- a/build/docker/docker-compose.monolith.yml
+++ b/build/docker/docker-compose.monolith.yml
@@ -4,7 +4,6 @@ services:
hostname: monolith
image: matrixdotorg/dendrite-monolith:latest
command: [
- "--config=dendrite.yaml",
"--tls-cert=server.crt",
"--tls-key=server.key"
]
diff --git a/build/docker/docker-compose.polylith.yml b/build/docker/docker-compose.polylith.yml
index e8da9c24..f377e36f 100644
--- a/build/docker/docker-compose.polylith.yml
+++ b/build/docker/docker-compose.polylith.yml
@@ -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:
diff --git a/build/docker/images-build.sh b/build/docker/images-build.sh
index daad63be..f80f6bed 100755
--- a/build/docker/images-build.sh
+++ b/build/docker/images-build.sh
@@ -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 . \ No newline at end of file
diff --git a/build/docker/images-pull.sh b/build/docker/images-pull.sh
index e3284a2a..496e8006 100755
--- a/build/docker/images-pull.sh
+++ b/build/docker/images-pull.sh
@@ -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} \ No newline at end of file
diff --git a/build/docker/images-push.sh b/build/docker/images-push.sh
index e4eb773a..fd9b999e 100755
--- a/build/docker/images-push.sh
+++ b/build/docker/images-push.sh
@@ -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} \ No newline at end of file
diff --git a/build/docker/postgres/create_db.sh b/build/docker/postgres/create_db.sh
index 97514467..7495a397 100755
--- a/build/docker/postgres/create_db.sh
+++ b/build/docker/postgres/create_db.sh
@@ -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