From fa7db0dc75645b25196fc022552dcbb944419161 Mon Sep 17 00:00:00 2001 From: zuohuadong Date: Wed, 2 Jul 2025 14:50:39 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"chore(setup)=EF=BC=9AIncrease=20inter?= =?UTF-8?q?active=20options"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0c861585ed6c123e94487bf25aead7bb02a3429e. --- packages/server/src/setup/server-setup.ts | 49 +---------------------- 1 file changed, 2 insertions(+), 47 deletions(-) diff --git a/packages/server/src/setup/server-setup.ts b/packages/server/src/setup/server-setup.ts index 5adcf0f38..bfd43bed3 100644 --- a/packages/server/src/setup/server-setup.ts +++ b/packages/server/src/setup/server-setup.ts @@ -75,10 +75,6 @@ SYS_ARCH=$(uname -m) CURRENT_USER=$USER echo "Installing requirements for: OS: $OS_TYPE" - -# Environment variables for automation: -# DOKPLOY_AUTO_SWAP=true - Automatically create swap file for low memory systems without prompting - if [ $EUID != 0 ]; then echo "Please run this script as root or with sudo ❌" exit @@ -643,7 +639,7 @@ const checkMemoryAndSetupSwap = () => ` echo " - Detected memory: ${MEMORY_MB}MB (${MEMORY_GB}GB)" - # If memory is less than 2GB (2048MB), offer to setup swap + # If memory is less than 2GB (2048MB), setup swap if [ "$MEMORY_MB" -lt 2048 ]; then echo " - Memory is less than 2GB, checking swap configuration..." @@ -653,48 +649,7 @@ const checkMemoryAndSetupSwap = () => ` if [ "$SWAP_TOTAL" -gt 0 ]; then echo " - Swap is already enabled (${SWAP_TOTAL}MB) ✅" else - echo " - No swap detected." - echo "" - echo "⚠️ WARNING: Your system has less than 2GB of memory (${MEMORY_MB}MB)." - echo " This may cause issues when building large applications or running multiple containers." - echo " It is recommended to enable swap to improve system stability." - echo "" - - # Check for non-interactive mode or environment variable - if [ "$DOKPLOY_AUTO_SWAP" = "true" ] || [ "$DOKPLOY_AUTO_SWAP" = "1" ]; then - echo " - Auto-swap mode enabled, creating swap file automatically..." - SWAP_CHOICE="y" - elif [ ! -t 0 ]; then - # Non-interactive mode (like CI/CD), default to yes - echo " - Non-interactive mode detected, creating swap file automatically..." - SWAP_CHOICE="y" - else - # Interactive prompt for swap setup - while true; do - echo -n "Would you like to create a 4GB swap file? [Y/n]: " - read -r SWAP_CHOICE - - # Default to yes if empty input - if [ -z "$SWAP_CHOICE" ]; then - SWAP_CHOICE="y" - fi - - case "$SWAP_CHOICE" in - [Yy]* ) - echo " - Setting up swap file..." - break - ;; - [Nn]* ) - echo " - Skipping swap setup. Continuing without swap." - echo " - ⚠️ Note: You may encounter memory issues during builds." - return 0 - ;; - * ) - echo " - Please answer yes (y) or no (n)." - ;; - esac - done - fi + echo " - No swap detected. Setting up swap file..." # Calculate swap size (4GB for systems with less than 2GB RAM) SWAP_SIZE="4G"