blob: 3a3f13fb762c322b4b62f35af48179212fe0b39e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#!/bin/bash
export $(cat .env | xargs)
packages() {
sudo apt-get install \
nodejs npm \
python3 python3-venv python3-pip \
make \
gcc \
sqlite3 libsqlite3-dev \
nginx
}
yarn_install() {
sudo npm i -g typescript yarn # install typescript compilers and yarn package manager globally using npm
}
node_packages() {
yarn
}
python_packages() {
python3 -m venv venv # create virtual environment
venv/bin/pip install -r requirements.txt # install the dependencies
}
submodules() {
git submodule init
git submodule update
}
database() {
cd database
sh init_db.sh
make
cd ..
}
voerbak() {
cd voerbak
make
cd ..
}
all() {
packages
yarn_install
node_packages
python_packages
submodules
database
voerbak
}
customize_config() {
sed "s#{{ connect4_dir }}#$(pwd)#g" -i ./api.systemd.conf
sed "s/{{ connect4_user }}/$(whoami)/g" -i ./api.systemd.conf
sed "s/user nobody/user $(whoami)/" -i ./nginx.conf
}
build() {
customize_config
npx next build
npx next export
}
install() {
rm -rfv $CONNECT4_WEB_ROOT/*
mv -v out/* $CONNECT4_WEB_ROOT
}
prod() {
sed "s/CONNECT4_DEBUG=1/CONNECT4_DEBUG=0/" -i .env
build
install
}
if [[ -z $1 ]]; then
all
exit
fi
$1
|