diff --git a/ct/infisical.sh b/ct/infisical.sh index e69de29bb..4413f0c75 100644 --- a/ct/infisical.sh +++ b/ct/infisical.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/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://infisical.com/ + +APP="Infisical" +var_tags="${var_tags:-auth}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-4}" +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 /etc/infisical ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + msg_info "Stopping service" + $STD inisical-ctl stop + msg_ok "Service stopped" + + msg_info "Creating backup" + DB_PASS=$(grep -Po '(?<=^Database Password:\s).*' ~/infisical.creds | head -n1) + PGPASSWORD=$DB_PASS pg_dump -U infisical -h localhost -d infisical_db > /opt/infisical_backup.sql + msg_ok "Created backup" + + msg_info "Updating Infisical" + $STD apt update + $STD apt install -y infisical-core + $STD infisical-ctl reconfigure + msg_ok "Updated Infisical" + + msg_info "Starting service" + infisical-ctl start + msg_ok "Started service" + msg_ok "Updated successfully" + 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/install/infisical-install.sh b/install/infisical-install.sh index 92467fb64..3a8c77f99 100644 --- a/install/infisical-install.sh +++ b/install/infisical-install.sh @@ -33,8 +33,8 @@ msg_ok "Setup Infisical repository" PG_VERSION="17" setup_postgresql msg_info "Setting up PostgreSQL" -DB_NAME="infiscal_db" -DB_USER="infiscal" +DB_NAME="infisical_db" +DB_USER="infisical" DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)" $STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" @@ -46,7 +46,7 @@ $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';" echo "Database Name: $DB_NAME" echo "Database User: $DB_USER" echo "Database Password: $DB_PASS" -} >>~/infiscal.creds +} >>~/infisical.creds msg_ok "Setup PostgreSQL" msg_info "Setting up Infisical"