7 changed files with 176 additions and 0 deletions
@ -0,0 +1,23 @@ |
|||||||
|
#!/bin/sh |
||||||
|
set -e |
||||||
|
|
||||||
|
# Source debconf library. |
||||||
|
. /usr/share/debconf/confmodule |
||||||
|
|
||||||
|
CONDUIT_CONFIG_PATH=/etc/matrix-conduit |
||||||
|
CONDUIT_CONFIG_FILE="$CONDUIT_CONFIG_PATH/env" |
||||||
|
|
||||||
|
# Ask for the Matrix homeserver name and port. |
||||||
|
db_input high matrix-conduit/hostname || true |
||||||
|
db_go |
||||||
|
|
||||||
|
db_input medium matrix-conduit/port || true |
||||||
|
db_go |
||||||
|
|
||||||
|
# Update the values in the config. |
||||||
|
db_get matrix-conduit/hostname |
||||||
|
sed -i -e "s/^ROCKET_SERVER_NAME=.*/ROCKET_SERVER_NAME=\"$RET\"/" $CONDUIT_CONFIG_FILE |
||||||
|
db_get matrix-conduit/port |
||||||
|
sed -i -e "s/^ROCKET_PORT=.*/ROCKET_PORT=\"$RET\"/" $CONDUIT_CONFIG_FILE |
||||||
|
|
||||||
|
exit 0 |
||||||
@ -0,0 +1,48 @@ |
|||||||
|
# Conduit homeserver configuration |
||||||
|
# |
||||||
|
# Conduit is an application based on the Rocket web framework. |
||||||
|
# Configuration of Conduit can happen either via a `Rocket.toml` file that |
||||||
|
# is placed in /var/lib/matrix-conduit or via setting the environment |
||||||
|
# variables below. |
||||||
|
|
||||||
|
# The server (host)name of the Matrix homeserver. |
||||||
|
# |
||||||
|
# This is the hostname the homeserver will be reachable at via a client. |
||||||
|
ROCKET_SERVER_NAME="YOURSERVERNAME.HERE" |
||||||
|
|
||||||
|
# The address the Matrix homeserver listens on. |
||||||
|
# |
||||||
|
# By default the server listens on 0.0.0.0. Change this for example to |
||||||
|
# 127.0.0.1 to only listen on the localhost when using a reverse proxy. |
||||||
|
#ROCKET_ADDRESS="0.0.0.0" |
||||||
|
|
||||||
|
# The port of the Matrix homeserver. |
||||||
|
# |
||||||
|
# This port is often accessed by a reverse proxy. |
||||||
|
ROCKET_PORT="14004" |
||||||
|
|
||||||
|
# The maximum size of a Matrix HTTP requests in bytes. |
||||||
|
# |
||||||
|
# This mostly affects the size of files that can be downloaded/uploaded. |
||||||
|
ROCKET_MAX_REQUEST_SIZE=20000000 |
||||||
|
|
||||||
|
# Whether user registration is allowed. |
||||||
|
# |
||||||
|
# User registration is allowed by default. |
||||||
|
#ROCKET_REGISTRATION_DISABLED=true |
||||||
|
|
||||||
|
# Whether encryption is enabled. |
||||||
|
# |
||||||
|
# (End-to-end) encryption is enabled by default. |
||||||
|
#ROCKET_ENCRYPTION_DISABLED=true |
||||||
|
|
||||||
|
# Whether federation with other Matrix servers is enabled. |
||||||
|
# |
||||||
|
# Federation is disabled by default; it is still experimental. |
||||||
|
#ROCKET_FEDERATION_ENABLED=true |
||||||
|
|
||||||
|
# The log level of the homeserver. |
||||||
|
# |
||||||
|
# The log level is "critical" by default. |
||||||
|
# Allowed values are: "off", "normal", "debug", "critical" |
||||||
|
#ROCKET_LOG="normal" |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
[Unit] |
||||||
|
Description=Conduit Matrix homeserver |
||||||
|
After=network.target |
||||||
|
|
||||||
|
[Service] |
||||||
|
User=_matrix-conduit |
||||||
|
Group=_matrix-conduit |
||||||
|
Type=simple |
||||||
|
|
||||||
|
Environment="ROCKET_ENV=production" |
||||||
|
Environment="ROCKET_DATABASE_PATH=/var/lib/matrix-conduit" |
||||||
|
EnvironmentFile=/etc/matrix-conduit/env |
||||||
|
|
||||||
|
ExecStart=/usr/sbin/matrix-conduit |
||||||
|
Restart=on-failure |
||||||
|
RestartSec=10 |
||||||
|
StartLimitInterval=1m |
||||||
|
StartLimitBurst=5 |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=multi-user.target |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
#!/bin/sh |
||||||
|
set -e |
||||||
|
|
||||||
|
CONDUIT_DATABASE_PATH=/var/lib/matrix-conduit |
||||||
|
|
||||||
|
case "$1" in |
||||||
|
configure) |
||||||
|
# Create the `_matrix-conduit` user if it does not exist yet. |
||||||
|
if ! getent passwd _matrix-conduit > /dev/null ; then |
||||||
|
echo 'Adding system user for the Conduit Matrix homeserver' 1>&2 |
||||||
|
adduser --system --group --quiet \ |
||||||
|
--home $CONDUIT_DATABASE_PATH \ |
||||||
|
--disabled-login \ |
||||||
|
--force-badname \ |
||||||
|
_matrix-conduit |
||||||
|
fi |
||||||
|
|
||||||
|
# Create the database path if it does not exist yet. |
||||||
|
if [ ! -d "$CONDUIT_DATABASE_PATH" ]; then |
||||||
|
mkdir -p "$CONDUIT_DATABASE_PATH" |
||||||
|
chown _matrix-conduit "$CONDUIT_DATABASE_PATH" |
||||||
|
fi |
||||||
|
;; |
||||||
|
esac |
||||||
|
|
||||||
|
#DEBHELPER# |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
#!/bin/sh |
||||||
|
set -e |
||||||
|
|
||||||
|
CONDUIT_CONFIG_PATH=/etc/matrix-conduit |
||||||
|
CONDUIT_DATABASE_PATH=/var/lib/matrix-conduit |
||||||
|
|
||||||
|
case $1 in |
||||||
|
purge) |
||||||
|
# Per https://www.debian.org/doc/debian-policy/ch-files.html#behavior |
||||||
|
# "configuration files must be preserved when the package is removed, and |
||||||
|
# only deleted when the package is purged." |
||||||
|
if [ -d "$CONDUIT_CONFIG_PATH" ]; then |
||||||
|
rm -r "$CONDUIT_CONFIG_PATH" |
||||||
|
fi |
||||||
|
|
||||||
|
if [ -d "$CONDUIT_DATABASE_PATH" ]; then |
||||||
|
rm -r "$CONDUIT_DATABASE_PATH" |
||||||
|
fi |
||||||
|
;; |
||||||
|
esac |
||||||
|
|
||||||
|
#DEBHELPER# |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
Template: matrix-conduit/hostname |
||||||
|
Type: string |
||||||
|
Default: localhost |
||||||
|
Description: The server (host)name of the Matrix homeserver. |
||||||
|
This is the hostname the homeserver will be reachable at via a client. |
||||||
|
. |
||||||
|
If set to "localhost", you can connect with a client locally and clients |
||||||
|
from other hosts and also other servers will not be able to reach you! |
||||||
|
|
||||||
|
Template: matrix-conduit/port |
||||||
|
Type: string |
||||||
|
Default: 14004 |
||||||
|
Description: The port of the Matrix homeserver |
||||||
|
This port is often accessed by a reverse proxy. |
||||||
Loading…
Reference in new issue