Files
Convoy_panel/install_convoy.sh
2026-02-07 00:55:33 -08:00

113 lines
2.3 KiB
Bash
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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"