-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetabase-postgres-install.sh
More file actions
84 lines (69 loc) · 2.38 KB
/
metabase-postgres-install.sh
File metadata and controls
84 lines (69 loc) · 2.38 KB
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
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/drVLecter/prxscripts/main/metabase-postgres-install.sh)
# Copyright (c) 2021-2025 comms*
# Author: vld*
# License: MIT | https*
# Source: https://www.metabase.com/
APP="Metabase"
var_tags="${var_tags:-analytics}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-6}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/metabase ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "metabase" "metabase/metabase"; then
msg_info "Stopping Service"
systemctl stop metabase
msg_info "Service stopped"
msg_info "Creating backup"
mv /opt/metabase/.env /opt
msg_ok "Created backup"
msg_info "Updating Metabase"
RELEASE=$(get_latest_github_release "metabase/metabase")
curl -fsSL "https://downloads.metabase.com/v${RELEASE}.x/metabase.jar" -o /opt/metabase/metabase.jar
echo $RELEASE >~/.metabase
msg_ok "Updated Metabase"
msg_info "Restoring backup"
mv /opt/.env /opt/metabase
msg_ok "Restored backup"
msg_info "Starting Service"
systemctl start metabase
msg_ok "Started Service"
msg_ok "Updated successfully!"
fi
exit
}
start
build_container
description
##############################################################################
### --- CUSTOM: Configure Metabase to use your external PostgreSQL DB --- ###
##############################################################################
msg_info "Configuring Metabase to use external PostgreSQL database"
pct exec "$CTID" -- bash -c "cat >/opt/metabase/.env << 'EOF'
MB_DB_TYPE=postgres
MB_DB_HOST=192.168.0.212
MB_DB_PORT=5432
MB_DB_DBNAME=metabase_db
MB_DB_USER=postgres
MB_DB_PASS=MyMY
EOF"
msg_ok "PostgreSQL configuration applied"
##############################################################################
msg_ok "Completed Successfully!\n"
echo -e \"${CREATING}${GN}${APP} setup has been successfully initialized!${CL}\"
echo -e \"${INFO}${YW} Access it using the following URL:${CL}\"
echo -e \"${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}\"