88 lines
3.2 KiB
Bash
Executable file
88 lines
3.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
source ./scripts/Unix/starter.sh
|
|
|
|
if [ ! -f .env ]; then
|
|
log_warning ".env file not found."
|
|
log_info "Run 'make generate-env' first to create your environment file."
|
|
exit 0
|
|
fi
|
|
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
# Installation type selection
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
echo
|
|
log_info "Select installation type:"
|
|
echo
|
|
echo " 1) Docker (recommended for development)"
|
|
echo " - Uses Docker Compose to run all services"
|
|
echo " - Includes database, Redis, Elasticsearch"
|
|
echo
|
|
echo " 2) Native Linux (production with systemd)"
|
|
echo " - Installs directly on your system"
|
|
echo " - Requires existing PostgreSQL, Redis, Elasticsearch"
|
|
echo " - Configures systemd services"
|
|
echo
|
|
|
|
if is_interactive; then
|
|
read -r -p "Choice [1/2]: " install_choice
|
|
else
|
|
# Non-interactive mode defaults to Docker
|
|
install_choice="1"
|
|
log_info "Non-interactive mode: defaulting to Docker installation"
|
|
fi
|
|
|
|
case "$install_choice" in
|
|
2)
|
|
log_step "Starting native Linux installation..."
|
|
source ./scripts/Unix/install-native.sh
|
|
;;
|
|
1|*)
|
|
# ─────────────────────────────────────────────────────────────────────────
|
|
# Docker installation (original behavior)
|
|
# ─────────────────────────────────────────────────────────────────────────
|
|
log_step "Starting Docker installation..."
|
|
|
|
# Check system requirements
|
|
if ! check_system_requirements 4 6 20; then
|
|
exit 1
|
|
fi
|
|
|
|
# Check Docker is available
|
|
if ! command_exists docker; then
|
|
log_error "Docker is not installed. Please install Docker first."
|
|
log_info "Visit: https://docs.docker.com/get-docker/"
|
|
exit 1
|
|
fi
|
|
|
|
if ! docker info >/dev/null 2>&1; then
|
|
log_error "Docker daemon is not running or you don't have permission."
|
|
log_info "Try: sudo systemctl start docker"
|
|
log_info "Or add yourself to the docker group: sudo usermod -aG docker \$USER"
|
|
exit 1
|
|
fi
|
|
|
|
# Pull Docker images
|
|
log_step "Pulling images..."
|
|
if ! output=$(docker compose pull --quiet 2>&1); then
|
|
log_error "Failed to pull Docker images"
|
|
echo "$output"
|
|
exit 1
|
|
fi
|
|
log_success "Images pulled successfully"
|
|
|
|
# Build Docker images
|
|
log_step "Building images..."
|
|
if ! output=$(docker compose build 2>&1); then
|
|
log_error "Failed to build Docker images"
|
|
echo "$output"
|
|
exit 1
|
|
fi
|
|
log_success "Images built successfully"
|
|
|
|
echo
|
|
log_result "Docker installation complete!"
|
|
log_info "You can now use: make run"
|
|
;;
|
|
esac
|