every pipe service own data - db lock errors

This commit is contained in:
olli 2024-10-27 23:19:43 +01:00
parent 584d9f9456
commit 0fe5a3bae2

View File

@ -554,21 +554,40 @@
block: |
cd /home/docker/matrix.$(hostname)
echo "services:" >docker-compose.override.yml.new
for room in $(docker compose run -T matrix.$(hostname)--commander --joined-rooms --output text)
# go through existing rooms (ids) of matrix-commander user
for roomid in $(docker run -t -v ./matrix-commander-data:/data:rw matrixcommander/matrix-commander --joined-rooms --output text)
do
room=$(docker compose run -T matrix.$(hostname)--commander --get-room-info "\\$room" --log-level ERROR ERROR | cut -d\# -f2 | cut -d: -f1)
echo "Room: $room"
echo "== Room ID $roomid"
# get room name
room=$(docker run -t -v ./matrix-commander-data:/data:rw matrixcommander/matrix-commander:7.5 --get-room-info "\\$roomid" --log-level ERROR ERROR | cut -d\# -f2 | cut -d: -f1)
if [ -z "$room" ]
then
echo "ERROR: Got no roomname for \"$roomid\""
continue
fi
echo "== Room: $room"
# define/create pipe
pipe="/usr/local/share/matrix-room-${room}.fifo"
pipebasename="matrix-room-${room}.fifo"
[ -e "$pipe" ] || mkfifo "$pipe"
chown root:matrix "$pipe"
chmod 660 "$pipe"
# roomname for scripts
roomnospace=${room// /_}
# container config for room-pipe
echo " matrix.room-pipe-${roomnospace}:
image: matrixcommander/matrix-commander
volumes:
- /etc/localtime:/etc/localtime:ro
- ./matrix-commander-data:/data:rw
- ./matrix-commander-data-${roomnospace}:/data:rw
- ${pipe}:/${pipebasename}
entrypoint: /bin/bash -c 'cd /data && tail -F \"/${pipebasename}\" | /app/matrix_commander/matrix-commander -m _ --html --room \"$room\" --log-level INFO INFO'
restart: unless-stopped
@ -576,10 +595,25 @@
matrix.$(hostname)--synapse:
condition: service_healthy
" >> docker-compose.override.yml.new
# Auth commander instance if not exists
declare -a newrooms
[ -s "matrix-commander-data-${roomnospace}/credentials.json" ] || newrooms+=("$roomnospace")
done
mv docker-compose.override.yml.new docker-compose.override.yml
docker compose up -d
for newroom in "${newrooms[@]}"
do
echo "== Auth new root/matrix-commander instance ${newroom}"
. ./env.user
docker run -t -v ./matrix-commander-data-${newroom}:/data:rw matrixcommander/matrix-commander --login password --homeserver matrix.$(hostname) --user-login $MATRIX_SRV_USER --password $MATRIX_SRV_USER_PASSWORD --device $(hostname) --room-default $(hostname)
docker compose down matrix.room-pipe-${newroom}
docker compose up -d matrix.room-pipe-${newroom}
done
docker compose up -d --remove-orphans
backup: yes
validate: /bin/bash -n %s
# notify: run matrix.init