Commit 6b5cac2c authored by Alexandre Delanoë's avatar Alexandre Delanoë

[ADMIN] Upgrade scripts

parent b98ddbfc
Pipeline #3162 passed with stage
in 92 minutes and 4 seconds
......@@ -2,19 +2,21 @@
* [BACK][FIX] Ngrams List saved in database on halting
* [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)
## Version 0.0.6.1
* [FEAT] Spacy Server connection for French (and others) languages
* [FEAT] At startup, check if gargantext.init script has been activated
* [UPGRADE] Use the devops/postgres/upgrade/0.0.6.1.sql uprade script
* [FIX] PubMed Parser with threadDelay
* [BACK][FEAT] Spacy Server connection for French (and others) languages
* [BACK][FEAT] At startup, check if gargantext.init script has been activated
* [BACK][UPGRADE] Use the devops/postgres/upgrade/0.0.6.1.sql upgrade script
* [BACK][FIX] PubMed Parser with threadDelay
* [BACK][FIX] Hash to remove duplicates on filtered text
## Version 0.0.6
* [OPTIM] Ngrams Table optmization. To upgrade:
1. `./bin/psql gargantext.ini < devops/postgresql/upgrade/0.0.6.sql`
2. in `stack --nix repl` run `runCmdReplEasy $ migrateFromDirToDb`
* [FIX] Ngrams Table next button: loads only one time instead of twice previously
* [BACK][OPTIM] Ngrams Table optmization. To upgrade:
1. `./bin/psql gargantext.ini < devops/postgresql/upgrade/0.0.6.sql`
2. in `stack --nix repl` run `runCmdReplEasy $ migrateFromDirToDb`
* [FRONT][FIX] Ngrams Table next button: loads only one time instead of twice previously
* [FRONT][FIX] Resize handler on Write Node
* [FRONT][FIX] Do not highlight ngrams if maximum abstract length > 4500 characters
......
......@@ -24,6 +24,7 @@ import Gargantext.API.Admin.EnvTypes (DevEnv)
import Gargantext.API.Dev (withDevEnv, runCmdDev)
import Gargantext.API.Node () -- instances only
import Gargantext.API.Prelude (GargError)
import Gargantext.API.Ngrams.Tools (migrateFromDirToDb)
import Gargantext.Core (HasDBid(toDBid))
import Gargantext.Core.Types.Individu (User(..))
import Gargantext.Database.Action.Flow (getOrMk_RootWithCorpus)
......@@ -42,10 +43,13 @@ import qualified Data.List as List (cycle, concat, take, unlines)
main :: IO ()
main = do
let ___ = putStrLn $ List.concat $ List.take 72 $ List.cycle ["_"]
let ___ = putStrLn
$ List.concat
$ List.take 72
$ List.cycle ["_"]
___
putStrLn "GarganText upgrade to version 0.0.5"
putStrLn "GarganText upgrade to version 0.0.6"
___
params@[iniPath] <- getArgs
......@@ -57,9 +61,6 @@ main = do
[ "Your Database defined in gargantext.ini will be upgraded."
, "We stronlgy recommend you to make a backup using pg_dump."
, ""
, "If you encounter issues, please report your bugs here:"
, "https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/101"
, ""
, "Press ENTER if you want to continue, CTRL+C if you want to stop."
]
......@@ -68,31 +69,9 @@ main = do
cfg <- readConfig iniPath
let secret = _gc_secretkey cfg
let
contextsTriggers :: Cmd GargError ()
contextsTriggers = do
(masterUserId, _masterRootId, masterCorpusId)
<- getOrMk_RootWithCorpus (UserName userMaster)
(Left corpusMasterName)
(Nothing :: Maybe HyperdataCorpus)
masterListId <- getOrMkList masterCorpusId masterUserId
_triggers <- initLastTriggers masterListId
pure ()
withDevEnv iniPath $ \env -> do
-- First upgrade the Database Schema
_ <- runCmdDev env sqlSchema
-- Then upgrade the triggers
_ <- runCmdDev env (initFirstTriggers secret :: Cmd GargError [Int64])
_ <- runCmdDev env (contextsTriggers :: Cmd GargError ())
-- Move nodes to contexts table
_ <- runCmdDev env sqlNodes2Contexts
-- Update the hashes
_ <- runCmdDev env sqlUpdateTriggerHash
_ <- runCmdDev env (migrateFromDirToDb :: Cmd GargError ())
___
putStrLn "Uprade done with success !"
......@@ -100,7 +79,7 @@ main = do
pure ()
{-
sqlUpdateTriggerHash :: Cmd'' DevEnv IOException Int64
sqlUpdateTriggerHash = do
execPGSQuery query ()
......@@ -283,3 +262,5 @@ sqlSchema = do
CREATE INDEX IF NOT EXISTS context_node_node_id_idx ON public.context_node_ngrams USING btree (node_id);
|]
-}
#!/bin/bash
# To be executed at the root of the project
# backup
sudo apt update
sudo apt upgrade
sudo sed -i "s/buster/bullseye/g" /etc/apt/sources.list
sudo apt update
sudo apt -yy dist-upgrade
git pull origin dev
./bin/install
#./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.0.sql
#./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.1.sql
# exec script haskell upgrade
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
sed -i "s/DB_PORT = 5432/DB_PORT = 5433/" gargantext.ini
DBPASS=$(grep "DB_PASS" gargantext.ini | sed "s/^.*= //")
sudo -i -u postgres bash << EOF
psql < 'ALTER ROLE gargantua password \'$DBPASS\'';
EOF
./bin/psql gargantext.ini < devops/postgres/upgrade/0.0.6.2.sql
......@@ -199,7 +199,7 @@ getCoocByNgrams' f (Diagonal diag) m =
------------------------------------------
migrateFromDirToDb :: (CmdM env err m, HasNodeStory env err m)
migrateFromDirToDb :: (CmdM env err m) -- , HasNodeStory env err m)
=> m ()
migrateFromDirToDb = do
pool <- view connPool
......
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