mirror of
https://github.com/ShaYmez/hblink3-docker-install.git
synced 2025-12-22 21:49:50 +13:00
Merge pull request #15 from ShaYmez/copilot/update-installer-for-docker
Modernize installer: Docker Compose v2, Ubuntu support, unified approach
This commit is contained in:
commit
ac22b3dd4a
34
README.md
34
README.md
@ -1,9 +1,11 @@
|
|||||||
# HBlink3 Docker Installer
|
# HBlink3 Docker Installer
|
||||||
**Version 1.5.0** - Debian 10 / 11 / 12 / 13 (Trixie) Support!!
|
**Version 1.5.0** - Debian 11 / 12 / 13 and Ubuntu 22.04 / 24.04 LTS Support!!
|
||||||
=======
|
=======
|
||||||
This is a multi-arch docker installer for HBlink3 and HBmonV2 combined for Debian 10, 11, 12, and 13 (Trixie).
|
This is a multi-arch docker installer for HBlink3 and HBmonV2 combined for Debian 11, 12, 13 and Ubuntu 22.04, 24.04 LTS.
|
||||||
|
|
||||||
**Note:** Debian 12 (Bookworm) and 13 (Trixie) support has been added with proper PEP 668 compliant Python package management using virtual environments, and docker-compose compatibility. HBMonv2 now runs in an isolated Python virtual environment on Debian 12+. See [CHANGELOG.md](CHANGELOG.md) for version history and updates.
|
**Important:** This installer requires Docker Compose v2 (provided by the docker-compose-plugin package). The legacy docker-compose v1 standalone package is not supported. The installer automatically installs Docker Engine and Docker Compose v2 from the official Docker repositories.
|
||||||
|
|
||||||
|
**Note:** Debian 12 (Bookworm) and 13 (Trixie) along with Ubuntu 22.04 and 24.04 LTS are fully supported with proper PEP 668 compliant Python package management using virtual environments. HBMonv2 now runs in an isolated Python virtual environment. See [CHANGELOG.md](CHANGELOG.md) for version history and updates.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -12,7 +14,7 @@ This is a multi-arch docker installer for HBlink3 and HBmonV2 combined for Debia
|
|||||||
Parrot is built into this install (Default disabled, see below how to enable the parrot feature!
|
Parrot is built into this install (Default disabled, see below how to enable the parrot feature!
|
||||||
|
|
||||||
### Destructive Installer
|
### Destructive Installer
|
||||||
This is a destructive installer and is recommended to be built on a freshly installed machine running Debian 10, 11, 12, or 13 (Trixie).
|
This is a destructive installer and is recommended to be built on a freshly installed machine running Debian 11, 12, 13 or Ubuntu 22.04, 24.04 LTS.
|
||||||
|
|
||||||
### Docker Multi-Arch build
|
### Docker Multi-Arch build
|
||||||
Docker container pre-built for multi-arch!
|
Docker container pre-built for multi-arch!
|
||||||
@ -29,7 +31,9 @@ This installer includes all the usual libs and packages including docker, apache
|
|||||||
install this on a 'clean machine'. The script is destructive and is not designed to be used on an exisiting machine that has other software on it! YOU HAVE BEEN WARNED!
|
install this on a 'clean machine'. The script is destructive and is not designed to be used on an exisiting machine that has other software on it! YOU HAVE BEEN WARNED!
|
||||||
|
|
||||||
### Prerequisite
|
### Prerequisite
|
||||||
The host system must be running Debian 10, 11, 12, or 13 (Trixie). The installer has been tested on these Debian versions and works on most architectures. The system requires, at a minimum; 1 core, 512mb of ram, the required spec to run docker and additional processes! The system must be up-to-date and have Git installed. You can install Git from the CLI.
|
The host system must be running Debian 11, 12, 13 or Ubuntu 22.04, 24.04 LTS. **Debian 10 and Ubuntu 20.04 are no longer supported** due to the requirement for Docker Compose v2 and modern Python package management. The installer has been tested on these OS versions and works on most architectures. The system requires, at a minimum; 1 core, 512mb of ram, the required spec to run docker and additional processes! The system must be up-to-date and have Git installed. You can install Git from the CLI.
|
||||||
|
|
||||||
|
**Docker Compose v2:** This installer exclusively uses Docker Compose v2 from the official Docker repositories. The docker-compose-plugin package is automatically installed, providing the `docker compose` command (note the space). A compatibility wrapper is also created to support the legacy `docker-compose` command (with hyphen) for backward compatibility with existing scripts.
|
||||||
|
|
||||||
Note* If you get Locale error(s) (LC_CTYPE=UTF-8, which is wrong) can happen when you login over ssh from a Mac to a linux box, and your terminal automatically sets environment variables. There's a checkbox for that. Uncheck it, and you're good to go.
|
Note* If you get Locale error(s) (LC_CTYPE=UTF-8, which is wrong) can happen when you login over ssh from a Mac to a linux box, and your terminal automatically sets environment variables. There's a checkbox for that. Uncheck it, and you're good to go.
|
||||||
|
|
||||||
@ -38,7 +42,7 @@ Make sure your system is up-to-date and pull Git from the apt repo.
|
|||||||
apt-get install -y git
|
apt-get install -y git
|
||||||
```
|
```
|
||||||
### Installation
|
### Installation
|
||||||
1. Preferably a clean Debian 10, 11, 12, or 13 (Trixie) system. Make sure your system is up to date with the latest apt repository database. You must be super user "root" to run this installer successfully.
|
1. Preferably a clean Debian 11, 12, 13 or Ubuntu 22.04, 24.04 LTS system. **Debian 10 and Ubuntu 20.04 are no longer supported.** Make sure your system is up to date with the latest apt repository database. You must be super user "root" to run this installer successfully.
|
||||||
```sh
|
```sh
|
||||||
apt update
|
apt update
|
||||||
sudo su
|
sudo su
|
||||||
@ -105,15 +109,15 @@ The uninstall script will:
|
|||||||
```sh
|
```sh
|
||||||
cd /etc/hblink3
|
cd /etc/hblink3
|
||||||
```
|
```
|
||||||
10. You can only interact with HBlink3 in this directory. Use the following commands to interact with the installation. We use
|
10. You can only interact with HBlink3 in this directory. Use the following commands to interact with the installation. This installer uses Docker Compose v2 (docker-compose-plugin):
|
||||||
docker-compose to run the docker container!
|
|
||||||
```sh
|
```sh
|
||||||
docker-compose up -d
|
docker compose up -d # Start containers (Docker Compose v2)
|
||||||
docker-compose down
|
docker compose down # Stop containers
|
||||||
docker-compose restart
|
docker compose restart # Restart containers
|
||||||
docker-compose pull
|
docker compose pull # Update images
|
||||||
sudo nano docker-compose.yml
|
sudo nano docker-compose.yml
|
||||||
```
|
```
|
||||||
|
**Note:** The legacy `docker-compose` command (with hyphen) also works via a compatibility wrapper that forwards to `docker compose`, but using `docker compose` (with space) is recommended as the official Docker Compose v2 syntax.
|
||||||
11. Edit your configuration before deployment!
|
11. Edit your configuration before deployment!
|
||||||
```sh
|
```sh
|
||||||
nano hblink.cfg
|
nano hblink.cfg
|
||||||
@ -142,15 +146,13 @@ Within this installation includes the new HBMonv2 by Weldek SP2ONG
|
|||||||
|
|
||||||
### Technical Details - Python Package Management
|
### Technical Details - Python Package Management
|
||||||
|
|
||||||
**Debian 12+ (Bookworm/Trixie):** The installer uses modern Python package management following PEP 668 standards:
|
The installer uses modern Python package management following PEP 668 standards for all supported OS versions:
|
||||||
- HBMonv2 runs in an isolated Python virtual environment at `/opt/HBMonv2/venv`
|
- HBMonv2 runs in an isolated Python virtual environment at `/opt/HBMonv2/venv`
|
||||||
- All Python dependencies are installed within this virtual environment, avoiding system-wide package conflicts
|
- All Python dependencies are installed within this virtual environment, avoiding system-wide package conflicts
|
||||||
- The systemd service automatically uses the virtual environment's Python interpreter
|
- The systemd service automatically uses the virtual environment's Python interpreter
|
||||||
- This approach eliminates "externally-managed-environment" errors and conflicts with system packages
|
- This approach eliminates "externally-managed-environment" errors and conflicts with system packages
|
||||||
|
|
||||||
**Debian 10-11:** Standard pip installation to system Python is used for backward compatibility.
|
This ensures clean, maintainable installations that follow modern Python best practices across all supported Debian and Ubuntu versions.
|
||||||
|
|
||||||
This ensures clean, maintainable installations that follow modern Python best practices while maintaining compatibility with older Debian versions.
|
|
||||||
|
|
||||||
## Easy Installation And Upgrade
|
## Easy Installation And Upgrade
|
||||||
The installation can be upgraded either by the use of a future scripts or by manually backing up your configuration and re-running the install script. Also the ability and really cool feature of docker-compose is that its easy to update the container with fresh images! Run by a simple command. Make sure you are in the /etc/hblink3 dir.
|
The installation can be upgraded either by the use of a future scripts or by manually backing up your configuration and re-running the install script. Also the ability and really cool feature of docker-compose is that its easy to update the container with fresh images! Run by a simple command. Make sure you are in the /etc/hblink3 dir.
|
||||||
|
|||||||
@ -22,18 +22,19 @@
|
|||||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
##################################################################################
|
##################################################################################
|
||||||
#
|
#
|
||||||
# A tool to install HBlink3 Docker with Debian 10-13 / Ubuntu 20.04 support.
|
# A tool to install HBlink3 Docker with Debian 11, 12, 13 and Ubuntu 22.04, 24.04 LTS support.
|
||||||
# This essentially is a HBlink3 server fully installed with dashboard ready to go.
|
# This essentially is a HBlink3 server fully installed with dashboard ready to go.
|
||||||
# Step 1: Install Debian 10, 11, 12, or 13 (Trixie) or Ubuntu 20.04 and make sure it has internet and is up to date.
|
# Step 1: Install Debian 11, 12, 13 or Ubuntu 22.04, 24.04 LTS and make sure it has internet and is up to date.
|
||||||
# Step 2: Run this script on the computer.
|
# Step 2: Run this script on the computer.
|
||||||
# Step 3: Reboot after installation.
|
# Step 3: Reboot after installation.
|
||||||
# This is a docker version and you can use the following comands to control / maintain your server
|
# This is a docker version and you can use the following commands to control / maintain your server
|
||||||
# cd /etc/hblink3
|
# cd /etc/hblink3
|
||||||
# docker-compose up -d (starts the hblink3 docker container)
|
# docker compose up -d (starts the hblink3 docker container) - Note: uses Docker Compose v2
|
||||||
# docker-compose down (shuts down the hblink container and stops the service)
|
# docker compose down (shuts down the hblink container and stops the service)
|
||||||
# docker-compose pull (updates the container to the latest docker image)
|
# docker compose pull (updates the container to the latest docker image)
|
||||||
|
# For backward compatibility, docker-compose (with hyphen) is also supported via a wrapper script
|
||||||
# systemctl |stop|start|restart|status hbmon (controls the HBMonv2 dash service)
|
# systemctl |stop|start|restart|status hbmon (controls the HBMonv2 dash service)
|
||||||
# logs can be found in var/log/hblink or docker comand "docker container logs hblink"
|
# logs can be found in var/log/hblink or docker command "docker container logs hblink"
|
||||||
#Lets begin-------------------------------------------------------------------------------------------------
|
#Lets begin-------------------------------------------------------------------------------------------------
|
||||||
if [ "$EUID" -ne 0 ];
|
if [ "$EUID" -ne 0 ];
|
||||||
then
|
then
|
||||||
@ -41,28 +42,57 @@ then
|
|||||||
echo "You Must be root to run this script!!"
|
echo "You Must be root to run this script!!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ ! -e "/etc/debian_version" ]
|
|
||||||
then
|
# Detect OS type and version
|
||||||
echo ""
|
if [ -f /etc/os-release ]; then
|
||||||
echo "This script is only tested in Debian 10, 11, 12 & 13 (Trixie)."
|
. /etc/os-release
|
||||||
exit 0
|
OS=$ID
|
||||||
|
OS_VERSION=$VERSION_ID
|
||||||
|
else
|
||||||
|
echo "ERROR: Cannot detect operating system"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check for supported OS
|
||||||
|
if [ "$OS" != "debian" ] && [ "$OS" != "ubuntu" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "ERROR: This script only supports Debian and Ubuntu distributions"
|
||||||
|
echo "Detected OS: $OS"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Validate Ubuntu versions
|
||||||
|
if [ "$OS" = "ubuntu" ]; then
|
||||||
|
if [ "$OS_VERSION" != "22.04" ] && [ "$OS_VERSION" != "24.04" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "ERROR: Only Ubuntu 22.04 LTS and 24.04 LTS are supported"
|
||||||
|
echo "Detected Ubuntu version: $OS_VERSION"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Detected: Ubuntu $OS_VERSION LTS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Validate Debian versions
|
||||||
|
if [ "$OS" = "debian" ]; then
|
||||||
|
VERSION=$(sed 's/\..*//' /etc/debian_version)
|
||||||
|
if [ "$VERSION" != "11" ] && [ "$VERSION" != "12" ] && [ "$VERSION" != "13" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "ERROR: Only Debian 11, 12, and 13 are supported"
|
||||||
|
echo "Detected Debian version: $VERSION"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Detected: Debian $VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
DIRDIR=$(pwd)
|
DIRDIR=$(pwd)
|
||||||
LOCAL_IP=$(ip a | grep inet | grep "eth0\|en" | awk '{print $2}' | tr '/' ' ' | awk '{print $1}')
|
LOCAL_IP=$(ip a | grep inet | grep "eth0\|en" | awk '{print $2}' | tr '/' ' ' | awk '{print $1}')
|
||||||
EXTERNAL_IP=$(curl -s --connect-timeout 5 https://ipecho.net/plain 2>/dev/null || echo "Unable to detect")
|
EXTERNAL_IP=$(curl -s --connect-timeout 5 https://ipecho.net/plain 2>/dev/null || echo "Unable to detect")
|
||||||
ARC=$(lscpu | grep Arch | awk '{print $2}')
|
ARC=$(lscpu | grep Arch | awk '{print $2}')
|
||||||
VERSION=$(sed 's/\..*//' /etc/debian_version)
|
|
||||||
ARMv7l=https://get.docker.com | sh
|
|
||||||
ARMv8l=https://get.docker.com | sh
|
|
||||||
X32=https://get.docker.com | sh
|
|
||||||
X64=https://get.docker.com | sh
|
|
||||||
INSDIR=/opt/tmp/
|
INSDIR=/opt/tmp/
|
||||||
HBLINKTMP=/opt/tmp/hblink3
|
HBLINKTMP=/opt/tmp/hblink3
|
||||||
HBMONDIR=/opt/HBMonv2/
|
HBMONDIR=/opt/HBMonv2/
|
||||||
HBDIR=/etc/hblink3/
|
HBDIR=/etc/hblink3/
|
||||||
DEP="wget curl git sudo python3 python3-dev python3-pip libffi-dev libssl-dev conntrack sed cargo apache2 php snapd figlet ca-certificates gnupg lsb-release"
|
DEP="wget curl git sudo python3 python3-dev python3-pip python3-venv libffi-dev libssl-dev conntrack sed cargo apache2 php snapd figlet ca-certificates gnupg lsb-release"
|
||||||
DEP1="wget curl git sudo python3 python3-dev python3-pip libffi-dev libssl-dev conntrack sed cargo apache2 php snapd figlet ca-certificates gnupg lsb-release"
|
|
||||||
DEP2="wget sudo curl git python3 python3-dev python3-pip libffi-dev libssl-dev conntrack sed cargo apache2 php php-mysqli snapd figlet ca-certificates gnupg lsb-release"
|
|
||||||
HBGITREPO=https://github.com/ShaYmez/hblink3.git
|
HBGITREPO=https://github.com/ShaYmez/hblink3.git
|
||||||
HBGITMONREPO=https://github.com/ShaYmez/HBMonv2.git
|
HBGITMONREPO=https://github.com/ShaYmez/HBMonv2.git
|
||||||
echo ""
|
echo ""
|
||||||
@ -71,47 +101,75 @@ echo "Downloading and installing required software & dependencies....."
|
|||||||
echo "------------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------------"
|
||||||
|
|
||||||
install_docker_and_dependencies() {
|
install_docker_and_dependencies() {
|
||||||
local version=$1
|
echo "Installing Docker and dependencies..."
|
||||||
echo "Detected Debian version: $version"
|
|
||||||
|
|
||||||
# Install base dependencies
|
# Install base dependencies (python3-venv is included for all versions for consistency)
|
||||||
|
echo "Installing dependencies..."
|
||||||
apt-get update
|
apt-get update
|
||||||
# For Debian 12+, add python3-venv to dependencies (PEP 668 compliance)
|
|
||||||
if [ $version -ge 12 ]; then
|
|
||||||
apt-get install -y $DEP python3-venv
|
|
||||||
else
|
|
||||||
apt-get install -y $DEP
|
apt-get install -y $DEP
|
||||||
fi
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# Remove old Docker versions if present
|
# Remove old Docker versions if present
|
||||||
apt-get remove docker docker-engine docker.io containerd runc 2>/dev/null || true
|
echo "Removing old Docker versions if present..."
|
||||||
|
apt-get remove docker docker-engine docker.io containerd runc docker-compose 2>/dev/null || true
|
||||||
|
|
||||||
|
# Determine Docker repository URL based on OS
|
||||||
|
if [ "$OS" = "ubuntu" ]; then
|
||||||
|
DOCKER_REPO_URL="https://download.docker.com/linux/ubuntu"
|
||||||
|
echo "Configuring Docker repository for Ubuntu..."
|
||||||
|
else
|
||||||
|
DOCKER_REPO_URL="https://download.docker.com/linux/debian"
|
||||||
|
echo "Configuring Docker repository for Debian..."
|
||||||
|
fi
|
||||||
|
|
||||||
# Add Docker GPG key
|
# Add Docker GPG key
|
||||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
echo "Adding Docker GPG key..."
|
||||||
|
curl -fsSL ${DOCKER_REPO_URL}/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
|
|
||||||
|
if [ ! -f /usr/share/keyrings/docker-archive-keyring.gpg ]; then
|
||||||
|
echo "ERROR: Failed to download Docker GPG key"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Add Docker repository
|
# Add Docker repository
|
||||||
|
echo "Adding Docker repository..."
|
||||||
echo \
|
echo \
|
||||||
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
|
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] ${DOCKER_REPO_URL} \
|
||||||
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
|
|
||||||
# Install Docker
|
# Install Docker Engine from official Docker repositories
|
||||||
|
echo "Installing Docker Engine from official Docker repositories..."
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y docker-ce docker-ce-cli containerd.io
|
if ! apt-get install -y docker-ce docker-ce-cli containerd.io; then
|
||||||
|
echo "ERROR: Failed to install Docker Engine"
|
||||||
|
echo "Please check your internet connection and Debian version compatibility"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Install docker-compose based on Debian version
|
# Verify Docker is installed
|
||||||
if [ $version -ge 12 ]; then
|
if ! command -v docker &> /dev/null; then
|
||||||
# For Debian 12+ use docker-compose-plugin or install from GitHub
|
echo "ERROR: Docker installation failed - docker command not found"
|
||||||
# Note: We prefer docker-compose-plugin from apt repos when available for security
|
exit 1
|
||||||
if apt-get install -y docker-compose-plugin 2>/dev/null; then
|
fi
|
||||||
echo "docker-compose-plugin installed successfully"
|
|
||||||
# Create wrapper script for docker-compose command compatibility
|
# Install Docker Compose v2 plugin from official Docker repositories
|
||||||
# docker-compose-plugin provides 'docker compose' but scripts use 'docker-compose'
|
echo "Installing Docker Compose v2 plugin from official Docker repositories..."
|
||||||
# Note: Using single quotes in heredoc ('EOF') prevents variable expansion for robustness
|
if ! apt-get install -y docker-compose-plugin; then
|
||||||
|
echo "ERROR: Failed to install docker-compose-plugin from Docker repositories"
|
||||||
|
echo "This installer only supports Docker Compose v2"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify Docker Compose v2 is installed
|
||||||
|
if ! docker compose version &> /dev/null; then
|
||||||
|
echo "ERROR: Docker Compose v2 installation failed - 'docker compose' command not working"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create wrapper script for backward compatibility with docker-compose command
|
||||||
|
# This allows existing scripts using 'docker-compose' to work with 'docker compose'
|
||||||
|
echo "Creating docker-compose wrapper for backward compatibility..."
|
||||||
if [ ! -f /usr/local/bin/docker-compose ]; then
|
if [ ! -f /usr/local/bin/docker-compose ]; then
|
||||||
echo "Creating docker-compose wrapper script..."
|
|
||||||
# Create wrapper that forwards all commands to 'docker compose'
|
|
||||||
# Exit on failure is intentional - without this wrapper, all control scripts will fail
|
|
||||||
if cat > /usr/local/bin/docker-compose << 'EOF'
|
if cat > /usr/local/bin/docker-compose << 'EOF'
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Wrapper script to provide docker-compose command using docker compose plugin
|
# Wrapper script to provide docker-compose command using docker compose plugin
|
||||||
@ -125,43 +183,63 @@ EOF
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Skip wrapper creation if docker-compose already exists
|
echo "docker-compose command already exists at /usr/local/bin/docker-compose"
|
||||||
# This preserves existing installations (from apt or manual install)
|
|
||||||
echo "docker-compose command already exists, skipping wrapper creation"
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "Installing docker-compose from GitHub releases..."
|
# Verify the wrapper works
|
||||||
# Fallback to GitHub releases for official Docker Compose binary
|
if ! /usr/local/bin/docker-compose version &> /dev/null; then
|
||||||
# Downloaded from official Docker GitHub repository over HTTPS
|
echo "ERROR: docker-compose wrapper verification failed"
|
||||||
curl -SL https://github.com/docker/compose/releases/latest/download/docker-compose-linux-$(uname -m) -o /usr/local/bin/docker-compose
|
exit 1
|
||||||
chmod +x /usr/local/bin/docker-compose
|
|
||||||
ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# For Debian 10-11 use apt package
|
|
||||||
apt-get install -y docker-compose
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable and start Docker
|
# Enable and start Docker
|
||||||
|
echo "Enabling and starting Docker service..."
|
||||||
systemctl enable docker
|
systemctl enable docker
|
||||||
systemctl start docker
|
systemctl start docker
|
||||||
|
|
||||||
|
# Verify Docker service is running
|
||||||
|
if ! systemctl is-active --quiet docker; then
|
||||||
|
echo "ERROR: Docker service failed to start"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
figlet "docker.io"
|
figlet "docker.io"
|
||||||
|
|
||||||
echo "Set userland-proxy to false..."
|
echo "Set userland-proxy to false..."
|
||||||
echo '{ "userland-proxy": false}' > /etc/docker/daemon.json
|
echo '{ "userland-proxy": false}' > /etc/docker/daemon.json
|
||||||
|
systemctl restart docker
|
||||||
|
sleep 2
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $VERSION = 10 ] || [ $VERSION = 11 ]; then
|
# Run Docker installation for supported OS versions
|
||||||
install_docker_and_dependencies $VERSION
|
if [ "$OS" = "debian" ]; then
|
||||||
|
if [ "$VERSION" = "11" ] || [ "$VERSION" = "12" ] || [ "$VERSION" = "13" ]; then
|
||||||
elif [ $VERSION = 12 ] || [ $VERSION = 13 ]; then
|
echo "Installing for Debian $VERSION with Docker Compose v2..."
|
||||||
# Debian 12 (Bookworm) and 13 (Trixie) support
|
install_docker_and_dependencies
|
||||||
echo "Installing for Debian $VERSION..."
|
elif [ "$VERSION" = "10" ]; then
|
||||||
install_docker_and_dependencies $VERSION
|
echo "ERROR: Debian 10 is no longer supported by this installer"
|
||||||
|
echo "This installer now requires Debian 11, 12, or 13 for Docker Compose v2 support"
|
||||||
|
echo "Please upgrade your system to Debian 11 or later"
|
||||||
|
exit 1
|
||||||
else
|
else
|
||||||
echo "-------------------------------------------------------------------------------------------"
|
echo "-------------------------------------------------------------------------------------------"
|
||||||
echo "Operating system not supported! Please check you are running Debian 10-13. Exiting....."
|
echo "Operating system not supported! Please check you are running Debian 11, 12, or 13. Exiting....."
|
||||||
|
echo "-------------------------------------------------------------------------------------------"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
elif [ "$OS" = "ubuntu" ]; then
|
||||||
|
if [ "$OS_VERSION" = "22.04" ] || [ "$OS_VERSION" = "24.04" ]; then
|
||||||
|
echo "Installing for Ubuntu $OS_VERSION LTS with Docker Compose v2..."
|
||||||
|
install_docker_and_dependencies
|
||||||
|
else
|
||||||
|
echo "-------------------------------------------------------------------------------------------"
|
||||||
|
echo "Operating system not supported! Please check you are running Ubuntu 22.04 or 24.04 LTS. Exiting....."
|
||||||
|
echo "-------------------------------------------------------------------------------------------"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "-------------------------------------------------------------------------------------------"
|
||||||
|
echo "Operating system not supported! Exiting....."
|
||||||
echo "-------------------------------------------------------------------------------------------"
|
echo "-------------------------------------------------------------------------------------------"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@ -235,12 +313,10 @@ echo "Installing HBMonv2 configuration....."
|
|||||||
echo "------------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------------"
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# Helper function to install pip packages with Debian 12+ compatibility
|
# Helper function to install pip packages in virtual environment
|
||||||
pip_install() {
|
pip_install() {
|
||||||
local args="$@"
|
local args="$@"
|
||||||
if [ $VERSION -ge 12 ]; then
|
echo "Installing Python packages: $args"
|
||||||
# For Debian 12+, use virtual environment (PEP 668 compliant)
|
|
||||||
echo "Installing Python packages for Debian $VERSION: $args"
|
|
||||||
if [ -z "$VIRTUAL_ENV" ]; then
|
if [ -z "$VIRTUAL_ENV" ]; then
|
||||||
echo "ERROR: Virtual environment not activated"
|
echo "ERROR: Virtual environment not activated"
|
||||||
return 1
|
return 1
|
||||||
@ -252,25 +328,13 @@ pip_install() {
|
|||||||
echo "ERROR: Failed to install: $args"
|
echo "ERROR: Failed to install: $args"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
# For Debian 10-11, use standard pip installation
|
|
||||||
echo "Installing Python packages for Debian $VERSION: $args"
|
|
||||||
if pip3 install $args; then
|
|
||||||
echo "Successfully installed: $args"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
echo "ERROR: Failed to install: $args"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Installing Python dependencies..."
|
echo "Installing Python dependencies..."
|
||||||
cd $HBMONDIR
|
cd $HBMONDIR
|
||||||
|
|
||||||
# For Debian 12+, create and use a virtual environment (modern PEP 668 compliant approach)
|
# Create and use a virtual environment (modern approach for all Debian versions)
|
||||||
if [ $VERSION -ge 12 ]; then
|
echo "Creating Python virtual environment..."
|
||||||
echo "Creating Python virtual environment for Debian $VERSION..."
|
|
||||||
|
|
||||||
# Create virtual environment
|
# Create virtual environment
|
||||||
if [ ! -d "$HBMONDIR/venv" ]; then
|
if [ ! -d "$HBMONDIR/venv" ]; then
|
||||||
@ -293,7 +357,6 @@ if [ $VERSION -ge 12 ]; then
|
|||||||
if ! pip3 install --upgrade pip; then
|
if ! pip3 install --upgrade pip; then
|
||||||
echo "WARNING: Failed to upgrade pip in virtual environment, continuing with existing version..."
|
echo "WARNING: Failed to upgrade pip in virtual environment, continuing with existing version..."
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Install setuptools and wheel first
|
# Install setuptools and wheel first
|
||||||
if ! pip_install setuptools wheel; then
|
if ! pip_install setuptools wheel; then
|
||||||
@ -374,8 +437,7 @@ LOG_NAME = 'hbmon.log'
|
|||||||
EOF
|
EOF
|
||||||
cp utils/hbmon.service /lib/systemd/system/
|
cp utils/hbmon.service /lib/systemd/system/
|
||||||
|
|
||||||
# For Debian 12+, update the service file to use virtual environment
|
# Update the service file to use virtual environment (for all Debian versions)
|
||||||
if [ $VERSION -ge 12 ]; then
|
|
||||||
echo "Updating hbmon.service to use virtual environment..."
|
echo "Updating hbmon.service to use virtual environment..."
|
||||||
# Update ExecStart to use venv Python (only if not already using venv)
|
# Update ExecStart to use venv Python (only if not already using venv)
|
||||||
if ! grep -q "$HBMONDIR/venv/bin/python3" /lib/systemd/system/hbmon.service; then
|
if ! grep -q "$HBMONDIR/venv/bin/python3" /lib/systemd/system/hbmon.service; then
|
||||||
@ -393,7 +455,6 @@ EOF
|
|||||||
else
|
else
|
||||||
echo "Service file already configured to use virtual environment"
|
echo "Service file already configured to use virtual environment"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
cp utils/lastheard /etc/cron.daily/
|
cp utils/lastheard /etc/cron.daily/
|
||||||
chmod +x /etc/cron.daily/lastheard
|
chmod +x /etc/cron.daily/lastheard
|
||||||
@ -896,6 +957,7 @@ figlet "WhipTAIL'"
|
|||||||
hblink-initial-setup
|
hblink-initial-setup
|
||||||
sleep 1
|
sleep 1
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
sleep 2
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
echo "*************************************************************************"
|
echo "*************************************************************************"
|
||||||
@ -919,7 +981,24 @@ echo " https://github.com/ShaYmez/hblink3-docker-install "
|
|||||||
echo ""
|
echo ""
|
||||||
echo " Your IP address is $LOCAL_IP "
|
echo " Your IP address is $LOCAL_IP "
|
||||||
echo ""
|
echo ""
|
||||||
echo " Your running on $ARC with Debian $VERSION "
|
if [ "$OS" = "ubuntu" ]; then
|
||||||
|
echo " You're running on $ARC with Ubuntu $OS_VERSION LTS "
|
||||||
|
else
|
||||||
|
echo " You're running on $ARC with Debian $VERSION "
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
echo "------------------------------------------------------------------------------"
|
||||||
|
echo " Installed Versions "
|
||||||
|
echo "------------------------------------------------------------------------------"
|
||||||
|
echo "Docker version:"
|
||||||
|
docker --version
|
||||||
|
echo ""
|
||||||
|
echo "Docker Compose version:"
|
||||||
|
docker compose version
|
||||||
|
echo ""
|
||||||
|
echo "Note: This installation uses Docker Compose v2 (docker compose command)"
|
||||||
|
echo " The legacy docker-compose v1 is not supported"
|
||||||
|
echo "------------------------------------------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
echo " Thanks for using this script. "
|
echo " Thanks for using this script. "
|
||||||
echo " Copyright © 2024 Shane Daley - M0VUB "
|
echo " Copyright © 2024 Shane Daley - M0VUB "
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user