From fdd9a22992a85b05f42acf182bb9b992b9ce2fc5 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Wed, 18 Mar 2026 12:56:51 +0100 Subject: [PATCH] librechat --- ct/librechat.sh | 72 ++++++++++++++++++++++++++++++++++++ install/librechat-install.sh | 70 +++++++++++++++++++++++++++++++++++ json/librechat.json | 44 ++++++++++++++++++++++ 3 files changed, 186 insertions(+) create mode 100644 ct/librechat.sh create mode 100644 install/librechat-install.sh create mode 100644 json/librechat.json diff --git a/ct/librechat.sh b/ct/librechat.sh new file mode 100644 index 000000000..74c634dbe --- /dev/null +++ b/ct/librechat.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://github.com/danny-avila/LibreChat + +APP="LibreChat" +var_tags="${var_tags:-ai;chat}" +var_cpu="${var_cpu:-4}" +var_ram="${var_ram:-4096}" +var_disk="${var_disk:-12}" +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/librechat ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_tag "librechat" "danny-avila/LibreChat" "v"; then + msg_info "Stopping Service" + systemctl stop librechat + msg_ok "Stopped Service" + + msg_info "Backing up Configuration" + cp /opt/librechat/.env /opt/librechat.env.bak + msg_ok "Backed up Configuration" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_tag "librechat" "danny-avila/LibreChat" + + msg_info "Installing Dependencies" + cd /opt/librechat + $STD npm ci + msg_ok "Installed Dependencies" + + msg_info "Building Frontend" + $STD npm run frontend + msg_ok "Built Frontend" + + msg_info "Restoring Configuration" + cp /opt/librechat.env.bak /opt/librechat/.env + rm -f /opt/librechat.env.bak + msg_ok "Restored Configuration" + + msg_info "Starting Service" + systemctl start librechat + 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}:3080${CL}" diff --git a/install/librechat-install.sh b/install/librechat-install.sh new file mode 100644 index 000000000..4425bd225 --- /dev/null +++ b/install/librechat-install.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://github.com/danny-avila/LibreChat + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +MONGO_VERSION="8.0" setup_mongodb +NODE_VERSION="22" setup_nodejs + +fetch_and_deploy_gh_tag "librechat" "danny-avila/LibreChat" + +msg_info "Installing Dependencies" +cd /opt/librechat +$STD npm ci +msg_ok "Installed Dependencies" + +msg_info "Building Frontend" +$STD npm run frontend +msg_ok "Built Frontend" + +msg_info "Configuring LibreChat" +JWT_SECRET=$(openssl rand -hex 32) +JWT_REFRESH_SECRET=$(openssl rand -hex 32) +CREDS_KEY=$(openssl rand -hex 32) +CREDS_IV=$(openssl rand -hex 16) +cat </opt/librechat/.env +HOST=0.0.0.0 +PORT=3080 +MONGO_URI=mongodb://127.0.0.1:27017/LibreChat +JWT_SECRET=${JWT_SECRET} +JWT_REFRESH_SECRET=${JWT_REFRESH_SECRET} +CREDS_KEY=${CREDS_KEY} +CREDS_IV=${CREDS_IV} +NODE_ENV=production +EOF +msg_ok "Configured LibreChat" + +msg_info "Creating Service" +cat </etc/systemd/system/librechat.service +[Unit] +Description=LibreChat +After=network.target mongod.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/librechat +EnvironmentFile=/opt/librechat/.env +ExecStart=/usr/bin/npm run backend +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now librechat +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc diff --git a/json/librechat.json b/json/librechat.json new file mode 100644 index 000000000..486b89d24 --- /dev/null +++ b/json/librechat.json @@ -0,0 +1,44 @@ +{ + "name": "LibreChat", + "slug": "librechat", + "categories": [ + 20 + ], + "date_created": "2026-03-18", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 3080, + "documentation": "https://www.librechat.ai/docs", + "website": "https://www.librechat.ai/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/librechat.webp", + "config_path": "/opt/librechat/.env", + "description": "LibreChat is an open-source AI chat platform that supports multiple AI providers including OpenAI, Anthropic, Google, and more. It features conversation history, multi-modal support, custom endpoints, and a plugin system.", + "install_methods": [ + { + "type": "default", + "script": "ct/librechat.sh", + "resources": { + "cpu": 4, + "ram": 4096, + "hdd": 12, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Register the first account via the web interface — it becomes the admin account.", + "type": "info" + }, + { + "text": "Configure your AI provider API keys in /opt/librechat/.env and restart the service.", + "type": "info" + } + ] +} \ No newline at end of file