From b677b7a17c98e25d1bfb1c4cb3a0a713f1295521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= Date: Tue, 15 Jun 2021 10:10:19 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20des=20versions,=20de=20d=C3=A9pendences?= =?UTF-8?q?=20entre=20certaines=20t=C3=A2ches=20et=20automatisation=20de?= =?UTF-8?q?=20la=20modification=20de=20homeserver.yaml=20en=20fresh=20inst?= =?UTF-8?q?all?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- podman-matrix/05_freshinstall.sh | 31 +++++++++---------------------- podman-matrix/10_install.sh | 4 ++-- podman-matrix/README.md | 1 - podman-matrix/vars.sh | 4 ++-- 4 files changed, 13 insertions(+), 27 deletions(-) diff --git a/podman-matrix/05_freshinstall.sh b/podman-matrix/05_freshinstall.sh index c000a02..ac855b5 100755 --- a/podman-matrix/05_freshinstall.sh +++ b/podman-matrix/05_freshinstall.sh @@ -16,26 +16,13 @@ if [[ -d ~/.local/share/containers/storage/volumes/${dbvolume} ]]; then echo "Error : db volume ${dbvolume} already exists. Please remove it first (prune?)." exit 1 fi -podman volume create matrixdotorg_synapse-data -podman volume create matrixdotorg_synapse-pgsql - -podman run -it --name synapse-generate --mount type=volume,src=matrixdotorg_synapse-data,dst=/data -e SYNAPSE_SERVER_NAME=garbaye.fr -e SYNAPSE_REPORT_STATS=no matrixdotorg/synapse generate -podman rm synapse-generate - -# Modifier le fichier home/podman-matrix/.local/share/containers/storage/volumes/matrixdotorg_synapse-data/_data/homeserver.yaml avec les valeurs ci dessous -#< public_baseurl: https://qlf-matrix.garbaye.fr -# -#< enable_registration: false -# -#< database: -#< name: psycopg2 -#< args: -#< user: synapse -#< password: mysecretpass -#< database: synapse -#< host: synapse-db -#< port: 5432 -#< cp_min: 5 -#< cp_max: 10 -#${ABSDIR}/10_install.sh +podman volume create matrixdotorg_synapse-data && \ +podman volume create matrixdotorg_synapse-pgsql && \ +podman run -it --name ${container_name}-generate --mount type=volume,src=matrixdotorg_synapse-data,dst=/data -e SYNAPSE_SERVER_NAME=garbaye.fr -e SYNAPSE_REPORT_STATS=no ${synapse_image}:${synapse_version} generate && \ +podman rm ${container_name}-generate && \ +podman run -d --name ${container_name}-generate --mount type=volume,src=matrixdotorg_synapse-data,dst=/data ${synapse_image}:${synapse_version} && \ +podman exec -it ${container_name}-generate bash -c "sed -i -e 's|^#public_baseurl: https://example.com/$|public_baseurl: https://qlf-matrix.garbaye.fr|g' /data/homeserver.yaml && sed -z -i -e 's|database:\n name: sqlite3\n args:\n database: /data/homeserver.db|database:\n name: psycopg2\n args:\n user: synapse\n password: mysecretpass\n database: synapse\n host: synapse-db\n port: 5432\n cp_min: 5\n cp_max: 10|g' /data/homeserver.yaml && sed -i -e 's|^#enable_registration: false$|enable_registration: false|g' /data/homeserver.yaml" && \ +podman stop ${container_name}-generate && \ +podman rm ${container_name}-generate && \ +${ABSDIR}/10_install.sh diff --git a/podman-matrix/10_install.sh b/podman-matrix/10_install.sh index 2537e34..86b230c 100755 --- a/podman-matrix/10_install.sh +++ b/podman-matrix/10_install.sh @@ -23,9 +23,9 @@ podman run -d --name ${db_container_name} --pod ${pod_name} \ -e POSTGRES_USER=${container_name} \ -e POSTGRES_DB=${container_name} \ -e POSTGRES_INITDB_ARGS="--encoding=UTF8 --locale=C" \ - ${postgres_image} && \ + ${postgres_image}:${postgres_version} && \ podman run -d --name ${container_name} --pod ${pod_name} \ - --mount type=volume,src=${confvolume},dst=/data ${synapse_image} && \ + --mount type=volume,src=${confvolume},dst=/data ${synapse_image}:${synapse_version} && \ echo "Pod built and starting run 'podman logs -f synapse synapse-db' to show initialisation status then stop pod with 'podman pod stop ${pod_name}'" diff --git a/podman-matrix/README.md b/podman-matrix/README.md index 13b807e..2be5aac 100644 --- a/podman-matrix/README.md +++ b/podman-matrix/README.md @@ -22,7 +22,6 @@ podman exec -ti synapse register_new_matrix_user -c /data/homeserver.yaml http:/ ``` Reste à faire: -- Automatiser les corrections dans le homeserver.yaml - gérer les UID/GID et comptes utilisés dans les containers ? - Password policy ? - Fédération+redis l 2831 diff --git a/podman-matrix/vars.sh b/podman-matrix/vars.sh index 0db47a1..2eed521 100644 --- a/podman-matrix/vars.sh +++ b/podman-matrix/vars.sh @@ -5,9 +5,9 @@ service_name="pod-${pod_name}.service" #upstream_images="docker.io/matrixdotorg/synapse docker.io/library/postgres" #version='latest' synapse_image="docker.io/matrixdotorg/synapse" -synapse_version='latest' +synapse_version='v1.35.1' postgres_image="docker.io/library/postgres" -postgres_version='latest' +postgres_version='11.12' confvolume='matrixdotorg_synapse-data' dbvolume='matrixdotorg_synapse-pgsql' container_name='synapse'