Ajout des versions, de dépendences entre certaines tâches et automatisation de la modification de homeserver.yaml en fresh install

This commit is contained in:
Loïc 2021-06-15 10:10:19 +02:00
parent e73143e360
commit b677b7a17c
4 changed files with 13 additions and 27 deletions

View file

@ -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

View file

@ -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}'"

View file

@ -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

View file

@ -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'