Matrix synapse service alpine linux rootfs

This commit is contained in:
Vladan Popovic 2019-02-03 17:25:21 +01:00
parent 2b9e803d14
commit 953c185693
3 changed files with 74 additions and 0 deletions

22
alpine-matrix/build.sh Normal file
View file

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

37
alpine-matrix/install.sh Normal file
View file

@ -0,0 +1,37 @@
#!/bin/sh
apk --no-cache add --virtual .synapse-build \
build-base \
git \
libevent-dev \
libffi-dev \
libjpeg-turbo-dev \
libressl-dev \
libxslt-dev \
linux-headers \
npm \
python3-dev \
zlib-dev
pip3 install --upgrade pip setuptools
pip3 install https://github.com/matrix-org/synapse/tarball/master
pip3 install mautrix-telegram
npm install matrix-appservice-irc --global
apk del .synapse-build
# Runtime packages.
apk --no-cache add \
libjpeg-turbo \
libmagic \
libressl2.7-libssl \
nodejs \
python3
find /usr -name "__pycache__" -exec rm -rf {} +
find /usr -name "*.pyc" -exec rm {} +
rm -rf /root/.cache \
/root/.config \
/root/.npm \
/etc/apk

View file

@ -0,0 +1,15 @@
[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