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 @@ ...@@ -3,7 +3,7 @@
* [BACK][FIX] Confluence on Graph * [BACK][FIX] Confluence on Graph
* [BACK][FIX] HAL parser fix * [BACK][FIX] HAL parser fix
* [BACK][UPGRADE] ./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.2.sql * [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 ## Version 0.0.6.1
* [BACK][FEAT] Spacy Server connection for French (and others) languages * [BACK][FEAT] Spacy Server connection for French (and others) languages
......
#!/bin/bash #!/bin/bash
# To be executed at the root of the project # 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 update
sudo apt -yy upgrade sudo apt -yy upgrade
...@@ -15,11 +15,14 @@ git pull origin dev ...@@ -15,11 +15,14 @@ git pull origin dev
./bin/install ./bin/install
# Database upgrade # Database upgrade
#./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.0.sql echo "0.0.6.0 SQL upgrade"
# exec script haskell 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 echo "Executing script haskell upgrade"
# ~/.local/bin/gargantext-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 sudo -i -u postgres bash << EOF
pg_dumpall > /tmp/backup.dump pg_dumpall > /tmp/backup.dump
...@@ -29,23 +32,31 @@ sudo sed -i "s/bullseye/bookworm/g" /etc/apt/sources.list ...@@ -29,23 +32,31 @@ sudo sed -i "s/bullseye/bookworm/g" /etc/apt/sources.list
sudo apt update sudo apt update
sudo apt -yy dist-upgrade sudo apt -yy dist-upgrade
sudo apt install -y postgresql-14 libpq-dev 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 sudo -i -u postgres bash << EOF
psql < /tmp/backup.dump psql < /tmp/backup.dump
EOF EOF
sed -i "s/DB_PORT = 5432/DB_PORT = 5433/" gargantext.ini sed -i "s/DB_PORT = 5432/DB_PORT = 5434/" gargantext.ini
DBPASS=$(grep "DB_PASS" gargantext.ini | sed "s/^.*= //")
# 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 sudo -i -u postgres psql << EOF
psql < 'ALTER ROLE gargantua password \'$DBPASS\''; ALTER ROLE gargantua password '${DBPASS}';
EOF EOF
echo "0.0.6.2 SQL upgrade"
./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.2.sql ./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