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