refactor: simplify wizard and improve docker compose startup

- remove quick start mode from wizard, always show service selection
- add --wait flag to docker compose up for proper sequencing
- remove hardcoded time.sleep delays in favor of --wait
- clean up unused imports
This commit is contained in:
Yury Kossakovsky
2025-12-12 10:10:59 -07:00
parent 7645c02562
commit b62eefa4da
3 changed files with 12 additions and 62 deletions

View File

@@ -5,12 +5,8 @@
# Guides the user through selecting which services to install using whiptail.
#
# Features:
# - Quick Start mode: pre-configured set (n8n + monitoring + backups)
# - Custom mode: multi-screen selection grouped by category
# - Core Services (n8n, Flowise, Dify, etc.)
# - AI & ML Services (Ollama with CPU/GPU, ComfyUI, etc.)
# - Databases & Vector Stores (Qdrant, Weaviate, Neo4j, etc.)
# - Infrastructure & Monitoring (Grafana, Prometheus, Portainer, etc.)
# - Single-screen checklist for service selection
# - Default services: n8n, portainer, monitoring, postgresus
# - Preserves previously selected services on re-run
# - Updates COMPOSE_PROFILES in .env file
#
@@ -27,38 +23,6 @@ require_whiptail
# Set DEBIAN_FRONTEND for whiptail
save_debian_frontend
# --- Quick Start Pack Selection ---
# First screen: choose between Quick Start Pack or Custom Selection
PACK_CHOICE=$(whiptail --title "Installation Mode" --menu \
"Choose how you want to set up your services:\n\nQuick Start uses a recommended set of services.\nCustom lets you pick individual services." 15 70 2 \
"quick" "Quick Start (Recommended: n8n + monitoring + backups + management)" \
"custom" "Custom Selection (Choose individual services)" \
3>&1 1>&2 2>&3)
pack_exitstatus=$?
if [ $pack_exitstatus -ne 0 ]; then
log_info "Installation cancelled by user."
exit 0
fi
# If Quick Start is selected, set the Base Pack profiles and exit
if [ "$PACK_CHOICE" == "quick" ]; then
log_info "Quick Start Pack selected: n8n + monitoring + postgresus + portainer"
# Base Pack profiles
COMPOSE_PROFILES_VALUE="n8n,monitoring,postgresus,portainer"
# Update COMPOSE_PROFILES in .env
update_compose_profiles "$COMPOSE_PROFILES_VALUE"
log_info "The following Docker Compose profiles will be active: ${COMPOSE_PROFILES_VALUE}"
restore_debian_frontend
exit 0
fi
# --- Custom Selection Mode (existing logic) ---
# --- Read current COMPOSE_PROFILES from .env ---
CURRENT_PROFILES_VALUE=""
if [ -f "$ENV_FILE" ]; then

View File

@@ -10,10 +10,7 @@ so they appear together in Docker Desktop.
import os
import subprocess
import shutil
import time
import argparse
import platform
import sys
import yaml
from dotenv import dotenv_values
@@ -207,7 +204,7 @@ def start_supabase():
return
print("Starting Supabase services...")
run_command([
"docker", "compose", "-p", "localai", "-f", "supabase/docker/docker-compose.yml", "up", "-d"
"docker", "compose", "-p", "localai", "-f", "supabase/docker/docker-compose.yml", "up", "-d", "--wait"
])
def start_dify():
@@ -217,7 +214,7 @@ def start_dify():
return
print("Starting Dify services...")
run_command([
"docker", "compose", "-p", "localai", "-f", "dify/docker/docker-compose.yaml", "up", "-d"
"docker", "compose", "-p", "localai", "-f", "dify/docker/docker-compose.yaml", "up", "-d", "--wait"
])
def start_local_ai():
@@ -239,8 +236,9 @@ def start_local_ai():
# Now, start the services using the newly built images. No --build needed as we just built.
# Use --remove-orphans to clean up containers from profiles that are no longer active
# Use --wait to wait for containers to be healthy before returning
print("Starting containers...")
up_cmd = ["docker", "compose", "-p", "localai"] + compose_files + ["up", "-d", "--remove-orphans"]
up_cmd = ["docker", "compose", "-p", "localai"] + compose_files + ["up", "-d", "--remove-orphans", "--wait"]
run_command(up_cmd)
def generate_searxng_secret_key():
@@ -400,19 +398,13 @@ def main():
stop_existing_containers()
# Start Supabase first
# Start Supabase first (--wait flag ensures it's ready before continuing)
if is_supabase_enabled():
start_supabase()
# Give Supabase some time to initialize
print("Waiting for Supabase to initialize...")
time.sleep(10)
# Start Dify services
# Start Dify services (--wait flag ensures it's ready before continuing)
if is_dify_enabled():
start_dify()
# Give Dify some time to initialize
print("Waiting for Dify to initialize...")
time.sleep(10)
# Then start the local AI services
start_local_ai()

View File

@@ -134,15 +134,9 @@
</div>
<div class="bg-surface-100 rounded-xl border border-surface-400 p-6">
<p class="text-gray-300 mb-4">Keep your services up to date with the latest features and security patches:</p>
<div class="space-y-3">
<div class="flex items-start gap-3">
<code class="text-brand font-mono text-sm bg-surface-200 px-2 py-1 rounded">make update-preview</code>
<span class="text-gray-400 text-sm">Preview available updates before applying</span>
</div>
<div class="flex items-start gap-3">
<code class="text-brand font-mono text-sm bg-surface-200 px-2 py-1 rounded">make update</code>
<span class="text-gray-400 text-sm">Update all services to the latest versions</span>
</div>
<div class="flex items-start gap-3">
<code class="text-brand font-mono text-sm bg-surface-200 px-2 py-1 rounded">make update</code>
<span class="text-gray-400 text-sm">Update all services to the latest versions</span>
</div>
</div>
</section>