Init
This commit is contained in:
commit
6a8b9708fd
9 changed files with 320 additions and 0 deletions
42
update/postgres/upgrade_postgres_version.sh
Normal file
42
update/postgres/upgrade_postgres_version.sh
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Create docker-volume if not exists
|
||||
#docker run -d \
|
||||
# --name postgres \
|
||||
# -e POSTGRES_USER=matrix \
|
||||
# -e POSTGRES_PASSWORD="9uZoFV%cJi&EAZCV*dm7gSSyLs5XS@F8" \
|
||||
# -e POSTGRES_DB=matrix_synapse \
|
||||
# -e LC_COLLATE='C' \
|
||||
# -e LC_CTYPE='C' \
|
||||
# -e POSTGRES_INITDB_ARGS="--encoding=UTF-8" \
|
||||
# -v /mnt/Docker/Synapse/postgres:/var/lib/postgresql/data \
|
||||
# --restart=unless-stopped postgres:alpine
|
||||
|
||||
echo "Sichere PostgresSQL..."
|
||||
docker exec postgres sh -c "pg_dumpall -U matrix > /var/lib/postgresql/data/dump.sql"
|
||||
mv /mnt/Docker/Synapse/postgres/dump.sql /mnt/Docker/Synapse/dump.sql
|
||||
|
||||
echo "Erledigt!"
|
||||
echo "Stoppe Docker-Container"
|
||||
docker stop postgres
|
||||
|
||||
echo "Lösche Postgres-Volume..."
|
||||
rm -r /mnt/Docker/Synapse/postgres/*
|
||||
echo "Erledigt!"
|
||||
|
||||
echo "Jetzt aktualisiere das PostgresSQL-Image auf eine neue Version!"
|
||||
echo "Bestätige mit OK wenn der Container läuft..."
|
||||
|
||||
read -p "Warte auf Eingabe" readline
|
||||
|
||||
if [ "$readline" = "OK" ]; then
|
||||
echo "Restore PostgresSQL aus Backup in neue Version...!"
|
||||
cp /mnt/Docker/Synapse/dump.sql /mnt/Docker/Synapse/postgres/dump.sql
|
||||
docker exec postgres sh -c "psql -U matrix -d matrix_synapse < /var/lib/postgresql/data/dump.sql"
|
||||
docker restart postgres
|
||||
else
|
||||
echo "Abbruch"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Finish!"
|
||||
Loading…
Add table
Add a link
Reference in a new issue