Update installer to always use Docker Compose v2 for Debian 11-13

Co-authored-by: ShaYmez <76499782+ShaYmez@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-14 00:34:19 +00:00
parent 707813d5f9
commit 56237a8557
2 changed files with 113 additions and 68 deletions

View File

@ -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 (Trixie) 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, and 13 (Trixie).
**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) support has been added with proper PEP 668 compliant Python package management using virtual environments. HBMonv2 now runs in an isolated Python virtual environment on Debian 12+. See [CHANGELOG.md](CHANGELOG.md) for version history and updates.
![HBlink](img/HBLINK_logoV1.png "HBlink") ![HBlink](img/HBLINK_logoV1.png "HBlink")
@ -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, or 13 (Trixie). **Debian 10 is no longer supported** due to the requirement for Docker Compose v2. 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.
**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, or 13 (Trixie) system. **Debian 10 is 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

View File

@ -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, and 13 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, or 13 (Trixie) 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
@ -44,7 +45,7 @@ fi
if [ ! -e "/etc/debian_version" ] if [ ! -e "/etc/debian_version" ]
then then
echo "" echo ""
echo "This script is only tested in Debian 10, 11, 12 & 13 (Trixie)." echo "This script is only tested in Debian 11, 12 & 13 (Trixie)."
exit 0 exit 0
fi fi
DIRDIR=$(pwd) DIRDIR=$(pwd)
@ -85,33 +86,57 @@ install_docker_and_dependencies() {
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
# Add Docker GPG key # Add Docker GPG key
echo "Adding Docker GPG key..."
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg curl -fsSL https://download.docker.com/linux/debian/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] https://download.docker.com/linux/debian \
$(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,46 +150,48 @@ 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 if [ $VERSION = 11 ] || [ $VERSION = 12 ] || [ $VERSION = 13 ]; then
echo "Installing for Debian $VERSION with Docker Compose v2..."
install_docker_and_dependencies $VERSION install_docker_and_dependencies $VERSION
elif [ $VERSION = 10 ]; then
elif [ $VERSION = 12 ] || [ $VERSION = 13 ]; then echo "ERROR: Debian 10 is no longer supported by this installer"
# Debian 12 (Bookworm) and 13 (Trixie) support echo "This installer now requires Debian 11, 12, or 13 for Docker Compose v2 support"
echo "Installing for Debian $VERSION..." echo "Please upgrade your system to Debian 11 or later"
install_docker_and_dependencies $VERSION 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 "-------------------------------------------------------------------------------------------" echo "-------------------------------------------------------------------------------------------"
exit 0 exit 0
fi fi
echo "Done." echo "Done."
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
echo "Installing control scripts /usr/local/sbin....." echo "Installing control scripts /usr/local/sbin....."
@ -896,6 +923,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 "*************************************************************************"
@ -921,6 +949,19 @@ echo " Your IP address is $LOCAL_IP "
echo "" echo ""
echo " Your running on $ARC with Debian $VERSION " echo " Your running on $ARC with Debian $VERSION "
echo "" 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 " Thanks for using this script. " echo " Thanks for using this script. "
echo " Copyright © 2024 Shane Daley - M0VUB " echo " Copyright © 2024 Shane Daley - M0VUB "
echo " More information can be found @ https://github.com/shaymez/ " echo " More information can be found @ https://github.com/shaymez/ "