diff --git a/cmd/client-api-proxy/main.go b/cmd/client-api-proxy/main.go index 27991c109..13952b5e1 100644 --- a/cmd/client-api-proxy/main.go +++ b/cmd/client-api-proxy/main.go @@ -24,6 +24,8 @@ import ( "strings" "time" + "github.com/matrix-org/dendrite/common/basecomponent" + log "github.com/sirupsen/logrus" ) @@ -48,13 +50,13 @@ Arguments: ` var ( - syncServerURL = flag.String("sync-api-server-url", "", "The base URL of the listening 'dendrite-sync-api-server' process. E.g. 'http://localhost:4200'") - clientAPIURL = flag.String("client-api-server-url", "", "The base URL of the listening 'dendrite-client-api-server' process. E.g. 'http://localhost:4321'") - mediaAPIURL = flag.String("media-api-server-url", "", "The base URL of the listening 'dendrite-media-api-server' process. E.g. 'http://localhost:7779'") - publicRoomsAPIURL = flag.String("public-rooms-api-server-url", "", "The base URL of the listening 'dendrite-public-rooms-api-server' process. E.g. 'http://localhost:7775'") - bindAddress = flag.String("bind-address", ":8008", "The listening port for the proxy.") - certFile = flag.String("tls-cert", "", "The PEM formatted X509 certificate to use for TLS") - keyFile = flag.String("tls-key", "", "The PEM private key to use for TLS") + syncServerURL = flag.String("sync-api-server-url", basecomponent.EnvParse("DENDRITE_SYNC_API_SERVER_URL", ""), "The base URL of the listening 'dendrite-sync-api-server' process. E.g. 'http://localhost:4200'") + clientAPIURL = flag.String("client-api-server-url", basecomponent.EnvParse("DENDRITE_CLIENT_API_URL", ""), "The base URL of the listening 'dendrite-client-api-server' process. E.g. 'http://localhost:4321'") + mediaAPIURL = flag.String("media-api-server-url", basecomponent.EnvParse("DENDRITE_MEDIA_API_URL", ""), "The base URL of the listening 'dendrite-media-api-server' process. E.g. 'http://localhost:7779'") + publicRoomsAPIURL = flag.String("public-rooms-api-server-url", basecomponent.EnvParse("DENDRITE_PUBLIC_ROOMS_API_URL", ""), "The base URL of the listening 'dendrite-public-rooms-api-server' process. E.g. 'http://localhost:7775'") + bindAddress = flag.String("bind-address", basecomponent.EnvParse("DENDRITE_CLIENT_API_PROXY_ADDRESS", ":8008"), "The listening port for the proxy.") + certFile = flag.String("tls-cert", basecomponent.EnvParse("DENDRITE_TLS_CERT_FILE", ""), "The PEM formatted X509 certificate to use for TLS") + keyFile = flag.String("tls-key", basecomponent.EnvParse("DENDRITE_TLS_KEY_FILE", ""), "The PEM private key to use for TLS") ) func makeProxy(targetURL string) (*httputil.ReverseProxy, error) { diff --git a/cmd/create-account/main.go b/cmd/create-account/main.go index fc51a5bb6..2ca12fd0a 100644 --- a/cmd/create-account/main.go +++ b/cmd/create-account/main.go @@ -22,6 +22,7 @@ import ( "github.com/matrix-org/dendrite/clientapi/auth/storage/accounts" "github.com/matrix-org/dendrite/clientapi/auth/storage/devices" + "github.com/matrix-org/dendrite/common/basecomponent" "github.com/matrix-org/gomatrixserverlib" ) @@ -34,11 +35,11 @@ Arguments: ` var ( - database = flag.String("database", "", "The location of the account database.") - username = flag.String("username", "", "The user ID localpart to register e.g 'alice' in '@alice:localhost'.") - password = flag.String("password", "", "Optional. The password to register with. If not specified, this account will be password-less.") - serverNameStr = flag.String("servername", "localhost", "The Matrix server domain which will form the domain part of the user ID.") - accessToken = flag.String("token", "", "Optional. The desired access_token to have. If not specified, a random access_token will be made.") + database = flag.String("database", basecomponent.EnvParse("DENDRITE_CREATE_ACCOUNT_DATABASE", ""), "The location of the account database.") + username = flag.String("username", basecomponent.EnvParse("DENDRITE_CREATE_ACCOUNT_USERNAME", ""), "The user ID localpart to register e.g 'alice' in '@alice:localhost'.") + password = flag.String("password", basecomponent.EnvParse("DENDRITE_CREATE_ACCOUNT_PASSWORD", ""), "Optional. The password to register with. If not specified, this account will be password-less.") + serverNameStr = flag.String("servername", basecomponent.EnvParse("DENDRITE_CREATE_ACCOUNT_SERVERNAME", "localhost"), "The Matrix server domain which will form the domain part of the user ID.") + accessToken = flag.String("token", basecomponent.EnvParse("DENDRITE_CREATE_ACCOUNT_ACCESS_TOKEN", ""), "Optional. The desired access_token to have. If not specified, a random access_token will be made.") ) func main() { diff --git a/cmd/create-room-events/main.go b/cmd/create-room-events/main.go index 8475914f0..a91a08ddb 100644 --- a/cmd/create-room-events/main.go +++ b/cmd/create-room-events/main.go @@ -25,6 +25,7 @@ import ( "strings" "time" + "github.com/matrix-org/dendrite/common/basecomponent" "github.com/matrix-org/dendrite/roomserver/api" "github.com/matrix-org/gomatrixserverlib" "golang.org/x/crypto/ed25519" @@ -40,13 +41,13 @@ Arguments: ` var ( - serverName = flag.String("server-name", "localhost", "The name of the matrix server to generate events for") - keyID = flag.String("key-id", "ed25519:auto", "The ID of the key used to sign the events") - privateKeyString = flag.String("private-key", defaultKey, "Base64 encoded private key to sign events with") - roomID = flag.String("room-id", "!roomid:$SERVER_NAME", "The room ID to generate events in") - userID = flag.String("user-id", "@userid:$SERVER_NAME", "The user ID to use as the event sender") + serverName = flag.String("server-name", basecomponent.EnvParse("DENDRITE_CREATE_ROOM_EVENTS_SERVERNAME", "localhost"), "The name of the matrix server to generate events for") + keyID = flag.String("key-id", basecomponent.EnvParse("DENDRITE_CREATE_ROOM_EVENTS_KEYID", "ed25519:auto"), "The ID of the key used to sign the events") + privateKeyString = flag.String("private-key", basecomponent.EnvParse("DENDRITE_CREATE_ROOM_EVENTS_PRIVATE_KEY", defaultKey), "Base64 encoded private key to sign events with") + roomID = flag.String("room-id", basecomponent.EnvParse("DENDRITE_CREATE_ROOM_EVENTS_ROOMID", "!roomid:$SERVER_NAME"), "The room ID to generate events in") + userID = flag.String("user-id", basecomponent.EnvParse("DENDRITE_CREATE_ROOM_EVENTS_USERID", "@userid:$SERVER_NAME"), "The user ID to use as the event sender") messageCount = flag.Int("message-count", 10, "The number of m.room.messsage events to generate") - format = flag.String("Format", "InputRoomEvent", "The output format to use for the messages: InputRoomEvent or Event") + format = flag.String("Format", basecomponent.EnvParse("DENDRITE_CREATE_ROOM_EVENTS_FORMAT", "InputRoomEvent"), "The output format to use for the messages: InputRoomEvent or Event") ) // By default we use a private key of 0. diff --git a/cmd/dendrite-monolith-server/main.go b/cmd/dendrite-monolith-server/main.go index b3de9adde..a6f4d438c 100644 --- a/cmd/dendrite-monolith-server/main.go +++ b/cmd/dendrite-monolith-server/main.go @@ -38,10 +38,10 @@ import ( ) var ( - httpBindAddr = flag.String("http-bind-address", ":8008", "The HTTP listening port for the server") - httpsBindAddr = flag.String("https-bind-address", ":8448", "The HTTPS listening port for the server") - certFile = flag.String("tls-cert", "", "The PEM formatted X509 certificate to use for TLS") - keyFile = flag.String("tls-key", "", "The PEM private key to use for TLS") + httpBindAddr = flag.String("http-bind-address", basecomponent.EnvParse("DENDRITE_MONOLITH_HTTP_BIND_ADDRESS", ":8008"), "The HTTP listening port for the server") + httpsBindAddr = flag.String("https-bind-address", basecomponent.EnvParse("DENDRITE_MONOLITH_HTTPS_BIND_ADDRESS", ":8448"), "The HTTPS listening port for the server") + certFile = flag.String("tls-cert", basecomponent.EnvParse("DENDRITE_TLS_CERT_FILE", ""), "The PEM formatted X509 certificate to use for TLS") + keyFile = flag.String("tls-key", basecomponent.EnvParse("DENDRITE_TLS_KEY_FILE", ""), "The PEM private key to use for TLS") ) func main() { diff --git a/cmd/federation-api-proxy/main.go b/cmd/federation-api-proxy/main.go index fa90482d5..8bd0e747a 100644 --- a/cmd/federation-api-proxy/main.go +++ b/cmd/federation-api-proxy/main.go @@ -24,6 +24,8 @@ import ( "strings" "time" + "github.com/matrix-org/dendrite/common/basecomponent" + log "github.com/sirupsen/logrus" ) @@ -48,11 +50,11 @@ Arguments: ` var ( - federationAPIURL = flag.String("federation-api-url", "", "The base URL of the listening 'dendrite-federation-api-server' process. E.g. 'http://localhost:4200'") - mediaAPIURL = flag.String("media-api-server-url", "", "The base URL of the listening 'dendrite-media-api-server' process. E.g. 'http://localhost:7779'") - bindAddress = flag.String("bind-address", ":8448", "The listening port for the proxy.") - certFile = flag.String("tls-cert", "server.crt", "The PEM formatted X509 certificate to use for TLS") - keyFile = flag.String("tls-key", "server.key", "The PEM private key to use for TLS") + federationAPIURL = flag.String("federation-api-url", basecomponent.EnvParse("DENDRITE_FEDERATION_API_URL", ""), "The base URL of the listening 'dendrite-federation-api-server' process. E.g. 'http://localhost:4200'") + mediaAPIURL = flag.String("media-api-server-url", basecomponent.EnvParse("DENDRITE_MEDIA_API_URL", ""), "The base URL of the listening 'dendrite-media-api-server' process. E.g. 'http://localhost:7779'") + bindAddress = flag.String("bind-address", basecomponent.EnvParse("DENDRITE_FEDERATION_PROXY_ADDRESS", ":8448"), "The listening port for the proxy.") + certFile = flag.String("tls-cert", basecomponent.EnvParse("DENDRITE_TLS_CERT_FILE", "server.crt"), "The PEM formatted X509 certificate to use for TLS") + keyFile = flag.String("tls-key", basecomponent.EnvParse("DENDRITE_TLS_KEY_FILE", "server.key"), "The PEM private key to use for TLS") ) func makeProxy(targetURL string) (*httputil.ReverseProxy, error) { diff --git a/cmd/generate-keys/main.go b/cmd/generate-keys/main.go index b807c2673..55cf2d9f7 100644 --- a/cmd/generate-keys/main.go +++ b/cmd/generate-keys/main.go @@ -20,6 +20,8 @@ import ( "log" "os" + "github.com/matrix-org/dendrite/common/basecomponent" + "github.com/matrix-org/dendrite/common/test" ) @@ -32,9 +34,9 @@ Arguments: ` var ( - tlsCertFile = flag.String("tls-cert", "", "An X509 certificate file to generate for use for TLS") - tlsKeyFile = flag.String("tls-key", "", "An RSA private key file to generate for use for TLS") - privateKeyFile = flag.String("private-key", "", "An Ed25519 private key to generate for use for object signing") + tlsCertFile = flag.String("tls-cert", basecomponent.EnvParse("DENDRITE_GENKEYS_TLS_CERT_OUT", ""), "An X509 certificate file to generate for use for TLS") + tlsKeyFile = flag.String("tls-key", basecomponent.EnvParse("DENDRITE_GENKEYS_TLS_KEY_OUT", ""), "An RSA private key file to generate for use for TLS") + privateKeyFile = flag.String("private-key", basecomponent.EnvParse("DENDRITE_GENKEYS_PEM_OUT", ""), "An Ed25519 private key to generate for use for object signing") ) func main() { diff --git a/cmd/kafka-producer/main.go b/cmd/kafka-producer/main.go index f5f243e4e..a57064571 100644 --- a/cmd/kafka-producer/main.go +++ b/cmd/kafka-producer/main.go @@ -21,6 +21,8 @@ import ( "os" "strings" + "github.com/matrix-org/dendrite/common/basecomponent" + sarama "gopkg.in/Shopify/sarama.v1" ) @@ -34,7 +36,7 @@ Arguments: var ( brokerList = flag.String("brokers", os.Getenv("KAFKA_PEERS"), "The comma separated list of brokers in the Kafka cluster. You can also set the KAFKA_PEERS environment variable") - topic = flag.String("topic", "", "REQUIRED: the topic to produce to") + topic = flag.String("topic", basecomponent.EnvParse("DENDRITE_KAFKAPROD_TOPIC", ""), "REQUIRED: the topic to produce to") partition = flag.Int("partition", 0, "The partition to produce to. All the messages will be written to this partition.") ) diff --git a/common/basecomponent/flags.go b/common/basecomponent/flags.go index 6dcb5601a..85681f50d 100644 --- a/common/basecomponent/flags.go +++ b/common/basecomponent/flags.go @@ -16,13 +16,14 @@ package basecomponent import ( "flag" + "os" "github.com/matrix-org/dendrite/common/config" "github.com/sirupsen/logrus" ) -var configPath = flag.String("config", "dendrite.yaml", "The path to the config file. For more information, see the config file in this repository.") +var configPath = flag.String("config", EnvParse("DENDRITE_CONFIG_FILE", "dendrite.yaml"), "The path to the config file. For more information, see the config file in this repository.") // ParseFlags parses the commandline flags and uses them to create a config. // If running as a monolith use `ParseMonolithFlags` instead. @@ -59,3 +60,12 @@ func ParseMonolithFlags() *config.Dendrite { return cfg } + +// EnvParse returns the value of the environmentvariable if it exists, otherwise `def`. +func EnvParse(env string, def string) string { + cnf, exists := os.LookupEnv(env) + if !exists { + cnf = def + } + return cnf +} diff --git a/docker/Dockerfile b/docker/Dockerfile index 29b27dde2..5810825a4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,8 +1,4 @@ -<<<<<<< HEAD FROM docker.io/golang:1.13.7-alpine3.11 -======= -FROM docker.io/golang:1.13.6-alpine ->>>>>>> master RUN mkdir /build diff --git a/docker/build.docker-compose.yml b/docker/build.docker-compose.yml new file mode 100644 index 000000000..f1ed83dd5 --- /dev/null +++ b/docker/build.docker-compose.yml @@ -0,0 +1,120 @@ +############################### +# Used for building images + +version: "3.4" +services: + dendrite-build: + image: dendrite-build + build: + context: .. + target: build + dockerfile: ./docker/dockerfiles/build.Dockerfile + monolith: + image: monolith:latest + build: + context: .. + target: monolith + dockerfile: ./docker/dockerfiles/monolith.Dockerfile + + client-api-proxy: + image: client-api-proxy:latest + build: + context: .. + target: client-api-proxy + dockerfile: ./docker/dockerfiles/client-api-proxy.Dockerfile + + client-api: + image: client-api:latest + build: + context: .. + target: client-api + dockerfile: ./docker/dockerfiles/client-api.Dockerfile + + media-api: + image: media-api:latest + build: + context: .. + target: media-api + dockerfile: ./docker/dockerfiles/media-api.Dockerfile + + public-rooms-api: + image: public-rooms-api:latest + build: + context: .. + target: public-rooms-api + dockerfile: ./docker/dockerfiles/public-rooms-api.Dockerfile + + sync-api: + image: sync-api:latest + build: + context: .. + target: sync-api + dockerfile: ./docker/dockerfiles/sync-api.Dockerfile + + room-server: + image: room-server:latest + build: + context: .. + target: room-server + dockerfile: ./docker/dockerfiles/room-server.Dockerfile + + typing-server: + image: typing-server:latest + build: + context: .. + target: typing-server + dockerfile: ./docker/dockerfiles/typing-server.Dockerfile + + federation-api-proxy: + image: federation-api-proxy:latest + build: + context: .. + target: federation-api-proxy + dockerfile: ./docker/dockerfiles/federation-api-proxy.Dockerfile + + federation-api: + image: federation-api:latest + build: + context: .. + target: federation-api + dockerfile: ./docker/dockerfiles/federation-api.Dockerfile + + federation-sender: + image: federation-sender:latest + build: + context: .. + target: federation-sender + dockerfile: ./docker/dockerfiles/federation-sender.Dockerfile + + appservice-server: + image: appservice-server:latest + build: + context: .. + target: appservice-server + dockerfile: ./docker/dockerfiles/appservice-server.Dockerfile + + generate-keys-tool: + image: generate-keys-tool:latest + build: + context: .. + target: generate-keys-tool + dockerfile: ./docker/dockerfiles/generate-keys-tool.Dockerfile + + create-account-tool: + image: create-account-tool:latest + build: + context: .. + target: create-account-tool + dockerfile: ./docker/dockerfiles/create-account-tool.Dockerfile + create-room-events-tool: + image: create-room-events-tool:latest + build: + context: .. + target: create-room-events-tool + dockerfile: ./docker/dockerfiles/create-room-events-tool.Dockerfile + kafka-producer: + image: kafka-producer:latest + build: + context: .. + target: kafka-producer + dockerfile: ./docker/dockerfiles/kafka-producer.Dockerfile diff --git a/docker/build.sh b/docker/build.sh deleted file mode 100644 index a3e3ca24d..000000000 --- a/docker/build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -./build.sh - -# Generate the keys if they don't already exist. -if [ ! -f server.key ] || [ ! -f server.crt ] || [ ! -f matrix_key.pem ]; then - echo "Generating keys ..." - - rm -f server.key server.crt matrix_key.pem - - test -f server.key || openssl req -x509 -newkey rsa:4096 \ - -keyout server.key \ - -out server.crt \ - -days 3650 -nodes \ - -subj /CN=localhost - - test -f matrix_key.pem || /build/bin/generate-keys -private-key matrix_key.pem -fi diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml deleted file mode 100644 index d738ed3f0..000000000 --- a/docker/docker-compose.yml +++ /dev/null @@ -1,192 +0,0 @@ -version: "3.4" -services: - riot: - image: vectorim/riot-web - networks: - - internal - ports: - - "8500:80" - - monolith: - container_name: dendrite_monolith - hostname: monolith - entrypoint: ["bash", "./docker/services/monolith.sh", "--config", "/etc/dendrite/dendrite.yaml"] - build: ./ - volumes: - - ..:/build - - ./build/bin:/build/bin - - ../cfg:/etc/dendrite - networks: - - internal - depends_on: - - postgres - ports: - - "8008:8008" - - "8448:8448" - - client_api_proxy: - container_name: dendrite_client_api_proxy - hostname: client_api_proxy - entrypoint: ["bash", "./docker/services/client-api-proxy.sh"] - build: ./ - volumes: - - ..:/build - networks: - - internal - depends_on: - - postgres - - sync_api - - client_api - - media_api - - public_rooms_api - ports: - - "8008:8008" - - client_api: - container_name: dendrite_client_api - hostname: client_api - entrypoint: ["bash", "./docker/services/client-api.sh"] - build: ./ - volumes: - - ..:/build - depends_on: - - postgres - - room_server - networks: - - internal - - media_api: - container_name: dendrite_media_api - hostname: media_api - entrypoint: ["bash", "./docker/services/media-api.sh"] - build: ./ - volumes: - - ..:/build - depends_on: - - postgres - networks: - - internal - - public_rooms_api: - container_name: dendrite_public_rooms_api - hostname: public_rooms_api - entrypoint: ["bash", "./docker/services/public-rooms-api.sh"] - build: ./ - volumes: - - ..:/build - depends_on: - - postgres - networks: - - internal - - sync_api: - container_name: dendrite_sync_api - hostname: sync_api - entrypoint: ["bash", "./docker/services/sync-api.sh"] - build: ./ - volumes: - - ..:/build - depends_on: - - postgres - networks: - - internal - - room_server: - container_name: dendrite_room_server - hostname: room_server - entrypoint: ["bash", "./docker/services/room-server.sh"] - build: ./ - volumes: - - ..:/build - depends_on: - - postgres - networks: - - internal - - typing_server: - container_name: dendrite_typing_server - hostname: typing_server - entrypoint: ["bash", "./docker/services/typing-server.sh"] - build: ./ - volumes: - - ..:/build - networks: - - internal - - federation_api_proxy: - container_name: dendrite_federation_api_proxy - hostname: federation_api_proxy - entrypoint: ["bash", "./docker/services/federation-api-proxy.sh"] - build: ./ - volumes: - - ..:/build - depends_on: - - postgres - - federation_api - - federation_sender - - media_api - networks: - - internal - ports: - - "8448:8448" - - federation_api: - container_name: dendrite_federation_api - hostname: federation_api - entrypoint: ["bash", "./docker/services/federation-api.sh"] - build: ./ - volumes: - - ..:/build - depends_on: - - postgres - networks: - - internal - - federation_sender: - container_name: dendrite_federation_sender - hostname: federation_sender - entrypoint: ["bash", "./docker/services/federation-sender.sh"] - build: ./ - volumes: - - ..:/build - depends_on: - - postgres - networks: - - internal - - postgres: - container_name: dendrite_postgres - hostname: postgres - image: postgres:9.5 - restart: always - volumes: - - ./postgres/create_db.sh:/docker-entrypoint-initdb.d/20-create_db.sh - environment: - POSTGRES_PASSWORD: itsasecret - POSTGRES_USER: dendrite - networks: - - internal - - zookeeper: - container_name: dendrite_zk - hostname: zookeeper - image: zookeeper - networks: - - internal - - kafka: - container_name: dendrite_kafka - hostname: kafka - image: wurstmeister/kafka - environment: - KAFKA_ADVERTISED_HOST_NAME: "kafka" - KAFKA_DELETE_TOPIC_ENABLE: "true" - KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181" - depends_on: - - zookeeper - networks: - - internal - -networks: - internal: - attachable: true diff --git a/docker/dockerfiles/appservice-server.Dockerfile b/docker/dockerfiles/appservice-server.Dockerfile new file mode 100644 index 000000000..078ac3bbe --- /dev/null +++ b/docker/dockerfiles/appservice-server.Dockerfile @@ -0,0 +1,11 @@ +FROM dendrite-build AS build +####################### +## Appservice Server ## +####################### +FROM scratch AS appservice-server +EXPOSE 7777 +ENV DENDRITE_CONFIG_FILE="dendrite.yaml" +WORKDIR /dendrite +COPY --from=build /build/bin/dendrite-appservice-server /bin/appservice-server +COPY --from=build /build/docker/dendrite-docker.yml ./dendrite.yaml +ENTRYPOINT ["/bin/appservice-server"] diff --git a/docker/dockerfiles/build.Dockerfile b/docker/dockerfiles/build.Dockerfile new file mode 100644 index 000000000..e578565ac --- /dev/null +++ b/docker/dockerfiles/build.Dockerfile @@ -0,0 +1,8 @@ +########### +## Build ## +########### +FROM golang:1.13-alpine AS build +RUN apk --update --no-cache add openssl bash git ca-certificates +WORKDIR /build +COPY . . +RUN CGO_ENABLED=0 GOOS=linux GOBIN=$PWD/bin go install -v ./cmd/... diff --git a/docker/dockerfiles/client-api-proxy.Dockerfile b/docker/dockerfiles/client-api-proxy.Dockerfile new file mode 100644 index 000000000..f2c565a80 --- /dev/null +++ b/docker/dockerfiles/client-api-proxy.Dockerfile @@ -0,0 +1,9 @@ +FROM dendrite-build AS build +###################### +## Client API Proxy ## +###################### +FROM scratch AS client-api-proxy +EXPOSE 8008 +ENV CLIENT_API_SERVER_URL="http://client-api:7771" SYNC_API_SERVER_URL="http://sync-api:7773" MEDIA_API_SERVER_URL="http://media-api:7774" PUBLIC_ROOMS_API_SERVER_URL="http://public-rooms-api:7775" +COPY --from=build /build/bin/client-api-proxy /bin/client-api-proxy +ENTRYPOINT ["/bin/client-api-proxy", "--bind-address=`:8008`"] diff --git a/docker/dockerfiles/client-api.Dockerfile b/docker/dockerfiles/client-api.Dockerfile new file mode 100644 index 000000000..770ee60c8 --- /dev/null +++ b/docker/dockerfiles/client-api.Dockerfile @@ -0,0 +1,11 @@ +FROM dendrite-build AS build +################ +## Client API ## +################ +FROM scratch AS client-api +EXPOSE 7771 +ENV DENDRITE_CONFIG_FILE="dendrite.yaml" +WORKDIR /dendrite +COPY --from=build /build/bin/dendrite-client-api-server /bin/client-api +COPY --from=build /build/docker/dendrite-docker.yml ./dendrite.yaml +ENTRYPOINT ["/bin/client-api"] diff --git a/docker/dockerfiles/create-account-tool.Dockerfile b/docker/dockerfiles/create-account-tool.Dockerfile new file mode 100644 index 000000000..96fe7383c --- /dev/null +++ b/docker/dockerfiles/create-account-tool.Dockerfile @@ -0,0 +1,7 @@ +FROM dendrite-build AS build +######################### +## Create Account Tool ## +######################### +FROM scratch AS create-account-tool +COPY --from=build /build/bin/create-account /bin/create-account +ENTRYPOINT ["/bin/create-account"] diff --git a/docker/dockerfiles/create-room-events-tool.Dockerfile b/docker/dockerfiles/create-room-events-tool.Dockerfile new file mode 100644 index 000000000..ea1e111f2 --- /dev/null +++ b/docker/dockerfiles/create-room-events-tool.Dockerfile @@ -0,0 +1,7 @@ +FROM dendrite-build AS build +############################# +## Create Room Events Tool ## +############################# +FROM scratch AS create-room-events-tool +COPY --from=build /build/bin/create-room-events /bin/create-room-events +ENTRYPOINT ["/bin/create-room-events"] diff --git a/docker/dockerfiles/federation-api-proxy.Dockerfile b/docker/dockerfiles/federation-api-proxy.Dockerfile new file mode 100644 index 000000000..fb5c607a6 --- /dev/null +++ b/docker/dockerfiles/federation-api-proxy.Dockerfile @@ -0,0 +1,9 @@ +FROM dendrite-build AS build +########################## +## Federation API Proxy ## +########################## +FROM scratch AS federation-api-proxy +EXPOSE 8008 +ENV FEDERATION_API_SERVER_URL="http://federation-api:7772" MEDIA_API_SERVER_URL="http://media-api:7774" +COPY --from=build /build/bin/federation-api-proxy /bin/federation-api-proxy +ENTRYPOINT ["/bin/federation-api-proxy", "--bind-address=`:8008`"] diff --git a/docker/dockerfiles/federation-api.Dockerfile b/docker/dockerfiles/federation-api.Dockerfile new file mode 100644 index 000000000..82881b2a4 --- /dev/null +++ b/docker/dockerfiles/federation-api.Dockerfile @@ -0,0 +1,11 @@ +FROM dendrite-build AS build +#################### +## Federation API ## +#################### +FROM scratch AS federation-api +EXPOSE 7772 +ENV DENDRITE_CONFIG_FILE="dendrite.yaml" +WORKDIR /dendrite +COPY --from=build /build/bin/dendrite-federation-api-server /bin/federation-api +COPY --from=build /build/docker/dendrite-docker.yml ./dendrite.yaml +ENTRYPOINT ["/bin/federation-api"] diff --git a/docker/dockerfiles/federation-sender.Dockerfile b/docker/dockerfiles/federation-sender.Dockerfile new file mode 100644 index 000000000..a1435a983 --- /dev/null +++ b/docker/dockerfiles/federation-sender.Dockerfile @@ -0,0 +1,11 @@ +FROM dendrite-build AS build +####################### +## Federation Sender ## +####################### +FROM scratch AS federation-sender +EXPOSE 7776 +ENV DENDRITE_CONFIG_FILE="dendrite.yaml" +WORKDIR /dendrite +COPY --from=build /build/bin/dendrite-federation-sender-server /bin/federation-sender +COPY --from=build /build/docker/dendrite-docker.yml ./dendrite.yaml +ENTRYPOINT ["/bin/federation-sender"] diff --git a/docker/dockerfiles/generate-keys-tool.Dockerfile b/docker/dockerfiles/generate-keys-tool.Dockerfile new file mode 100644 index 000000000..2e1b7903d --- /dev/null +++ b/docker/dockerfiles/generate-keys-tool.Dockerfile @@ -0,0 +1,7 @@ +FROM dendrite-build AS build +######################## +## Generate Keys Tool ## +######################## +FROM scratch AS generate-keys-tool +COPY --from=build /build/bin/generate-keys /bin/generate-keys +ENTRYPOINT ["/bin/generate-keys"] diff --git a/docker/dockerfiles/kafka-producer.Dockerfile b/docker/dockerfiles/kafka-producer.Dockerfile new file mode 100644 index 000000000..0d9d63df1 --- /dev/null +++ b/docker/dockerfiles/kafka-producer.Dockerfile @@ -0,0 +1,7 @@ +FROM dendrite-build AS build +#################### +## Kafka Producer ## +#################### +FROM scratch AS kafka-producer +COPY --from=build /build/bin/kafka-producer /bin/kafka-producer +ENTRYPOINT ["/bin/kafka-producer"] diff --git a/docker/dockerfiles/media-api.Dockerfile b/docker/dockerfiles/media-api.Dockerfile new file mode 100644 index 000000000..63f38ef23 --- /dev/null +++ b/docker/dockerfiles/media-api.Dockerfile @@ -0,0 +1,11 @@ +FROM dendrite-build AS build +############### +## Media API ## +############### +FROM scratch AS media-api +EXPOSE 7774 +ENV DENDRITE_CONFIG_FILE="dendrite.yaml" +WORKDIR /dendrite +COPY --from=build /build/bin/dendrite-media-api-server /bin/media-api +COPY --from=build /build/docker/dendrite-docker.yml ./dendrite.yaml +ENTRYPOINT ["/bin/media-api"] diff --git a/docker/dockerfiles/monolith.Dockerfile b/docker/dockerfiles/monolith.Dockerfile new file mode 100644 index 000000000..4c541da0a --- /dev/null +++ b/docker/dockerfiles/monolith.Dockerfile @@ -0,0 +1,13 @@ +FROM dendrite-build AS build + +############## +## Monolith ## +############## +FROM scratch AS monolith +EXPOSE 8008 8448 +ENV DENDRITE_CONFIG_FILE="dendrite.yaml" TLS_CERT_FILE="server.crt" TLS_KEY_FILE="server.key" +WORKDIR /dendrite +COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=build /build/bin/dendrite-monolith-server /bin/monolith +COPY --from=build /build/docker/dendrite-docker.yml ./dendrite.yaml +ENTRYPOINT ["/bin/monolith"] diff --git a/docker/dockerfiles/public-rooms-api.Dockerfile b/docker/dockerfiles/public-rooms-api.Dockerfile new file mode 100644 index 000000000..e8844e62b --- /dev/null +++ b/docker/dockerfiles/public-rooms-api.Dockerfile @@ -0,0 +1,11 @@ +FROM dendrite-build AS build +###################### +## Public Rooms API ## +###################### +FROM scratch AS public-rooms-api +EXPOSE 7775 +ENV DENDRITE_CONFIG_FILE="dendrite.yaml" +WORKDIR /dendrite +COPY --from=build /build/bin/dendrite-public-rooms-api-server /bin/public-rooms-api +COPY --from=build /build/docker/dendrite-docker.yml ./dendrite.yaml +ENTRYPOINT ["/bin/public-rooms-api"] diff --git a/docker/dockerfiles/room-server.Dockerfile b/docker/dockerfiles/room-server.Dockerfile new file mode 100644 index 000000000..34d6a5236 --- /dev/null +++ b/docker/dockerfiles/room-server.Dockerfile @@ -0,0 +1,11 @@ +FROM dendrite-build AS build +################# +## Room Server ## +################# +FROM scratch AS room-server +EXPOSE 7770 +ENV DENDRITE_CONFIG_FILE="dendrite.yaml" +WORKDIR /dendrite +COPY --from=build /build/bin/dendrite-room-server /bin/room-server +COPY --from=build /build/docker/dendrite-docker.yml ./dendrite.yaml +ENTRYPOINT ["/bin/room-server"] diff --git a/docker/dockerfiles/sync-api.Dockerfile b/docker/dockerfiles/sync-api.Dockerfile new file mode 100644 index 000000000..824b7af6f --- /dev/null +++ b/docker/dockerfiles/sync-api.Dockerfile @@ -0,0 +1,11 @@ +FROM dendrite-build AS build +############## +## Sync API ## +############## +FROM scratch AS sync-api +EXPOSE 7773 +ENV DENDRITE_CONFIG_FILE="dendrite.yaml" +WORKDIR /dendrite +COPY --from=build /build/bin/dendrite-sync-api-server /bin/sync-api +COPY --from=build /build/docker/dendrite-docker.yml ./dendrite.yaml +ENTRYPOINT ["/bin/sync-api"] diff --git a/docker/dockerfiles/typing-server.Dockerfile b/docker/dockerfiles/typing-server.Dockerfile new file mode 100644 index 000000000..a0224d908 --- /dev/null +++ b/docker/dockerfiles/typing-server.Dockerfile @@ -0,0 +1,11 @@ +FROM dendrite-build AS build +################### +## Typing Server ## +################### +FROM scratch AS typing-server +EXPOSE 7778 +ENV DENDRITE_CONFIG_FILE="dendrite.yaml" +WORKDIR /dendrite +COPY --from=build /build/bin/dendrite-typing-server /bin/typing-server +COPY --from=build /build/docker/dendrite-docker.yml ./dendrite.yaml +ENTRYPOINT ["/bin/typing-server"] diff --git a/docker/services/client-api-proxy.sh b/docker/services/client-api-proxy.sh deleted file mode 100644 index 931f7abbc..000000000 --- a/docker/services/client-api-proxy.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -bash ./docker/build.sh - -./bin/client-api-proxy --bind-address ":8008" \ - --client-api-server-url "http://client_api:7771" \ - --sync-api-server-url "http://sync_api:7773" \ - --media-api-server-url "http://media_api:7774" \ - --public-rooms-api-server-url "http://public_rooms_api:7775" \ diff --git a/docker/services/client-api.sh b/docker/services/client-api.sh deleted file mode 100644 index 8dc822421..000000000 --- a/docker/services/client-api.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -bash ./docker/build.sh - -./bin/dendrite-client-api-server --config=dendrite.yaml diff --git a/docker/services/federation-api-proxy.sh b/docker/services/federation-api-proxy.sh deleted file mode 100644 index 6ea75c95a..000000000 --- a/docker/services/federation-api-proxy.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -bash ./docker/build.sh - -./bin/federation-api-proxy --bind-address ":8448" \ - --federation-api-url "http://federation_api_server:7772" \ - --media-api-server-url "http://media_api:7774" \ diff --git a/docker/services/federation-api.sh b/docker/services/federation-api.sh deleted file mode 100644 index 807a7cf83..000000000 --- a/docker/services/federation-api.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -bash ./docker/build.sh - -./bin/dendrite-federation-api-server --config dendrite.yaml diff --git a/docker/services/federation-sender.sh b/docker/services/federation-sender.sh deleted file mode 100644 index ea116ef3c..000000000 --- a/docker/services/federation-sender.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -bash ./docker/build.sh - -./bin/dendrite-federation-sender-server --config dendrite.yaml diff --git a/docker/services/media-api.sh b/docker/services/media-api.sh deleted file mode 100644 index 876b3aa8d..000000000 --- a/docker/services/media-api.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -bash ./docker/build.sh - -./bin/dendrite-media-api-server --config dendrite.yaml diff --git a/docker/services/monolith.sh b/docker/services/monolith.sh deleted file mode 100644 index 2287555cd..000000000 --- a/docker/services/monolith.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -bash ./docker/build.sh - -./bin/dendrite-monolith-server --tls-cert=server.crt --tls-key=server.key $@ diff --git a/docker/services/public-rooms-api.sh b/docker/services/public-rooms-api.sh deleted file mode 100644 index 652afcfec..000000000 --- a/docker/services/public-rooms-api.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -bash ./docker/build.sh - -./bin/dendrite-public-rooms-api-server --config dendrite.yaml diff --git a/docker/services/room-server.sh b/docker/services/room-server.sh deleted file mode 100644 index 473b5f5d3..000000000 --- a/docker/services/room-server.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -bash ./docker/build.sh - -./bin/dendrite-room-server --config=dendrite.yaml diff --git a/docker/services/sync-api.sh b/docker/services/sync-api.sh deleted file mode 100644 index ac6433fa5..000000000 --- a/docker/services/sync-api.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -bash ./docker/build.sh - -./bin/dendrite-sync-api-server --config=dendrite.yaml diff --git a/docker/services/typing-server.sh b/docker/services/typing-server.sh deleted file mode 100644 index 16ee0fa62..000000000 --- a/docker/services/typing-server.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -bash ./docker/build.sh - -./bin/dendrite-typing-server --config=dendrite.yaml