every pipe service own data - db lock errors
This commit is contained in:
parent
584d9f9456
commit
0fe5a3bae2
44
matrix.yml
44
matrix.yml
@ -554,21 +554,40 @@
|
|||||||
block: |
|
block: |
|
||||||
cd /home/docker/matrix.$(hostname)
|
cd /home/docker/matrix.$(hostname)
|
||||||
echo "services:" >docker-compose.override.yml.new
|
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
|
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"
|
pipe="/usr/local/share/matrix-room-${room}.fifo"
|
||||||
pipebasename="matrix-room-${room}.fifo"
|
pipebasename="matrix-room-${room}.fifo"
|
||||||
[ -e "$pipe" ] || mkfifo "$pipe"
|
[ -e "$pipe" ] || mkfifo "$pipe"
|
||||||
chown root:matrix "$pipe"
|
chown root:matrix "$pipe"
|
||||||
chmod 660 "$pipe"
|
chmod 660 "$pipe"
|
||||||
|
|
||||||
|
# roomname for scripts
|
||||||
roomnospace=${room// /_}
|
roomnospace=${room// /_}
|
||||||
|
|
||||||
|
# container config for room-pipe
|
||||||
echo " matrix.room-pipe-${roomnospace}:
|
echo " matrix.room-pipe-${roomnospace}:
|
||||||
image: matrixcommander/matrix-commander
|
image: matrixcommander/matrix-commander
|
||||||
volumes:
|
volumes:
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
- ./matrix-commander-data:/data:rw
|
- ./matrix-commander-data-${roomnospace}:/data:rw
|
||||||
- ${pipe}:/${pipebasename}
|
- ${pipe}:/${pipebasename}
|
||||||
entrypoint: /bin/bash -c 'cd /data && tail -F \"/${pipebasename}\" | /app/matrix_commander/matrix-commander -m _ --html --room \"$room\" --log-level INFO INFO'
|
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
|
restart: unless-stopped
|
||||||
@ -576,10 +595,25 @@
|
|||||||
matrix.$(hostname)--synapse:
|
matrix.$(hostname)--synapse:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
" >> docker-compose.override.yml.new
|
" >> docker-compose.override.yml.new
|
||||||
|
|
||||||
|
# Auth commander instance if not exists
|
||||||
|
declare -a newrooms
|
||||||
|
[ -s "matrix-commander-data-${roomnospace}/credentials.json" ] || newrooms+=("$roomnospace")
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
mv docker-compose.override.yml.new docker-compose.override.yml
|
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
|
backup: yes
|
||||||
validate: /bin/bash -n %s
|
validate: /bin/bash -n %s
|
||||||
# notify: run matrix.init
|
# notify: run matrix.init
|
||||||
|
Loading…
Reference in New Issue
Block a user