summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
Diffstat (limited to 'docker')
-rw-r--r--docker/README.md14
-rw-r--r--docker/ci-binaries-packaging.Dockerfile48
-rw-r--r--docker/docker-compose.for-traefik.yml31
3 files changed, 50 insertions, 43 deletions
diff --git a/docker/README.md b/docker/README.md
index 1c9a03d..c980adc 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -24,7 +24,17 @@ which also will tag the resulting image as `matrixconduit/matrix-conduit:latest`
After building the image you can simply run it with
```bash
-docker run -d -p 8448:6167 -v ~/conduit.toml:/srv/conduit/conduit.toml -v db:/srv/conduit/.local/share/conduit matrixconduit/matrix-conduit:latest
+docker run -d -p 8448:6167 \
+ -v db:/var/lib/matrix-conduit/ \
+ -e CONDUIT_SERVER_NAME="your.server.name" \
+ -e CONDUIT_DATABASE_BACKEND="rocksdb" \
+ -e CONDUIT_ALLOW_REGISTRATION=true \
+ -e CONDUIT_ALLOW_FEDERATION=true \
+ -e CONDUIT_MAX_REQUEST_SIZE="20_000_000" \
+ -e CONDUIT_TRUSTED_SERVERS="[\"matrix.org\"]" \
+ -e CONDUIT_MAX_CONCURRENT_REQUESTS="100" \
+ -e CONDUIT_LOG="info,rocket=off,_=off,sled=off" \
+ --name conduit matrixconduit/matrix-conduit:latest
```
or you can skip the build step and pull the image from one of the following registries:
@@ -127,4 +137,4 @@ So...step by step:
```
6. Run `docker-compose up -d`
-7. Connect to your homeserver with your preferred client and create a user. You should do this immediatly after starting Conduit, because the first created user is the admin.
+7. Connect to your homeserver with your preferred client and create a user. You should do this immediately after starting Conduit, because the first created user is the admin.
diff --git a/docker/ci-binaries-packaging.Dockerfile b/docker/ci-binaries-packaging.Dockerfile
index 3731bac..ee1ca4c 100644
--- a/docker/ci-binaries-packaging.Dockerfile
+++ b/docker/ci-binaries-packaging.Dockerfile
@@ -14,9 +14,14 @@ FROM docker.io/alpine:3.15.0 AS runner
# You still need to map the port when using the docker command or docker-compose.
EXPOSE 6167
-# Note from @jfowl: I would like to remove the config file in the future and just have the Docker version be configured with envs.
-ENV CONDUIT_CONFIG="/srv/conduit/conduit.toml" \
- CONDUIT_PORT=6167
+# Users are expected to mount a volume to this directory:
+ARG DEFAULT_DB_PATH=/var/lib/matrix-conduit
+
+ENV CONDUIT_PORT=6167 \
+ CONDUIT_ADDRESS="0.0.0.0" \
+ CONDUIT_DATABASE_PATH=${DEFAULT_DB_PATH} \
+ CONDUIT_CONFIG=''
+# └─> Set no config file to do all configuration with env vars
# Conduit needs:
# ca-certificates: for https
@@ -25,7 +30,6 @@ RUN apk add --no-cache \
ca-certificates \
iproute2
-
ARG CREATED
ARG VERSION
ARG GIT_REF
@@ -45,36 +49,36 @@ LABEL org.opencontainers.image.created=${CREATED} \
org.opencontainers.image.ref.name=""
# Created directory for the database and media files
-RUN mkdir -p /srv/conduit/.local/share/conduit
+RUN mkdir -p ${DEFAULT_DB_PATH}
# Test if Conduit is still alive, uses the same endpoint as Element
COPY ./docker/healthcheck.sh /srv/conduit/healthcheck.sh
HEALTHCHECK --start-period=5s --interval=5s CMD ./healthcheck.sh
-
-# Depending on the target platform (e.g. "linux/arm/v7", "linux/arm64/v8", or "linux/amd64")
-# copy the matching binary into this docker image
-ARG TARGETPLATFORM
-COPY ./$TARGETPLATFORM /srv/conduit/conduit
-
-
# Improve security: Don't run stuff as root, that does not need to run as root:
-# Add www-data user and group with UID 82, as used by alpine
-# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install
+# Most distros also use 1000:1000 for the first real user, so this should resolve volume mounting problems.
+ARG USER_ID=1000
+ARG GROUP_ID=1000
RUN set -x ; \
- addgroup -Sg 82 www-data 2>/dev/null ; \
- adduser -S -D -H -h /srv/conduit -G www-data -g www-data www-data 2>/dev/null ; \
- addgroup www-data www-data 2>/dev/null && exit 0 ; exit 1
+ deluser --remove-home www-data ; \
+ addgroup -S -g ${GROUP_ID} conduit 2>/dev/null ; \
+ adduser -S -u ${USER_ID} -D -H -h /srv/conduit -G conduit -g conduit conduit 2>/dev/null ; \
+ addgroup conduit conduit 2>/dev/null && exit 0 ; exit 1
-# Change ownership of Conduit files to www-data user and group
-RUN chown -cR www-data:www-data /srv/conduit
-RUN chmod +x /srv/conduit/healthcheck.sh
+# Change ownership of Conduit files to conduit user and group
+RUN chown -cR conduit:conduit /srv/conduit && \
+ chmod +x /srv/conduit/healthcheck.sh
-# Change user to www-data
-USER www-data
+# Change user to conduit
+USER conduit
# Set container home directory
WORKDIR /srv/conduit
# Run Conduit and print backtraces on panics
ENV RUST_BACKTRACE=1
ENTRYPOINT [ "/srv/conduit/conduit" ]
+
+# Depending on the target platform (e.g. "linux/arm/v7", "linux/arm64/v8", or "linux/amd64")
+# copy the matching binary into this docker image
+ARG TARGETPLATFORM
+COPY --chown=conduit:conduit ./$TARGETPLATFORM /srv/conduit/conduit
diff --git a/docker/docker-compose.for-traefik.yml b/docker/docker-compose.for-traefik.yml
index f625080..ca560b8 100644
--- a/docker/docker-compose.for-traefik.yml
+++ b/docker/docker-compose.for-traefik.yml
@@ -18,28 +18,22 @@ services:
# GIT_REF: origin/master
restart: unless-stopped
volumes:
- - db:/srv/conduit/.local/share/conduit
- ### Uncomment if you want to use conduit.toml to configure Conduit
- ### Note: Set env vars will override conduit.toml values
- # - ./conduit.toml:/srv/conduit/conduit.toml
+ - db:/var/lib/matrix-conduit/
networks:
- proxy
environment:
- CONDUIT_SERVER_NAME: localhost:6167 # replace with your own name
+ CONDUIT_SERVER_NAME: your.server.name # EDIT THIS
+ CONDUIT_DATABASE_PATH: /var/lib/matrix-conduit/
+ CONDUIT_DATABASE_BACKEND: rocksdb
+ CONDUIT_PORT: 6167
+ CONDUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
+ CONDUIT_ALLOW_REGISTRATION: 'true'
+ CONDUIT_ALLOW_FEDERATION: 'true'
CONDUIT_TRUSTED_SERVERS: '["matrix.org"]'
- CONDUIT_ALLOW_REGISTRATION : 'true'
- ### Uncomment and change values as desired
- # CONDUIT_ADDRESS: 0.0.0.0
- # CONDUIT_PORT: 6167
- # CONDUIT_CONFIG: '/srv/conduit/conduit.toml' # if you want to configure purely by env vars, set this to an empty string ''
- # Available levels are: error, warn, info, debug, trace - more info at: https://docs.rs/env_logger/*/env_logger/#enabling-logging
- # CONDUIT_LOG: info # default is: "info,_=off,sled=off"
- # CONDUIT_ALLOW_JAEGER: 'false'
- # CONDUIT_ALLOW_ENCRYPTION: 'false'
- # CONDUIT_ALLOW_FEDERATION: 'false'
- # CONDUIT_DATABASE_PATH: /srv/conduit/.local/share/conduit
- # CONDUIT_WORKERS: 10
- # CONDUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
+ #CONDUIT_MAX_CONCURRENT_REQUESTS: 100
+ #CONDUIT_LOG: info,rocket=off,_=off,sled=off
+ CONDUIT_ADDRESS: 0.0.0.0
+ CONDUIT_CONFIG: '' # Ignore this
# We need some way to server the client and server .well-known json. The simplest way is to use a nginx container
# to serve those two as static files. If you want to use a different way, delete or comment the below service, here
@@ -50,7 +44,6 @@ services:
volumes:
- ./nginx/matrix.conf:/etc/nginx/conf.d/matrix.conf # the config to serve the .well-known/matrix files
- ./nginx/www:/var/www/ # location of the client and server .well-known-files
-
### Uncomment if you want to use your own Element-Web App.
### Note: You need to provide a config.json for Element and you also need a second
### Domain or Subdomain for the communication between Element and Conduit