|
@@ -0,0 +1,52 @@
|
|
1
|
+. bash_library.sh # source bash_library.sh
|
|
2
|
+
|
|
3
|
+function install_backend_system_dep {
|
|
4
|
+ log "install base debian-packaged-dep for backend..."
|
|
5
|
+ sudo apt update
|
|
6
|
+ sudo apt install -y python3 python3-venv python3-dev python3-pip
|
|
7
|
+ sudo apt install -y redis-server
|
|
8
|
+
|
|
9
|
+ log "install deps for dealing with most preview..."
|
|
10
|
+ sudo apt install -y zlib1g-dev libjpeg-dev
|
|
11
|
+ sudo apt install -y imagemagick libmagickwand-dev ghostscript
|
|
12
|
+ sudo apt install -y libreoffice # most office documents file and text format
|
|
13
|
+ sudo apt install -y inkscape # for .svg files.
|
|
14
|
+}
|
|
15
|
+
|
|
16
|
+function setup_pyenv {
|
|
17
|
+ log "setup python3 env.."
|
|
18
|
+ python3 -m venv env
|
|
19
|
+ source env/bin/activate
|
|
20
|
+}
|
|
21
|
+
|
|
22
|
+function install_backend_python_packages {
|
|
23
|
+ pip install --upgrade pip setuptools
|
|
24
|
+
|
|
25
|
+ log "install tracim-backend (sqlite_backend)..."
|
|
26
|
+ pip install -e ".[testing]"
|
|
27
|
+}
|
|
28
|
+
|
|
29
|
+function setup_config_file {
|
|
30
|
+ log "configure tracim with default conf..."
|
|
31
|
+ if [ ! -f development.ini ]; then
|
|
32
|
+ log "generate missing development.ini ..."
|
|
33
|
+ cp development.ini.sample development.ini
|
|
34
|
+ fi
|
|
35
|
+
|
|
36
|
+ if [ ! -f wsgidav.conf ]; then
|
|
37
|
+ log "generate missing wsgidav.conf ..."
|
|
38
|
+ cp wsgidav.conf.sample wsgidav.conf
|
|
39
|
+ fi
|
|
40
|
+}
|
|
41
|
+
|
|
42
|
+function setup_db {
|
|
43
|
+ result=$(alembic -c development.ini current)
|
|
44
|
+ if [ $? -eq 0 ] && [ ! "$result" == '' ]; then
|
|
45
|
+ log "check database migration..."
|
|
46
|
+ alembic -c development.ini upgrade head
|
|
47
|
+ else
|
|
48
|
+ log "database seems missing, init it..."
|
|
49
|
+ tracimcli db init
|
|
50
|
+ alembic -c development.ini stamp head
|
|
51
|
+ fi
|
|
52
|
+}
|