#!/bin/bash set -e ### BASIC CHECKS ### if [ "$EUID" -ne 0 ]; then echo "❌ Please run this script as root" exit 1 fi echo "🔍 Detecting Linux distribution..." if [ -f /etc/os-release ]; then . /etc/os-release else echo "❌ Cannot detect Linux distribution" exit 1 fi OS_ID="$ID" OS_VERSION="$VERSION_ID" echo "đŸ–Ĩī¸ Detected: $PRETTY_NAME" ### DETERMINE PACKAGE MANAGER ### case "$OS_ID" in ubuntu|debian) PM="apt" ;; almalinux|rocky|centos|rhel) PM="dnf" ;; *) echo "❌ Unsupported OS: $OS_ID" exit 1 ;; esac ### INSTALL DEPENDENCIES ### echo "đŸ“Ļ Installing base dependencies..." if [ "$PM" = "apt" ]; then apt update apt install -y \ ca-certificates \ curl \ gnupg \ lsb-release \ git elif [ "$PM" = "dnf" ]; then dnf install -y \ ca-certificates \ curl \ gnupg2 \ git fi ### INSTALL DOCKER ### if ! command -v docker >/dev/null 2>&1; then echo "đŸŗ Installing Docker..." curl -fsSL https://get.docker.com | sh else echo "✅ Docker already installed" fi systemctl enable docker systemctl start docker ### INSTALL DOCKER COMPOSE (PLUGIN) ### if ! docker compose version >/dev/null 2>&1; then echo "🔧 Installing Docker Compose plugin..." mkdir -p /usr/local/lib/docker/cli-plugins curl -SL https://github.com/docker/compose/releases/download/v2.25.0/docker-compose-linux-x86_64 \ -o /usr/local/lib/docker/cli-plugins/docker-compose chmod +x /usr/local/lib/docker/cli-plugins/docker-compose else echo "✅ Docker Compose already installed" fi ### INSTALL CONVOY ### echo "🚀 Installing Convoy Panel..." INSTALL_DIR="/opt/convoy" if [ -d "$INSTALL_DIR" ]; then echo "❌ $INSTALL_DIR already exists" exit 1 fi git clone https://github.com/convoypanel/convoy.git "$INSTALL_DIR" cd "$INSTALL_DIR" ### ENV SETUP ### if [ ! -f .env ]; then cp .env.example .env echo "📝 Created .env file" fi ### START SERVICES ### echo "âš™ī¸ Starting Convoy..." docker compose up -d ### DONE ### echo echo "✅ Convoy Panel installation complete!" echo "🌐 Access it via: http://YOUR_SERVER_IP" echo echo "â„šī¸ Edit configuration: $INSTALL_DIR/.env" echo "🔁 Restart: docker compose restart"