Add matrix-appservice-irc and fix installation

Allow memory write and execution (ctypes).
Add IRC gateway unit files and rename the units to be recognised by
portabled.
Fix installation of matrix-appservice-irc (don't ask).
This commit is contained in:
Vladan Popovic 2019-02-03 23:37:40 +01:00
parent 953c185693
commit 2b166baf7c
5 changed files with 49 additions and 25 deletions

View file

@ -3,20 +3,22 @@
ROOTFS=rootfs ROOTFS=rootfs
wget http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/x86_64/alpine-minirootfs-3.9.0-x86_64.tar.gz wget http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/x86_64/alpine-minirootfs-3.9.0-x86_64.tar.gz
mkdir -p $ROOTFS
mkdir -p $ROOTFS
tar xf alpine-minirootfs-3.9.0-x86_64.tar.gz -C $ROOTFS/ \ tar xf alpine-minirootfs-3.9.0-x86_64.tar.gz -C $ROOTFS/ \
./etc/apk ./etc/os-release ./usr ./lib ./bin ./sbin ./var ./etc/apk ./etc/os-release ./usr ./lib ./bin ./sbin ./var
mkdir -p $ROOTFS/etc/systemd/system \ mkdir -p $ROOTFS/etc/systemd/system \
$ROOTFS/var/{lib,run,tmp} \ $ROOTFS/var/{lib,run,tmp} \
$ROOTFS/{dev,tmp,proc,root,run,sys} \ $ROOTFS/{dev,tmp,proc,root,run,sys} \
$ROOTFS/{var/lib,var/log,etc}/synapse $ROOTFS/etc/matrix \
touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf $ROOTFS/var/lib/matrix-{synapse,appservice-irc}
cp install.sh $ROOTFS/root/ touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf
cp scripts/install.sh $ROOTFS/root/
sudo systemd-nspawn -D $ROOTFS/ /bin/sh /root/install.sh sudo systemd-nspawn -D $ROOTFS/ /bin/sh /root/install.sh
cp *.service $ROOTFS/etc/systemd/system/ cp systemd/* $ROOTFS/etc/systemd/system/
mksquashfs $ROOTFS/ synapse.raw mksquashfs $ROOTFS/ matrix.raw

View file

@ -9,15 +9,19 @@ apk --no-cache add --virtual .synapse-build \
libressl-dev \ libressl-dev \
libxslt-dev \ libxslt-dev \
linux-headers \ linux-headers \
npm \
python3-dev \ python3-dev \
yarn \
zlib-dev zlib-dev
pip3 install --upgrade pip setuptools pip3 install --upgrade pip setuptools
pip3 install https://github.com/matrix-org/synapse/tarball/master pip3 install https://github.com/matrix-org/synapse/tarball/master
pip3 install mautrix-telegram pip3 install mautrix-telegram
npm install matrix-appservice-irc --global IRC_DIR=/usr/lib/matrix-appservice-irc/
mkdir ${IRC_DIR}
cd ${IRC_DIR}
yarn add matrix-appservice-irc
ln -s ${IRC_DIR}/node_modules/matrix-appservice-irc/bin/matrix-appservice-irc /usr/local/bin/matrix-appservice-irc
apk del .synapse-build apk del .synapse-build
@ -31,7 +35,13 @@ apk --no-cache add \
find /usr -name "__pycache__" -exec rm -rf {} + find /usr -name "__pycache__" -exec rm -rf {} +
find /usr -name "*.pyc" -exec rm {} + find /usr -name "*.pyc" -exec rm {} +
rm -rf /root/.cache \ find /usr -name "*yarn*" -exec rm -rf {} +
find / -name "*node-gyp*" -exec rm -rf {} +
apk del alpine-keys
rm -rf /etc/apk \
/root/.cache \
/root/.config \ /root/.config \
/root/.npm \ /root/.npm \
/etc/apk /var/cache/*

View file

@ -1,15 +0,0 @@
[Unit]
Description=Synapse Matrix homeserver
After=network-online.target
Requires=network-online.target
[Service]
Environment=LANG=en_US.UTF-8
Environment=SYNAPSE_LOG_LEVEL=DEBUG
Environment=PYTHONDONTWRITEBYTECODE=1
ExecStart=/usr/bin/python3 -m synapse.app.homeserver -c /etc/synapse/homeserver.yaml
ExecStop=/usr/bin/synctl stop /etc/synapse/homeserver.yaml
StateDirectory=synapse
ConfigurationDirectory=synapse

View file

@ -0,0 +1,10 @@
[Unit]
Description=Matrix IRC gateway
After=matrix.service
Requires=matrix.service
[Service]
Type=exec
ExecStart=/usr/local/bin/matrix-appservice-irc -c /etc/matrix/irc-config.yaml -f /etc/matrix/irc-registration.yaml -p 7881
StateDirectory=matrix-appservice-irc
ConfigurationDirectory=matrix

View file

@ -0,0 +1,17 @@
[Unit]
Description=Synapse - Matrix homeserver
After=network-online.target
Requires=network-online.target
[Service]
MemoryDenyWriteExecute=no
Environment=LANG=en_US.UTF-8
Environment=SYNAPSE_LOG_LEVEL=DEBUG
Environment=PYTHONDONTWRITEBYTECODE=1
ExecStart=/usr/bin/python3 -m synapse.app.homeserver -c /etc/matrix/homeserver.yaml
ExecStop=/usr/bin/synctl stop /etc/matrix/homeserver.yaml
StateDirectory=matrix-synapse
ConfigurationDirectory=matrix