From e18a34ce63634e8db09f47e764fefe1f4d7219f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Sun, 11 Jan 2026 18:06:48 +0100 Subject: [PATCH] Refactor: Infisical (#10693) * Refactor * Update * Fix --- ct/infisical.sh | 1 + install/infisical-install.sh | 25 ++++--------------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/ct/infisical.sh b/ct/infisical.sh index 7d4f7ee09..a7fa33780 100644 --- a/ct/infisical.sh +++ b/ct/infisical.sh @@ -33,6 +33,7 @@ function update_script() { msg_ok "Service stopped" msg_info "Creating backup" + [[ -f /opt/infisical_backup.sql ]] && rm -f /opt/infisical_backup.sql 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" diff --git a/install/infisical-install.sh b/install/infisical-install.sh index 3f011a8e8..637f7973b 100644 --- a/install/infisical-install.sh +++ b/install/infisical-install.sh @@ -16,11 +16,12 @@ update_os msg_info "Installing Dependencies" $STD apt install -y \ apt-transport-https \ - ca-certificates \ redis msg_ok "Installed Dependencies" PG_VERSION="17" setup_postgresql +PG_DB_NAME="infisical_db" PG_DB_USER="infisical" setup_postgresql_db +import_local_ip msg_info "Setting up Infisical Repository" setup_deb822_repo \ @@ -30,34 +31,16 @@ setup_deb822_repo \ "stable" msg_ok "Setup Infisical repository" -msg_info "Configuring PostgreSQL" -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;" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';" -{ - echo "Infiscal Credentials" - echo "Database Name: $DB_NAME" - echo "Database User: $DB_USER" - echo "Database Password: $DB_PASS" -} >>~/infisical.creds -msg_ok "Configured PostgreSQL" - msg_info "Setting up Infisical" AUTH_SECRET="$(openssl rand -base64 32 | tr -d '\n')" ENC_KEY="$(openssl rand -hex 16 | tr -d '\n')" -IP_ADDR=$(hostname -I | awk '{print $1}') $STD apt install -y infisical-core mkdir -p /etc/infisical cat </etc/infisical/infisical.rb infisical_core['ENCRYPTION_KEY'] = '$ENC_KEY' infisical_core['AUTH_SECRET'] = '$AUTH_SECRET' -infisical_core['HOST'] = '$IP_ADDR' -infisical_core['DB_CONNECTION_URI'] = 'postgres://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}' +infisical_core['HOST'] = '$LOCAL_IP' +infisical_core['DB_CONNECTION_URI'] = 'postgres://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}' infisical_core['REDIS_URL'] = 'redis://localhost:6379' EOF $STD infisical-ctl reconfigure