]> Git — Sourcephile - gargantext.git/blob - devops/upgrade/0.0.6.1.sh
[ADMIN] Upgrade script tested
[gargantext.git] / devops / upgrade / 0.0.6.1.sh
1 #!/bin/bash
2
3 # To be executed at the root of the project
4 # To upgrade from 0.0.5.9 to 0.0.6.2
5
6
7 sudo apt update
8 sudo apt -yy upgrade
9
10 sudo sed -i "s/buster/bullseye/g" /etc/apt/sources.list
11 sudo apt update
12 sudo apt -yy dist-upgrade
13
14 git pull origin dev
15 ./bin/install
16
17 # Database upgrade
18 echo "0.0.6.0 SQL upgrade"
19 ./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.0.sql
20
21 echo "Executing script haskell upgrade"
22 ~/.local/bin/gargantext-upgrade
23
24 echo "0.0.6.1 SQL upgrade"
25 ./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.1.sql
26
27 sudo -i -u postgres bash << EOF
28 pg_dumpall > /tmp/backup.dump
29 EOF
30
31 sudo sed -i "s/bullseye/bookworm/g" /etc/apt/sources.list
32 sudo apt update
33 sudo apt -yy dist-upgrade
34 sudo apt install -y postgresql-14 libpq-dev
35 sudo apt remove --purge postgresql-11 postgresql-13
36 sudo apt autoremove
37
38
39 sudo -i -u postgres bash << EOF
40 psql < /tmp/backup.dump
41 EOF
42
43 sed -i "s/DB_PORT = 5432/DB_PORT = 5434/" gargantext.ini
44
45 # be sure the DB password is the right one
46 DBPASS=$(grep "DB_PASS" gargantext.ini | sed "s/^.*= //")
47 echo $DBPASS
48
49 sudo -i -u postgres psql << EOF
50 ALTER ROLE gargantua password '${DBPASS}';
51 EOF
52
53 echo "0.0.6.2 SQL upgrade"
54 ./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.2.sql
55
56 # Make sure compilation is ok
57 ./bin/install
58
59 echo "Upgrade is over"
60
61
62
63