Rework the build and include coturn and riot web
This commit is contained in:
parent
d56dbacde6
commit
d9214e47b5
11 changed files with 84 additions and 42 deletions
|
@ -6,8 +6,8 @@ set -e
|
||||||
IMAGE=/tmp/$NAME.raw
|
IMAGE=/tmp/$NAME.raw
|
||||||
|
|
||||||
[ -z $ROOTFS ] && ROOTFS=$(mktemp -d $NAME.XXX -t)
|
[ -z $ROOTFS ] && ROOTFS=$(mktemp -d $NAME.XXX -t)
|
||||||
[ -z $ALPINE_VERSION ] && ALPINE_VERSION=3.12
|
[ -z $ALPINE_VERSION ] && ALPINE_VERSION=3.13
|
||||||
[ -z $ALPINE_RELEASE ] && ALPINE_RELEASE=0
|
[ -z $ALPINE_RELEASE ] && ALPINE_RELEASE=1
|
||||||
|
|
||||||
ALPINE_TARBALL=alpine-minirootfs-$ALPINE_VERSION.$ALPINE_RELEASE-x86_64.tar.gz
|
ALPINE_TARBALL=alpine-minirootfs-$ALPINE_VERSION.$ALPINE_RELEASE-x86_64.tar.gz
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ ALPINE_TARBALL=alpine-minirootfs-$ALPINE_VERSION.$ALPINE_RELEASE-x86_64.tar.gz
|
||||||
|
|
||||||
mkdir -p $ROOTFS
|
mkdir -p $ROOTFS
|
||||||
tar xf $ALPINE_TARBALL -C $ROOTFS/ \
|
tar xf $ALPINE_TARBALL -C $ROOTFS/ \
|
||||||
./etc/apk ./usr ./lib ./bin ./sbin ./var
|
./etc ./usr ./lib ./bin ./sbin ./var
|
||||||
|
|
||||||
chmod 755 $ROOTFS
|
chmod 755 $ROOTFS
|
||||||
|
|
||||||
|
@ -24,20 +24,20 @@ mkdir -p \
|
||||||
$ROOTFS/etc/systemd/system \
|
$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/etc/matrix \
|
$ROOTFS/etc/$NAME \
|
||||||
$ROOTFS/var/lib/matrix-synapse \
|
$ROOTFS/var/lib/$NAME \
|
||||||
$ROOTFS/run/systemd/unit-root/var/tmp
|
$ROOTFS/run/systemd/unit-root/var/tmp
|
||||||
|
|
||||||
touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf
|
touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf
|
||||||
cp systemd/matrix.service $ROOTFS/etc/systemd/system/$NAME.service
|
cp -a systemd/${NAME}* $ROOTFS/etc/systemd/system/
|
||||||
cp conf/os-release $ROOTFS/etc/os-release
|
cp conf/os-release $ROOTFS/etc/os-release
|
||||||
|
|
||||||
sudo systemd-nspawn --directory $ROOTFS/ \
|
sudo systemd-nspawn --directory $ROOTFS/ \
|
||||||
--bind $HOME/dev/python/pyopenssl:/tmp/pyopenssl \
|
--bind=$PWD/scripts/install-$NAME.sh:/root/install.sh \
|
||||||
--bind=$PWD/scripts/install.sh:/root/install.sh \
|
|
||||||
/bin/sh /root/install.sh
|
/bin/sh /root/install.sh
|
||||||
|
|
||||||
mksquashfs $ROOTFS/ $IMAGE -all-root -noappend
|
sudo mksquashfs $ROOTFS/ $IMAGE -all-root -noappend
|
||||||
|
sudo systemctl stop $IMAGE || true
|
||||||
sudo portablectl detach $IMAGE || true
|
sudo portablectl detach $IMAGE || true
|
||||||
sudo portablectl attach $IMAGE
|
sudo portablectl attach $IMAGE
|
||||||
sudo systemctl restart $NAME.service
|
sudo systemctl restart $NAME.service
|
||||||
|
|
13
alpine/matrix/scripts/install-matrix.sh
Normal file
13
alpine/matrix/scripts/install-matrix.sh
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
apk --no-cache add --no-scripts --no-commit-hooks synapse
|
||||||
|
|
||||||
|
find /usr -name "__pycache__" -exec rm -rf {} +
|
||||||
|
find /usr -name "*.pyc" -exec rm {} +
|
||||||
|
|
||||||
|
apk del alpine-keys
|
||||||
|
|
||||||
|
rm -rf /etc/apk \
|
||||||
|
/root/.cache \
|
||||||
|
/root/.config \
|
||||||
|
/var/cache/*
|
|
@ -13,21 +13,20 @@ apk --no-cache add --virtual .synapse-build \
|
||||||
py3-pip \
|
py3-pip \
|
||||||
zlib-dev
|
zlib-dev
|
||||||
|
|
||||||
pip3 install --upgrade pip setuptools
|
pip3 install --upgrade --force pip setuptools
|
||||||
pip3 install https://github.com/matrix-org/synapse/tarball/master
|
pip3 install https://github.com/matrix-org/synapse/tarball/master
|
||||||
|
|
||||||
apk del .synapse-build
|
apk del .synapse-build
|
||||||
|
|
||||||
# Runtime packages.
|
# Runtime packages
|
||||||
apk --no-cache add \
|
apk --no-cache add \
|
||||||
libjpeg-turbo \
|
libjpeg-turbo \
|
||||||
libmagic \
|
libmagic \
|
||||||
libressl2.7-libssl \
|
libressl \
|
||||||
python3
|
python3
|
||||||
|
|
||||||
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 {} +
|
||||||
find /usr -name "*yarn*" -exec rm -rf {} +
|
|
||||||
|
|
||||||
apk del alpine-keys
|
apk del alpine-keys
|
||||||
|
|
||||||
|
|
10
alpine/matrix/scripts/install-riot.sh
Normal file
10
alpine/matrix/scripts/install-riot.sh
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
apk --no-cache add --no-scripts --no-commit-hooks riot-web nginx
|
||||||
|
|
||||||
|
apk del alpine-keys
|
||||||
|
|
||||||
|
rm -rf /etc/apk \
|
||||||
|
/root/.cache \
|
||||||
|
/root/.config \
|
||||||
|
/var/cache/*
|
15
alpine/matrix/scripts/install-turn.sh
Normal file
15
alpine/matrix/scripts/install-turn.sh
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
apk add --no-cache --purge -uU \
|
||||||
|
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
|
||||||
|
coturn sqlite-libs
|
||||||
|
|
||||||
|
find /usr -name "__pycache__" -exec rm -rf {} +
|
||||||
|
find /usr -name "*.pyc" -exec rm {} +
|
||||||
|
|
||||||
|
apk del alpine-keys
|
||||||
|
|
||||||
|
rm -rf /etc/apk \
|
||||||
|
/root/.cache \
|
||||||
|
/root/.config \
|
||||||
|
/var/cache/*
|
|
@ -1,16 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
apk --no-cache add --no-scripts --no-commit-hooks --initramfs-diskless-boot synapse
|
|
||||||
|
|
||||||
find /usr -name "__pycache__" -exec rm -rf {} +
|
|
||||||
find /usr -name "*.pyc" -exec rm {} +
|
|
||||||
|
|
||||||
apk del alpine-keys alpine-baselayout
|
|
||||||
|
|
||||||
rm -rf /etc/apk \
|
|
||||||
/etc/ssl \
|
|
||||||
/etc/terminfo \
|
|
||||||
/etc/synapse \
|
|
||||||
/root/.cache \
|
|
||||||
/root/.config \
|
|
||||||
/var/cache/*
|
|
2
alpine/matrix/systemd/30-synapse-override.conf
Normal file
2
alpine/matrix/systemd/30-synapse-override.conf
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[Service]
|
||||||
|
MemoryDenyWriteExecute=no
|
|
@ -1,10 +0,0 @@
|
||||||
[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
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Synapse - Matrix homeserver
|
Description=Synapse - Matrix homeserver
|
||||||
After=network-online.target
|
|
||||||
Requires=network-online.target
|
Requires=network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
@ -10,7 +9,8 @@ Environment=PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|
||||||
ExecStart=/usr/bin/synctl start /etc/matrix/homeserver.yaml --no-daemonize
|
ExecStart=/usr/bin/synctl start /etc/matrix/homeserver.yaml --no-daemonize
|
||||||
ExecStop=/usr/bin/synctl stop /etc/matrix/homeserver.yaml
|
ExecStop=/usr/bin/synctl stop /etc/matrix/homeserver.yaml
|
||||||
|
ExecReload=/opt/synapse/bin/synctl restart /etc/matrix/homeserver.yaml
|
||||||
|
|
||||||
StateDirectory=matrix-synapse
|
StateDirectory=matrix
|
||||||
ConfigurationDirectory=matrix
|
|
||||||
RuntimeDirectory=matrix
|
RuntimeDirectory=matrix
|
||||||
|
ConfigurationDirectory=matrix
|
||||||
|
|
16
alpine/matrix/systemd/riot.service
Normal file
16
alpine/matrix/systemd/riot.service
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Synapse - Matrix homeserver
|
||||||
|
Requires=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment=LANG=en_US.UTF-8
|
||||||
|
Environment=SYNAPSE_LOG_LEVEL=DEBUG
|
||||||
|
Environment=PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|
||||||
|
ExecStart=/usr/bin/synctl start /etc/matrix/homeserver.yaml --no-daemonize
|
||||||
|
ExecStop=/usr/bin/synctl stop /etc/matrix/homeserver.yaml
|
||||||
|
ExecReload=/opt/synapse/bin/synctl restart /etc/matrix/homeserver.yaml
|
||||||
|
|
||||||
|
StateDirectory=matrix
|
||||||
|
RuntimeDirectory=matrix
|
||||||
|
ConfigurationDirectory=matrix
|
13
alpine/matrix/systemd/turn.service
Normal file
13
alpine/matrix/systemd/turn.service
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Coturn - TURN/STUN server
|
||||||
|
Requires=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment=LANG=en_US.UTF-8
|
||||||
|
|
||||||
|
ExecStart=/usr/bin/turnserver -c /etc/coturn/turnserver.conf
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
StateDirectory=turn
|
||||||
|
RuntimeDirectory=turn
|
||||||
|
ConfigurationDirectory=turn
|
Loading…
Reference in a new issue