frappe_docker/production/scripts/stop.sh
duthink f167e83bda Add production environment configuration and deployment scripts for ERPNext
- Created example environment files for MariaDB and production settings.
- Implemented backup script for ERPNext sites with options for file inclusion, compression, and encryption.
- Developed site creation script to streamline ERPNext site setup with admin password handling.
- Added deployment script to manage the deployment of ERPNext, MariaDB, and Traefik services.
- Introduced log viewing script for monitoring ERPNext services.
- Implemented stop script to manage stopping of ERPNext and its dependencies.
- Added validation script to check environment configuration for common issues and security best practices.
2025-11-13 15:32:30 +05:30

68 lines
No EOL
1.7 KiB
Bash

#!/bin/bash
# Stop ERPNext Production Services
# Usage: ./stop.sh [--all]
set -e
# Colors
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; NC='\033[0m'
# Helpers
echo_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
echo_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
# Navigate to production directory
cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")")" || exit 1
PROJECT_ROOT="$(dirname "$(pwd)")"
# Check for help first
if [[ "${1:-}" == "-h" ]] || [[ "${1:-}" == "--help" ]]; then
cat << EOF
Usage: $0 [--all]
Options:
--all Stop ERPNext, MariaDB, and Traefik
-h, --help Show this help
Examples:
$0 # Stop ERPNext only (interactive)
$0 --all # Stop all services (no prompt)
EOF
exit 0
fi
# Stop service helper
stop_service() {
local name=$1 project=$2
shift 2
if docker ps | grep -q "$name"; then
echo_info "Stopping $name..."
docker compose --project-name "$project" "$@" down
echo_info "$name stopped"
else
echo_warn "$name not running"
fi
}
echo_info "Stopping ERPNext services..."
# Stop ERPNext
stop_service "erpnext-production" "erpnext-production" -f production.yaml
# Ask about stopping dependencies
STOP_ALL="${1:-}"
if [[ "$STOP_ALL" != "--all" ]]; then
read -p "Stop MariaDB and Traefik too? (yes/no): " STOP_ALL
fi
if [[ "$STOP_ALL" == "yes" ]] || [[ "$STOP_ALL" == "--all" ]]; then
stop_service "mariadb" "mariadb" --env-file mariadb.env -f "$PROJECT_ROOT/overrides/compose.mariadb-shared.yaml"
stop_service "traefik" "traefik" --env-file traefik.env -f "$PROJECT_ROOT/overrides/compose.traefik.yaml" -f "$PROJECT_ROOT/overrides/compose.traefik-ssl.yaml"
fi
echo ""
echo_info "✓ Services stopped. Restart: ./scripts/deploy.sh"