Commit 326e5840 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[ADMIN] Upgrade script tested

parent bf7784ae
Pipeline #3167 passed with stage
in 92 minutes
......@@ -3,7 +3,7 @@
* [BACK][FIX] Confluence on Graph
* [BACK][FIX] HAL parser fix
* [BACK][UPGRADE] ./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.2.sql
* [BACK][ADMIN] upgrade script (WIP)
* [BACK][ADMIN] upgrade script, test ok
## Version 0.0.6.1
* [BACK][FEAT] Spacy Server connection for French (and others) languages
......
#!/bin/bash
# To be executed at the root of the project
# To upgrade from 0.0.5.9 to 0.0.6.2
# backup
sudo apt update
sudo apt -yy upgrade
......@@ -15,11 +15,14 @@ git pull origin dev
./bin/install
# Database upgrade
#./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.0.sql
# exec script haskell upgrade
echo "0.0.6.0 SQL upgrade"
./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.0.sql
#./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.1.sql
# ~/.local/bin/gargantext-upgrade
echo "Executing script haskell upgrade"
~/.local/bin/gargantext-upgrade
echo "0.0.6.1 SQL upgrade"
./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.1.sql
sudo -i -u postgres bash << EOF
pg_dumpall > /tmp/backup.dump
......@@ -29,23 +32,31 @@ sudo sed -i "s/bullseye/bookworm/g" /etc/apt/sources.list
sudo apt update
sudo apt -yy dist-upgrade
sudo apt install -y postgresql-14 libpq-dev
sudo apt remove --purge postgresql-11 postgresql-13
sudo apt autoremove
sudo -i -u postgres bash << EOF
psql < /tmp/backup.dump
EOF
sed -i "s/DB_PORT = 5432/DB_PORT = 5433/" gargantext.ini
DBPASS=$(grep "DB_PASS" gargantext.ini | sed "s/^.*= //")
sed -i "s/DB_PORT = 5432/DB_PORT = 5434/" gargantext.ini
# be sure the DB password is the right one
DBPASS=$(grep "DB_PASS" gargantext.ini | sed "s/^.*= //")
echo $DBPASS
sudo -i -u postgres bash << EOF
psql < 'ALTER ROLE gargantua password \'$DBPASS\'';
sudo -i -u postgres psql << EOF
ALTER ROLE gargantua password '${DBPASS}';
EOF
echo "0.0.6.2 SQL upgrade"
./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.2.sql
# Make sure compilation is ok
./bin/install
echo "Upgrade is over"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment