-
Notifications
You must be signed in to change notification settings - Fork 0
/
whaticketplus
75 lines (64 loc) · 1.82 KB
/
whaticketplus
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
#!/bin/bash
# reset shell colors
tput init
# https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
PROJECT_ROOT="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$PROJECT_ROOT/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
PROJECT_ROOT="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
# required imports
source "${PROJECT_ROOT}"/variables/manifest.sh
source "${PROJECT_ROOT}"/utils/manifest.sh
source "${PROJECT_ROOT}"/lib/manifest.sh
# user configs file
if [[ ! -e "${PROJECT_ROOT}"/config ]]; then
cat << EOF > "${PROJECT_ROOT}"/config
deploy_password=${deploy_password}
mysql_root_password=${mysql_root_password}
db_pass=${db_pass}
EOF
fi
# this file has passwords
sudo su - root <<EOF
chown root:root "${PROJECT_ROOT}"/config
chmod 700 "${PROJECT_ROOT}"/config
EOF
source "${PROJECT_ROOT}"/config
# interactive CLI
inquiry_options
# dependencies related
system_update
system_set_timezone
system_set_ufw
system_node_install
system_pm2_install
system_docker_install
system_puppeteer_dependencies
system_snapd_install
system_nginx_install
system_certbot_install
# system config
system_create_user
system_execute_comand
# backend related
system_unzip_whaticket
backend_chrome_install
backend_set_env
backend_redis_create
backend_node_dependencies
backend_db_migrate
backend_db_seed
backend_start_pm2
backend_nginx_setup
# frontend related
frontend_set_env
frontend_node_dependencies
frontend_start_pm2
frontend_nginx_setup
# network related
system_nginx_conf
system_nginx_restart
system_certbot_setup