From 55166a5d6c567d95eb3f0d45deece0e09f2fbe6b Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Sun, 16 Nov 2025 16:05:10 +0100 Subject: [PATCH] Metabase (#9190) * 'Add new script' * Update log message for stopping Metabase service --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/headers/metabase | 6 +++ ct/metabase.sh | 65 ++++++++++++++++++++++++++++++ frontend/public/json/metabase.json | 35 ++++++++++++++++ install/metabase-install.sh | 59 +++++++++++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 ct/headers/metabase create mode 100644 ct/metabase.sh create mode 100644 frontend/public/json/metabase.json create mode 100644 install/metabase-install.sh diff --git a/ct/headers/metabase b/ct/headers/metabase new file mode 100644 index 000000000..a98c3c699 --- /dev/null +++ b/ct/headers/metabase @@ -0,0 +1,6 @@ + __ ___ __ __ + / |/ /__ / /_____ _/ /_ ____ _________ + / /|_/ / _ \/ __/ __ `/ __ \/ __ `/ ___/ _ \ + / / / / __/ /_/ /_/ / /_/ / /_/ (__ ) __/ +/_/ /_/\___/\__/\__,_/_.___/\__,_/____/\___/ + diff --git a/ct/metabase.sh b/ct/metabase.sh new file mode 100644 index 000000000..4b41a0cfd --- /dev/null +++ b/ct/metabase.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# 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 "Stopped Service" + + 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 + +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}" diff --git a/frontend/public/json/metabase.json b/frontend/public/json/metabase.json new file mode 100644 index 000000000..1cb744078 --- /dev/null +++ b/frontend/public/json/metabase.json @@ -0,0 +1,35 @@ +{ + "name": "Metabase", + "slug": "metabase", + "categories": [ + 9 + ], + "date_created": "2025-09-04", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 3000, + "documentation": "https://www.metabase.com/docs/latest/", + "config_path": "/opt/metabase/.env", + "website": "https://www.metabase.com/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/metabase.webp", + "description": "Metabase is an open-source business intelligence platform. You can use Metabase to ask questions about your data, or embed Metabase in your app to let your customers explore their data on their own.", + "install_methods": [ + { + "type": "default", + "script": "ct/metabase.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 6, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] +} diff --git a/install/metabase-install.sh b/install/metabase-install.sh new file mode 100644 index 000000000..df8451472 --- /dev/null +++ b/install/metabase-install.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.metabase.com/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +JAVA_VERSION="21" setup_java +PG_VERSION="17" setup_postgresql +PG_DB_NAME="metabase_db" PG_DB_USER="metabase" setup_postgresql_db + +msg_info "Setting up Metabase" +mkdir -p /opt/metabase +RELEASE=$(get_latest_github_release "metabase/metabase") +curl -fsSL "https://downloads.metabase.com/v${RELEASE}.x/metabase.jar" -o /opt/metabase/metabase.jar +cd /opt/metabase + +cat </opt/metabase/.env +MB_DB_TYPE=postgres +MB_DB_DBNAME=$PG_DB_NAME +MB_DB_PORT=5432 +MB_DB_USER=$PG_DB_USER +MB_DB_PASS=$PG_DB_PASS +MB_DB_HOST=localhost +EOF +echo $RELEASE >~/.metabase +msg_ok "Setup Metabase" + +msg_info "Creating Service" +cat </etc/systemd/system/metabase.service +[Unit] +Description=Metabase Service +After=network.target + +[Service] +EnvironmentFile=/opt/metabase/.env +WorkingDirectory=/opt/metabase +ExecStart=/usr/bin/java --add-opens java.base/java.nio=ALL-UNNAMED -jar metabase.jar +Restart=always +SuccessExitStatus=143 +TimeoutStopSec=120 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now metabase +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc