Files
n8n-install/scripts/restart.sh
Yury Kossakovsky 58799d9ae1 refactor(compose): centralize external compose file handling
add build_compose_files_array() and getter functions for n8n-workers,
supabase, dify compose files in utils.sh. simplifies restart.sh and
apply_update.sh by using shared function. now checks both profile
activation AND file existence before including external compose files.
2025-12-29 13:06:03 -07:00

43 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# =============================================================================
# restart.sh - Restart all services
# =============================================================================
# Restarts all Docker Compose services including dynamically generated
# worker/runner compose files and external service stacks.
#
# Handles compose files via build_compose_files_array() from utils.sh:
# - docker-compose.yml (main)
# - docker-compose.n8n-workers.yml (if exists and n8n profile active)
# - supabase/docker/docker-compose.yml (if exists and supabase profile active)
# - dify/docker/docker-compose.yaml (if exists and dify profile active)
#
# Usage: bash scripts/restart.sh
# =============================================================================
set -e
# Source the utilities file and initialize paths
source "$(dirname "$0")/utils.sh"
init_paths
cd "$PROJECT_ROOT"
# Load environment to check active profiles
load_env
PROJECT_NAME="localai"
# Build compose files array (sets global COMPOSE_FILES)
build_compose_files_array
log_info "Restarting services..."
log_info "Using compose files: ${COMPOSE_FILES[*]}"
# Stop all services
docker compose -p "$PROJECT_NAME" "${COMPOSE_FILES[@]}" down
# Start all services
docker compose -p "$PROJECT_NAME" "${COMPOSE_FILES[@]}" up -d
log_success "Services restarted successfully!"