Compare commits
16 Commits
update_foo
...
get_update
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60f81fabc3 | ||
|
|
414c356446 | ||
|
|
c38ded7a39 | ||
|
|
0cfed84cd0 | ||
|
|
9611bc9bcf | ||
|
|
6fe2a790fd | ||
|
|
5ea71837e7 | ||
|
|
bf5ebc72b6 | ||
|
|
a32c7bcbba | ||
|
|
98c6e79db6 | ||
|
|
c962a9cd5a | ||
|
|
5d20a6d694 | ||
|
|
cb4e8c543a | ||
|
|
2ba213de49 | ||
|
|
849aabb575 | ||
|
|
dd33df2033 |
841
package-lock.json
generated
841
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
50
package.json
50
package.json
@@ -25,33 +25,33 @@
|
|||||||
"typecheck": "tsc --noEmit"
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/adapter-better-sqlite3": "^7.1.0",
|
"@prisma/adapter-better-sqlite3": "^7.2.0",
|
||||||
"@prisma/client": "^7.1.0",
|
"@prisma/client": "^7.2.0",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
||||||
"@radix-ui/react-slot": "^1.2.4",
|
"@radix-ui/react-slot": "^1.2.4",
|
||||||
"@t3-oss/env-nextjs": "^0.13.10",
|
"@t3-oss/env-nextjs": "^0.13.10",
|
||||||
"@tailwindcss/typography": "^0.5.19",
|
"@tailwindcss/typography": "^0.5.19",
|
||||||
"@tanstack/react-query": "^5.90.12",
|
"@tanstack/react-query": "^5.90.16",
|
||||||
"@trpc/client": "^11.8.0",
|
"@trpc/client": "^11.8.1",
|
||||||
"@trpc/react-query": "^11.8.1",
|
"@trpc/react-query": "^11.8.1",
|
||||||
"@trpc/server": "^11.8.0",
|
"@trpc/server": "^11.8.1",
|
||||||
"@types/react-syntax-highlighter": "^15.5.13",
|
"@types/react-syntax-highlighter": "^15.5.13",
|
||||||
"@types/ws": "^8.18.1",
|
"@types/ws": "^8.18.1",
|
||||||
"@xterm/addon-fit": "^0.10.0",
|
"@xterm/addon-fit": "^0.11.0",
|
||||||
"@xterm/addon-web-links": "^0.11.0",
|
"@xterm/addon-web-links": "^0.12.0",
|
||||||
"@xterm/xterm": "^5.5.0",
|
"@xterm/xterm": "^6.0.0",
|
||||||
"axios": "^1.13.2",
|
"axios": "^1.13.2",
|
||||||
"bcryptjs": "^3.0.3",
|
"bcryptjs": "^3.0.3",
|
||||||
"better-sqlite3": "^12.5.0",
|
"better-sqlite3": "^12.6.0",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"cron-validator": "^1.4.0",
|
"cron-validator": "^1.4.0",
|
||||||
"dotenv": "^17.2.3",
|
"dotenv": "^17.2.3",
|
||||||
"jsonwebtoken": "^9.0.3",
|
"jsonwebtoken": "^9.0.3",
|
||||||
"lucide-react": "^0.561.0",
|
"lucide-react": "^0.562.0",
|
||||||
"next": "^16.0.10",
|
"next": "^16.1.1",
|
||||||
"node-cron": "^4.2.1",
|
"node-cron": "^4.2.1",
|
||||||
"node-pty": "^1.0.0",
|
"node-pty": "^1.1.0",
|
||||||
"react": "^19.2.3",
|
"react": "^19.2.3",
|
||||||
"react-dom": "^19.2.3",
|
"react-dom": "^19.2.3",
|
||||||
"react-markdown": "^10.1.0",
|
"react-markdown": "^10.1.0",
|
||||||
@@ -62,37 +62,37 @@
|
|||||||
"strip-ansi": "^7.1.2",
|
"strip-ansi": "^7.1.2",
|
||||||
"superjson": "^2.2.6",
|
"superjson": "^2.2.6",
|
||||||
"tailwind-merge": "^3.4.0",
|
"tailwind-merge": "^3.4.0",
|
||||||
"ws": "^8.18.3",
|
"ws": "^8.19.0",
|
||||||
"zod": "^4.1.13"
|
"zod": "^4.3.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/postcss": "^4.1.18",
|
"@tailwindcss/postcss": "^4.1.18",
|
||||||
"@testing-library/jest-dom": "^6.9.1",
|
"@testing-library/jest-dom": "^6.9.1",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.1",
|
||||||
"@testing-library/user-event": "^14.6.1",
|
"@testing-library/user-event": "^14.6.1",
|
||||||
"@types/bcryptjs": "^3.0.0",
|
"@types/bcryptjs": "^3.0.0",
|
||||||
"@types/better-sqlite3": "^7.6.13",
|
"@types/better-sqlite3": "^7.6.13",
|
||||||
"@types/jsonwebtoken": "^9.0.10",
|
"@types/jsonwebtoken": "^9.0.10",
|
||||||
"@types/node": "^24.10.4",
|
"@types/node": "^24.10.4",
|
||||||
"@types/node-cron": "^3.0.11",
|
"@types/node-cron": "^3.0.11",
|
||||||
"@types/react": "^19.2.7",
|
"@types/react": "^19.2.8",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react-dom": "^19.2.3",
|
||||||
"@vitejs/plugin-react": "^5.1.2",
|
"@vitejs/plugin-react": "^5.1.2",
|
||||||
"@vitest/coverage-v8": "^4.0.15",
|
"@vitest/coverage-v8": "^4.0.17",
|
||||||
"@vitest/ui": "^4.0.14",
|
"@vitest/ui": "^4.0.17",
|
||||||
"baseline-browser-mapping": "^2.9.3",
|
"baseline-browser-mapping": "^2.9.14",
|
||||||
"eslint": "^9.39.1",
|
"eslint": "^9.39.2",
|
||||||
"eslint-config-next": "^16.1.0",
|
"eslint-config-next": "^16.1.1",
|
||||||
"jsdom": "^27.3.0",
|
"jsdom": "^27.4.0",
|
||||||
"postcss": "^8.5.6",
|
"postcss": "^8.5.6",
|
||||||
"prettier": "^3.7.4",
|
"prettier": "^3.7.4",
|
||||||
"prettier-plugin-tailwindcss": "^0.7.2",
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
||||||
"prisma": "^7.1.0",
|
"prisma": "^7.2.0",
|
||||||
"tailwindcss": "^4.1.18",
|
"tailwindcss": "^4.1.18",
|
||||||
"tsx": "^4.21.0",
|
"tsx": "^4.21.0",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"typescript-eslint": "^8.48.1",
|
"typescript-eslint": "^8.53.0",
|
||||||
"vitest": "^4.0.14"
|
"vitest": "^4.0.17"
|
||||||
},
|
},
|
||||||
"ct3aMetadata": {
|
"ct3aMetadata": {
|
||||||
"initVersion": "7.39.3"
|
"initVersion": "7.39.3"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2026 community-scripts ORG
|
||||||
# Author: tteck (tteckster)
|
# Author: tteck (tteckster)
|
||||||
# Co-Author: MickLesk
|
# Co-Author: MickLesk
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2026 community-scripts ORG
|
||||||
# Author: michelroegl-brunner
|
# Author: michelroegl-brunner
|
||||||
# License: MIT | https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/LICENSE
|
# License: MIT | https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/LICENSE
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2026 community-scripts ORG
|
||||||
# Author: community-scripts ORG
|
# Author: community-scripts ORG
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/branch/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/branch/main/LICENSE
|
||||||
# Revision: 1
|
# Revision: 1
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2026 community-scripts ORG
|
||||||
# License: MIT | https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/LICENSE
|
# License: MIT | https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/LICENSE
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
@@ -123,6 +123,7 @@ icons() {
|
|||||||
CREATING="${TAB}🚀${TAB}${CL}"
|
CREATING="${TAB}🚀${TAB}${CL}"
|
||||||
ADVANCED="${TAB}🧩${TAB}${CL}"
|
ADVANCED="${TAB}🧩${TAB}${CL}"
|
||||||
FUSE="${TAB}🗂️${TAB}${CL}"
|
FUSE="${TAB}🗂️${TAB}${CL}"
|
||||||
|
GPU="${TAB}🎮${TAB}${CL}"
|
||||||
HOURGLASS="${TAB}⏳${TAB}"
|
HOURGLASS="${TAB}⏳${TAB}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -808,18 +809,15 @@ cleanup_lxc() {
|
|||||||
find /tmp /var/tmp -type f -name 'tmp*' -delete 2>/dev/null || true
|
find /tmp /var/tmp -type f -name 'tmp*' -delete 2>/dev/null || true
|
||||||
find /tmp /var/tmp -type f -name 'tempfile*' -delete 2>/dev/null || true
|
find /tmp /var/tmp -type f -name 'tempfile*' -delete 2>/dev/null || true
|
||||||
|
|
||||||
# Truncate writable log files silently (permission errors ignored)
|
# Node.js npm - directly remove cache directory
|
||||||
if command -v truncate >/dev/null 2>&1; then
|
# npm cache clean/verify can fail with ENOTEMPTY errors, so we skip them
|
||||||
find /var/log -type f -writable -print0 2>/dev/null |
|
if command -v npm &>/dev/null; then
|
||||||
xargs -0 -n1 truncate -s 0 2>/dev/null || true
|
rm -rf /root/.npm/_cacache /root/.npm/_logs 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Node.js npm
|
|
||||||
if command -v npm &>/dev/null; then $STD npm cache clean --force || true; fi
|
|
||||||
# Node.js yarn
|
# Node.js yarn
|
||||||
if command -v yarn &>/dev/null; then $STD yarn cache clean || true; fi
|
if command -v yarn &>/dev/null; then yarn cache clean &>/dev/null || true; fi
|
||||||
# Node.js pnpm
|
# Node.js pnpm
|
||||||
if command -v pnpm &>/dev/null; then $STD pnpm store prune || true; fi
|
if command -v pnpm &>/dev/null; then pnpm store prune &>/dev/null || true; fi
|
||||||
# Go
|
# Go
|
||||||
if command -v go &>/dev/null; then $STD go clean -cache -modcache || true; fi
|
if command -v go &>/dev/null; then $STD go clean -cache -modcache || true; fi
|
||||||
# Rust cargo
|
# Rust cargo
|
||||||
@@ -827,11 +825,8 @@ cleanup_lxc() {
|
|||||||
# Ruby gem
|
# Ruby gem
|
||||||
if command -v gem &>/dev/null; then $STD gem cleanup || true; fi
|
if command -v gem &>/dev/null; then $STD gem cleanup || true; fi
|
||||||
# Composer (PHP)
|
# Composer (PHP)
|
||||||
if command -v composer &>/dev/null; then $STD composer clear-cache || true; fi
|
if command -v composer &>/dev/null; then COMPOSER_ALLOW_SUPERUSER=1 $STD composer clear-cache || true; fi
|
||||||
|
|
||||||
if command -v journalctl &>/dev/null; then
|
|
||||||
$STD journalctl --vacuum-time=10m || true
|
|
||||||
fi
|
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# ERROR HANDLER - ERROR & SIGNAL MANAGEMENT
|
# ERROR HANDLER - ERROR & SIGNAL MANAGEMENT
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2026 community-scripts ORG
|
||||||
# Author: MickLesk (CanbiZ)
|
# Author: MickLesk (CanbiZ)
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
@@ -34,9 +34,9 @@
|
|||||||
# * Node.js/npm errors (243-249, 254)
|
# * Node.js/npm errors (243-249, 254)
|
||||||
# * Python/pip/uv errors (210-212)
|
# * Python/pip/uv errors (210-212)
|
||||||
# * PostgreSQL errors (231-234)
|
# * PostgreSQL errors (231-234)
|
||||||
# * MySQL/MariaDB errors (260-263)
|
# * MySQL/MariaDB errors (241-244)
|
||||||
# * MongoDB errors (251-253)
|
# * MongoDB errors (251-254)
|
||||||
# * Proxmox custom codes (200-209, 213-223, 225)
|
# * Proxmox custom codes (200-231)
|
||||||
# - Returns description string for given exit code
|
# - Returns description string for given exit code
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
explain_exit_code() {
|
explain_exit_code() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2026 community-scripts ORG
|
||||||
# Author: tteck (tteckster)
|
# Author: tteck (tteckster)
|
||||||
# Co-Author: MickLesk
|
# Co-Author: MickLesk
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
@@ -222,21 +222,12 @@ motd_ssh() {
|
|||||||
# Set terminal to 256-color mode
|
# Set terminal to 256-color mode
|
||||||
grep -qxF "export TERM='xterm-256color'" /root/.bashrc || echo "export TERM='xterm-256color'" >>/root/.bashrc
|
grep -qxF "export TERM='xterm-256color'" /root/.bashrc || echo "export TERM='xterm-256color'" >>/root/.bashrc
|
||||||
|
|
||||||
# Get OS information (Debian / Ubuntu)
|
|
||||||
if [ -f "/etc/os-release" ]; then
|
|
||||||
OS_NAME=$(grep ^NAME /etc/os-release | cut -d= -f2 | tr -d '"')
|
|
||||||
OS_VERSION=$(grep ^VERSION_ID /etc/os-release | cut -d= -f2 | tr -d '"')
|
|
||||||
elif [ -f "/etc/debian_version" ]; then
|
|
||||||
OS_NAME="Debian"
|
|
||||||
OS_VERSION=$(cat /etc/debian_version)
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROFILE_FILE="/etc/profile.d/00_lxc-details.sh"
|
PROFILE_FILE="/etc/profile.d/00_lxc-details.sh"
|
||||||
echo "echo -e \"\"" >"$PROFILE_FILE"
|
echo "echo -e \"\"" >"$PROFILE_FILE"
|
||||||
echo -e "echo -e \"${BOLD}${APPLICATION} LXC Container${CL}"\" >>"$PROFILE_FILE"
|
echo -e "echo -e \"${BOLD}${APPLICATION} LXC Container${CL}"\" >>"$PROFILE_FILE"
|
||||||
echo -e "echo -e \"${TAB}${GATEWAY}${YW} Provided by: ${GN}community-scripts ORG ${YW}| GitHub: ${GN}https://github.com/community-scripts/ProxmoxVE${CL}\"" >>"$PROFILE_FILE"
|
echo -e "echo -e \"${TAB}${GATEWAY}${YW} Provided by: ${GN}community-scripts ORG ${YW}| GitHub: ${GN}https://github.com/community-scripts/ProxmoxVE${CL}\"" >>"$PROFILE_FILE"
|
||||||
echo "echo \"\"" >>"$PROFILE_FILE"
|
echo "echo \"\"" >>"$PROFILE_FILE"
|
||||||
echo -e "echo -e \"${TAB}${OS}${YW} OS: ${GN}${OS_NAME} - Version: ${OS_VERSION}${CL}\"" >>"$PROFILE_FILE"
|
echo -e "echo -e \"${TAB}${OS}${YW} OS: ${GN}\$(grep ^NAME /etc/os-release | cut -d= -f2 | tr -d '\"') - Version: \$(grep ^VERSION_ID /etc/os-release | cut -d= -f2 | tr -d '\"')${CL}\"" >>"$PROFILE_FILE"
|
||||||
echo -e "echo -e \"${TAB}${HOSTNAME}${YW} Hostname: ${GN}\$(hostname)${CL}\"" >>"$PROFILE_FILE"
|
echo -e "echo -e \"${TAB}${HOSTNAME}${YW} Hostname: ${GN}\$(hostname)${CL}\"" >>"$PROFILE_FILE"
|
||||||
echo -e "echo -e \"${TAB}${INFO}${YW} IP Address: ${GN}\$(hostname -I | awk '{print \$1}')${CL}\"" >>"$PROFILE_FILE"
|
echo -e "echo -e \"${TAB}${INFO}${YW} IP Address: ${GN}\$(hostname -I | awk '{print \$1}')${CL}\"" >>"$PROFILE_FILE"
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1610,6 +1610,7 @@ class ScriptExecutionHandler {
|
|||||||
// TerminalHandler removed - not used by current application
|
// TerminalHandler removed - not used by current application
|
||||||
|
|
||||||
app.prepare().then(() => {
|
app.prepare().then(() => {
|
||||||
|
console.log('> Next.js app prepared successfully');
|
||||||
const httpServer = createServer(async (req, res) => {
|
const httpServer = createServer(async (req, res) => {
|
||||||
try {
|
try {
|
||||||
// Be sure to pass `true` as the second argument to `url.parse`.
|
// Be sure to pass `true` as the second argument to `url.parse`.
|
||||||
@@ -1715,4 +1716,9 @@ app.prepare().then(() => {
|
|||||||
autoSyncModule.setupGracefulShutdown();
|
autoSyncModule.setupGracefulShutdown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}).catch((err) => {
|
||||||
|
console.error('> Failed to start server:', err.message);
|
||||||
|
console.error('> If you see "Could not find a production build", run: npm run build');
|
||||||
|
console.error('> Full error:', err);
|
||||||
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export function Footer({ onOpenReleaseNotes }: FooterProps) {
|
|||||||
<div className="container mx-auto px-4">
|
<div className="container mx-auto px-4">
|
||||||
<div className="flex flex-col sm:flex-row items-center justify-between gap-2 text-sm text-muted-foreground">
|
<div className="flex flex-col sm:flex-row items-center justify-between gap-2 text-sm text-muted-foreground">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span>© 2024 PVE Scripts Local</span>
|
<span>© 2026 PVE Scripts Local</span>
|
||||||
{versionData?.success && versionData.version && (
|
{versionData?.success && versionData.version && (
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
|
|||||||
@@ -238,6 +238,27 @@ export const versionRouter = createTRPCRouter({
|
|||||||
// Clear/create the log file
|
// Clear/create the log file
|
||||||
await writeFile(logPath, '', 'utf-8');
|
await writeFile(logPath, '', 'utf-8');
|
||||||
|
|
||||||
|
// Always fetch the latest update.sh from GitHub before running
|
||||||
|
// This ensures we always use the newest update script, avoiding
|
||||||
|
// the "chicken-and-egg" problem where old scripts can't update properly
|
||||||
|
const updateScriptUrl = 'https://raw.githubusercontent.com/community-scripts/ProxmoxVE-Local/main/update.sh';
|
||||||
|
try {
|
||||||
|
const response = await fetch(updateScriptUrl);
|
||||||
|
if (response.ok) {
|
||||||
|
const latestScript = await response.text();
|
||||||
|
await writeFile(updateScriptPath, latestScript, { mode: 0o755 });
|
||||||
|
// Log that we fetched the latest script
|
||||||
|
await writeFile(logPath, '[INFO] Fetched latest update.sh from GitHub\n', { flag: 'a' });
|
||||||
|
} else {
|
||||||
|
// If fetch fails, log warning but continue with local script
|
||||||
|
await writeFile(logPath, `[WARNING] Could not fetch latest update.sh (HTTP ${response.status}), using local version\n`, { flag: 'a' });
|
||||||
|
}
|
||||||
|
} catch (fetchError) {
|
||||||
|
// If fetch fails, log warning but continue with local script
|
||||||
|
const errorMsg = fetchError instanceof Error ? fetchError.message : 'Unknown error';
|
||||||
|
await writeFile(logPath, `[WARNING] Could not fetch latest update.sh: ${errorMsg}, using local version\n`, { flag: 'a' });
|
||||||
|
}
|
||||||
|
|
||||||
// Spawn the update script as a detached process using nohup
|
// Spawn the update script as a detached process using nohup
|
||||||
// This allows it to run independently and kill the parent Node.js process
|
// This allows it to run independently and kill the parent Node.js process
|
||||||
// Redirect output to log file
|
// Redirect output to log file
|
||||||
|
|||||||
@@ -1,9 +1,22 @@
|
|||||||
import 'dotenv/config'
|
import 'dotenv/config'
|
||||||
import { PrismaClient } from '../../prisma/generated/prisma/client.ts'
|
import { PrismaClient } from '../../prisma/generated/prisma/client.ts'
|
||||||
import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3'
|
import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3'
|
||||||
|
import { existsSync, mkdirSync } from 'fs'
|
||||||
|
import { dirname } from 'path'
|
||||||
|
|
||||||
const globalForPrisma = globalThis;
|
const globalForPrisma = globalThis;
|
||||||
|
|
||||||
|
// Ensure database directory exists before initializing Prisma
|
||||||
|
// DATABASE_URL format: file:/path/to/database.db
|
||||||
|
const dbUrl = process.env.DATABASE_URL || 'file:./data/settings.db';
|
||||||
|
const dbPath = dbUrl.replace(/^file:/, '');
|
||||||
|
const dbDir = dirname(dbPath);
|
||||||
|
|
||||||
|
if (!existsSync(dbDir)) {
|
||||||
|
console.log(`Creating database directory: ${dbDir}`);
|
||||||
|
mkdirSync(dbDir, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
const adapter = new PrismaBetterSqlite3({ url: process.env.DATABASE_URL });
|
const adapter = new PrismaBetterSqlite3({ url: process.env.DATABASE_URL });
|
||||||
|
|
||||||
export const prisma = globalForPrisma.prisma ?? new PrismaClient({ adapter });
|
export const prisma = globalForPrisma.prisma ?? new PrismaClient({ adapter });
|
||||||
|
|||||||
@@ -1,9 +1,22 @@
|
|||||||
import 'dotenv/config'
|
import 'dotenv/config'
|
||||||
import { PrismaClient } from '../../prisma/generated/prisma/client'
|
import { PrismaClient } from '../../prisma/generated/prisma/client'
|
||||||
import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3'
|
import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3'
|
||||||
|
import { existsSync, mkdirSync } from 'fs'
|
||||||
|
import { dirname } from 'path'
|
||||||
|
|
||||||
const globalForPrisma = globalThis as { prisma?: PrismaClient };
|
const globalForPrisma = globalThis as { prisma?: PrismaClient };
|
||||||
|
|
||||||
|
// Ensure database directory exists before initializing Prisma
|
||||||
|
// DATABASE_URL format: file:/path/to/database.db
|
||||||
|
const dbUrl = process.env.DATABASE_URL || 'file:./data/settings.db';
|
||||||
|
const dbPath = dbUrl.replace(/^file:/, '');
|
||||||
|
const dbDir = dirname(dbPath);
|
||||||
|
|
||||||
|
if (!existsSync(dbDir)) {
|
||||||
|
console.log(`Creating database directory: ${dbDir}`);
|
||||||
|
mkdirSync(dbDir, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
const adapter = new PrismaBetterSqlite3({ url: process.env.DATABASE_URL! });
|
const adapter = new PrismaBetterSqlite3({ url: process.env.DATABASE_URL! });
|
||||||
|
|
||||||
export const prisma: PrismaClient = globalForPrisma.prisma ?? new PrismaClient({
|
export const prisma: PrismaClient = globalForPrisma.prisma ?? new PrismaClient({
|
||||||
|
|||||||
104
update.sh
104
update.sh
@@ -72,7 +72,7 @@ load_github_token() {
|
|||||||
# Initialize log file
|
# Initialize log file
|
||||||
init_log() {
|
init_log() {
|
||||||
# Clear/create log file
|
# Clear/create log file
|
||||||
> "$LOG_FILE"
|
>"$LOG_FILE"
|
||||||
log "Starting ProxmoxVE-Local update process..."
|
log "Starting ProxmoxVE-Local update process..."
|
||||||
log "Log file: $LOG_FILE"
|
log "Log file: $LOG_FILE"
|
||||||
}
|
}
|
||||||
@@ -100,19 +100,19 @@ check_dependencies() {
|
|||||||
|
|
||||||
local missing_deps=()
|
local missing_deps=()
|
||||||
|
|
||||||
if ! command -v curl &> /dev/null; then
|
if ! command -v curl &>/dev/null; then
|
||||||
missing_deps+=("curl")
|
missing_deps+=("curl")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v jq &> /dev/null; then
|
if ! command -v jq &>/dev/null; then
|
||||||
missing_deps+=("jq")
|
missing_deps+=("jq")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v npm &> /dev/null; then
|
if ! command -v npm &>/dev/null; then
|
||||||
missing_deps+=("npm")
|
missing_deps+=("npm")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v node &> /dev/null; then
|
if ! command -v node &>/dev/null; then
|
||||||
missing_deps+=("node")
|
missing_deps+=("node")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -418,6 +418,12 @@ restore_backup_files() {
|
|||||||
verify_database_restored() {
|
verify_database_restored() {
|
||||||
log "Verifying database was restored correctly..."
|
log "Verifying database was restored correctly..."
|
||||||
|
|
||||||
|
# Ensure data directory exists (will be auto-created by app if needed)
|
||||||
|
if [ ! -d "data" ]; then
|
||||||
|
log "Creating data directory..."
|
||||||
|
mkdir -p data
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for both possible database filenames
|
# Check for both possible database filenames
|
||||||
local db_file=""
|
local db_file=""
|
||||||
if [ -f "data/database.sqlite" ]; then
|
if [ -f "data/database.sqlite" ]; then
|
||||||
@@ -425,8 +431,10 @@ verify_database_restored() {
|
|||||||
elif [ -f "data/settings.db" ]; then
|
elif [ -f "data/settings.db" ]; then
|
||||||
db_file="data/settings.db"
|
db_file="data/settings.db"
|
||||||
else
|
else
|
||||||
log_error "Database file not found after restore! (checked database.sqlite and settings.db)"
|
# Database doesn't exist yet - this is OK for new installations
|
||||||
return 1
|
# The app will create it automatically via Prisma migrations
|
||||||
|
log_warning "No existing database file found - will be created automatically on first start"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local db_size=$(stat -f%z "$db_file" 2>/dev/null || stat -c%s "$db_file" 2>/dev/null)
|
local db_size=$(stat -f%z "$db_file" 2>/dev/null || stat -c%s "$db_file" 2>/dev/null)
|
||||||
@@ -461,9 +469,9 @@ ensure_database_url() {
|
|||||||
|
|
||||||
# Add DATABASE_URL to .env file
|
# Add DATABASE_URL to .env file
|
||||||
log "Adding DATABASE_URL to .env file..."
|
log "Adding DATABASE_URL to .env file..."
|
||||||
echo "" >> .env
|
echo "" >>.env
|
||||||
echo "# Database" >> .env
|
echo "# Database" >>.env
|
||||||
echo "DATABASE_URL=\"file:./data/settings.db\"" >> .env
|
echo "DATABASE_URL=\"file:./data/settings.db\"" >>.env
|
||||||
|
|
||||||
log_success "DATABASE_URL added to .env file"
|
log_success "DATABASE_URL added to .env file"
|
||||||
}
|
}
|
||||||
@@ -481,11 +489,9 @@ check_service() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Stop the application before updating
|
# Stop the application before updating
|
||||||
stop_application() {
|
stop_application() {
|
||||||
|
|
||||||
|
|
||||||
# Change to the application directory if we're not already there
|
# Change to the application directory if we're not already there
|
||||||
local app_dir
|
local app_dir
|
||||||
if [ -f "package.json" ] && [ -f "server.js" ]; then
|
if [ -f "package.json" ] && [ -f "server.js" ]; then
|
||||||
@@ -577,7 +583,7 @@ update_files() {
|
|||||||
|
|
||||||
# Create a temporary file list to avoid process substitution issues
|
# Create a temporary file list to avoid process substitution issues
|
||||||
local file_list="/tmp/file_list_$$.txt"
|
local file_list="/tmp/file_list_$$.txt"
|
||||||
find "$actual_source_dir" -type f > "$file_list"
|
find "$actual_source_dir" -type f >"$file_list"
|
||||||
|
|
||||||
while IFS= read -r file; do
|
while IFS= read -r file; do
|
||||||
local rel_path="${file#$actual_source_dir/}"
|
local rel_path="${file#$actual_source_dir/}"
|
||||||
@@ -606,7 +612,7 @@ update_files() {
|
|||||||
else
|
else
|
||||||
files_excluded=$((files_excluded + 1))
|
files_excluded=$((files_excluded + 1))
|
||||||
fi
|
fi
|
||||||
done < "$file_list"
|
done <"$file_list"
|
||||||
|
|
||||||
# Clean up temporary file
|
# Clean up temporary file
|
||||||
rm -f "$file_list"
|
rm -f "$file_list"
|
||||||
@@ -624,7 +630,6 @@ update_files() {
|
|||||||
log_success "Application files updated successfully ($files_copied files)"
|
log_success "Application files updated successfully ($files_copied files)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Install dependencies and build
|
# Install dependencies and build
|
||||||
install_and_build() {
|
install_and_build() {
|
||||||
log "Installing dependencies..."
|
log "Installing dependencies..."
|
||||||
@@ -647,7 +652,7 @@ install_and_build() {
|
|||||||
export NODE_ENV=development
|
export NODE_ENV=development
|
||||||
|
|
||||||
# Run npm install to get ALL dependencies including devDependencies
|
# Run npm install to get ALL dependencies including devDependencies
|
||||||
if ! npm install --include=dev > "$npm_log" 2>&1; then
|
if ! npm install --include=dev >"$npm_log" 2>&1; then
|
||||||
log_error "Failed to install dependencies"
|
log_error "Failed to install dependencies"
|
||||||
log_error "npm install output (last 30 lines):"
|
log_error "npm install output (last 30 lines):"
|
||||||
tail -30 "$npm_log" | while read -r line; do
|
tail -30 "$npm_log" | while read -r line; do
|
||||||
@@ -669,7 +674,7 @@ install_and_build() {
|
|||||||
|
|
||||||
# Generate Prisma client
|
# Generate Prisma client
|
||||||
log "Generating Prisma client..."
|
log "Generating Prisma client..."
|
||||||
if ! npx prisma generate > "$npm_log" 2>&1; then
|
if ! npx prisma generate >"$npm_log" 2>&1; then
|
||||||
log_error "Failed to generate Prisma client"
|
log_error "Failed to generate Prisma client"
|
||||||
log_error "Prisma generate output:"
|
log_error "Prisma generate output:"
|
||||||
cat "$npm_log" | while read -r line; do
|
cat "$npm_log" | while read -r line; do
|
||||||
@@ -691,7 +696,7 @@ install_and_build() {
|
|||||||
|
|
||||||
# Run Prisma migrations
|
# Run Prisma migrations
|
||||||
log "Running Prisma migrations..."
|
log "Running Prisma migrations..."
|
||||||
if ! npx prisma migrate deploy > "$npm_log" 2>&1; then
|
if ! npx prisma migrate deploy >"$npm_log" 2>&1; then
|
||||||
log_warning "Prisma migrations failed or no migrations to run"
|
log_warning "Prisma migrations failed or no migrations to run"
|
||||||
log "Prisma migrate output:"
|
log "Prisma migrate output:"
|
||||||
cat "$npm_log" | while read -r line; do
|
cat "$npm_log" | while read -r line; do
|
||||||
@@ -705,11 +710,14 @@ install_and_build() {
|
|||||||
log "Building application..."
|
log "Building application..."
|
||||||
# Set NODE_ENV to production for build
|
# Set NODE_ENV to production for build
|
||||||
export NODE_ENV=production
|
export NODE_ENV=production
|
||||||
|
# Unset TURBOPACK to prevent "Multiple bundler flags" error with --webpack
|
||||||
|
unset TURBOPACK 2>/dev/null || true
|
||||||
|
export TURBOPACK=''
|
||||||
|
|
||||||
# Create temporary file for npm build output
|
# Create temporary file for npm build output
|
||||||
local build_log="/tmp/npm_build_$$.log"
|
local build_log="/tmp/npm_build_$$.log"
|
||||||
|
|
||||||
if ! npm run build > "$build_log" 2>&1; then
|
if ! TURBOPACK='' npm run build >"$build_log" 2>&1; then
|
||||||
log_error "Failed to build application"
|
log_error "Failed to build application"
|
||||||
log_error "npm run build output:"
|
log_error "npm run build output:"
|
||||||
cat "$build_log" | while read -r line; do
|
cat "$build_log" | while read -r line; do
|
||||||
@@ -763,7 +771,7 @@ start_with_npm() {
|
|||||||
log "Starting application with npm start..."
|
log "Starting application with npm start..."
|
||||||
|
|
||||||
# Start in background
|
# Start in background
|
||||||
nohup npm start > server.log 2>&1 &
|
nohup npm start >server.log 2>&1 &
|
||||||
local npm_pid=$!
|
local npm_pid=$!
|
||||||
|
|
||||||
# Wait a moment and check if it started
|
# Wait a moment and check if it started
|
||||||
@@ -776,6 +784,23 @@ start_with_npm() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Re-enable the systemd service on failure to prevent users from being locked out
|
||||||
|
re_enable_service_on_failure() {
|
||||||
|
if check_service; then
|
||||||
|
log "Re-enabling systemd service after failure..."
|
||||||
|
if systemctl enable pvescriptslocal.service 2>/dev/null; then
|
||||||
|
log_success "Service re-enabled"
|
||||||
|
if systemctl start pvescriptslocal.service 2>/dev/null; then
|
||||||
|
log_success "Service started"
|
||||||
|
else
|
||||||
|
log_warning "Failed to start service - manual intervention may be required"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log_warning "Failed to re-enable service - manual intervention may be required"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Rollback function
|
# Rollback function
|
||||||
rollback() {
|
rollback() {
|
||||||
log_warning "Rolling back to previous version..."
|
log_warning "Rolling back to previous version..."
|
||||||
@@ -847,6 +872,9 @@ rollback() {
|
|||||||
log_error "No backup directory found for rollback"
|
log_error "No backup directory found for rollback"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Re-enable the service so users aren't locked out
|
||||||
|
re_enable_service_on_failure
|
||||||
|
|
||||||
log_error "Update failed. Please check the logs and try again."
|
log_error "Update failed. Please check the logs and try again."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@@ -865,14 +893,14 @@ check_node_version() {
|
|||||||
|
|
||||||
log "Detected Node.js version: $current"
|
log "Detected Node.js version: $current"
|
||||||
|
|
||||||
if (( major_version < 24 )); then
|
if ((major_version == 24)); then
|
||||||
|
log_success "Node.js 24 already installed"
|
||||||
|
elif ((major_version < 24)); then
|
||||||
log_warning "Node.js < 24 detected → upgrading to Node.js 24 LTS..."
|
log_warning "Node.js < 24 detected → upgrading to Node.js 24 LTS..."
|
||||||
upgrade_node_to_24
|
upgrade_node_to_24
|
||||||
elif (( major_version > 24 )); then
|
else
|
||||||
log_warning "Node.js > 24 detected → script tested only up to Node 24"
|
log_warning "Node.js > 24 detected → script tested only up to Node 24"
|
||||||
log "Continuing anyway…"
|
log "Continuing anyway…"
|
||||||
else
|
|
||||||
log_success "Node.js 24 already installed"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -880,22 +908,39 @@ check_node_version() {
|
|||||||
upgrade_node_to_24() {
|
upgrade_node_to_24() {
|
||||||
log "Preparing Node.js 24 upgrade…"
|
log "Preparing Node.js 24 upgrade…"
|
||||||
|
|
||||||
# Remove old nodesource repo if it exists
|
# Remove old nodesource repo files if they exist
|
||||||
if [ -f /etc/apt/sources.list.d/nodesource.list ]; then
|
if [ -f /etc/apt/sources.list.d/nodesource.list ]; then
|
||||||
|
log "Removing old nodesource.list file..."
|
||||||
rm -f /etc/apt/sources.list.d/nodesource.list
|
rm -f /etc/apt/sources.list.d/nodesource.list
|
||||||
fi
|
fi
|
||||||
|
if [ -f /etc/apt/sources.list.d/nodesource.sources ]; then
|
||||||
|
log "Removing old nodesource.sources file..."
|
||||||
|
rm -f /etc/apt/sources.list.d/nodesource.sources
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update apt cache first
|
||||||
|
log "Updating apt cache..."
|
||||||
|
apt-get update >>"$LOG_FILE" 2>&1 || true
|
||||||
|
|
||||||
# Install NodeSource repo for Node.js 24
|
# Install NodeSource repo for Node.js 24
|
||||||
curl -fsSL https://deb.nodesource.com/setup_24.x -o /tmp/node24_setup.sh
|
log "Downloading Node.js 24 setup script..."
|
||||||
if ! bash /tmp/node24_setup.sh > /tmp/node24_setup.log 2>&1; then
|
if ! curl -fsSL https://deb.nodesource.com/setup_24.x -o /tmp/node24_setup.sh; then
|
||||||
|
log_error "Failed to download Node.js 24 setup script"
|
||||||
|
re_enable_service_on_failure
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! bash /tmp/node24_setup.sh >/tmp/node24_setup.log 2>&1; then
|
||||||
log_error "Failed to configure Node.js 24 repository"
|
log_error "Failed to configure Node.js 24 repository"
|
||||||
tail -20 /tmp/node24_setup.log | while read -r line; do log_error "$line"; done
|
tail -20 /tmp/node24_setup.log | while read -r line; do log_error "$line"; done
|
||||||
|
re_enable_service_on_failure
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Installing Node.js 24…"
|
log "Installing Node.js 24…"
|
||||||
if ! apt-get install -y nodejs >> "$LOG_FILE" 2>&1; then
|
if ! apt-get install -y nodejs >>"$LOG_FILE" 2>&1; then
|
||||||
log_error "Failed to install Node.js 24"
|
log_error "Failed to install Node.js 24"
|
||||||
|
re_enable_service_on_failure
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -970,9 +1015,6 @@ main() {
|
|||||||
# Check Node.js version
|
# Check Node.js version
|
||||||
check_node_version
|
check_node_version
|
||||||
|
|
||||||
#Update Node.js to 24
|
|
||||||
upgrade_node_to_24
|
|
||||||
|
|
||||||
# Download and extract release
|
# Download and extract release
|
||||||
local source_dir
|
local source_dir
|
||||||
source_dir=$(download_release "$release_info")
|
source_dir=$(download_release "$release_info")
|
||||||
|
|||||||
Reference in New Issue
Block a user