Skip to content
Snippets Groups Projects
Commit 2ee68f8e authored by Travis Ralston's avatar Travis Ralston
Browse files

Add a conduit server stack for development

parent 0d53ea34
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@
/config
/gdpr-data
/ipfs
/dev/conduit-db
# Generated files
assets.bin.go
......
......@@ -28,6 +28,18 @@ once to ensure the assets are set up correctly: follow the
[compilation steps](https://docs.t2bot.io/matrix-media-repo/installing/method/compilation.html)
posted on docs.t2bot.io.
If you'd like to use a regular Matrix client to test the media repo, `docker-compose -f dev/conduit-dev-docker-compose.yaml up`
will give you a [Conduit](https://conduit.rs/) homeserver behind an nginx reverse proxy which routes media requests to
`http://host.docker.internal:8001`. To test accurately, it is recommended to add the following homeserver configuration
to your media repo config:
```yaml
name: "localhost"
csApi: "http://localhost:8008" # This is exposed by the nginx container
```
Federated media requests should function normally with this setup, though the homeserver itself will be unable to federate.
For convenience, an element-web instance is also hosted at the same port from the root.
## Importing media from synapse
Media is imported by connecting to your synapse database and downloading all the content from the homeserver. This is so
......
# Note: this builds a minimal conduit image from the git repo. It has nothing to do with the media repo directly.
# This should not be used in production. It is adapted from the official version.
FROM alpine:3.12 as builder
RUN sed -i -e 's|v3\.12|edge|' /etc/apk/repositories
RUN apk add --no-cache cargo openssl-dev git
RUN git clone https://git.koesters.xyz/timo/conduit.git /conduit
WORKDIR /conduit
RUN cargo install --path .
# --- ---------------------- ---
FROM alpine:3.12
# Non-standard port
EXPOSE 8004
RUN mkdir -p /srv/conduit/.local/share/conduit
COPY --from=builder /root/.cargo/bin/conduit /srv/conduit/
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
RUN chown -cR www-data:www-data /srv/conduit
RUN apk add --no-cache ca-certificates libgcc
VOLUME ["/srv/conduit/.local/share/conduit"]
USER www-data
WORKDIR /src/conduit
ENTRYPOINT ["/srv/conduit/conduit"]
version: '2.0'
services:
conduit:
container_name: "media_repo_conduit"
build:
context: '.'
dockerfile: 'Conduit.Dockerfile'
restart: unless-stopped
volumes:
- ./conduit-db:/src/conduit/.local/share/conduit
environment:
ROCKET_SERVER_NAME: "localhost"
ROCKET_PORT: 8004
ROCKET_REGISTRATION_DISABLED: "false"
ROCKET_ENCRYPTION_DISABLED: "false"
ports:
- "8004:8004"
networks:
- proxy
nginx:
container_name: "media_repo_nginx"
image: "nginx:latest"
restart: unless-stopped
volumes:
- ./conduit.nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- "8008:80"
networks:
- proxy
element:
container_name: "media_repo_element"
image: "vectorim/riot-web:latest"
restart: unless-stopped
volumes:
- ./element-config.json:/app/config.json
ports:
- "8080:80"
networks:
- proxy
networks:
proxy:
server {
listen 80 default_server;
server_name _;
location /_matrix/media {
proxy_set_header Host localhost;
proxy_pass http://host.docker.internal:8001;
}
location /_matrix {
proxy_pass http://media_repo_conduit:8004;
}
location / {
proxy_pass http://media_repo_element:80;
}
}
\ No newline at end of file
{
"default_hs_url": "http://localhost:8008",
"brand": "Element",
"dangerously_allow_unsafe_and_insecure_passwords": true,
"enableLabs": true
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment