Skip to content

Commit

Permalink
use docker compose instead of docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
pablomendezroyo committed Sep 26, 2024
1 parent 198cf87 commit 79efe27
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 34 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ jobs:
- name: Build attended
run: |
sed -i -e "/UNATTENDED/s/true/false/" docker-compose.yml
docker-compose build
docker-compose up
docker compose build
docker compose up
# Verify ISO attended created
- name: Check iso attended
Expand All @@ -89,8 +89,8 @@ jobs:
- name: Build unattended
run: |
sed -i -e "/UNATTENDED/s/false/true/" docker-compose.yml
docker-compose build
docker-compose up
docker compose build
docker compose up
# Verify ISO unattended was created
- name: Check iso unattended
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ jobs:
- name: Build attended
run: |
sed -i -e "/UNATTENDED/s/true/false/" docker-compose.yml
docker-compose build
docker-compose up
docker compose build
docker compose up
# Verify ISO attended created
- name: Check iso attended
Expand All @@ -89,8 +89,8 @@ jobs:
- name: Build unattended
run: |
sed -i -e "/UNATTENDED/s/false/true/" docker-compose.yml
docker-compose build
docker-compose up
docker compose build
docker compose up
# Verify ISO unattended was created
- name: Check iso unattended
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM docker:dind
# hadolint ignore=DL3018
RUN apk update && \
apk add --no-cache xorriso git xz curl ca-certificates iptables cpio bash perl-utils \
docker-compose && \
rm -rf /var/cache/apk/*

#RUN apk add -U --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing aufs-util
Expand Down
47 changes: 22 additions & 25 deletions scripts/dappnode_install_pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ DAPPNODE_DIR="/usr/src/dappnode"
LOGS_DIR="$DAPPNODE_DIR/logs"
lsb_dist="$(. /etc/os-release && echo "$ID")"


#!ISOBUILD Do not modify, variables above imported for ISO build

detect_installation_type() {
Expand All @@ -20,24 +19,23 @@ detect_installation_type() {
fi
}


add_docker_repo() {
apt-get update -y
apt-get remove -y docker docker-engine docker.io containerd runc | tee -a $LOG_FILE
apt-get install -y ca-certificates curl gnupg lsb-release | tee -a $LOG_FILE
mkdir -p /etc/apt/keyrings && chmod -R 0755 /etc/apt/keyrings
curl -fsSL "https://download.docker.com/linux/${lsb_dist}/gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$lsb_dist $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$lsb_dist $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list >/dev/null
}

# DOCKER INSTALLATION
install_docker() {
apt-get update -y
apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin | tee -a $LOG_FILE
apt-get install -y docker-ce docker-ce-cli containerd.io | tee -a $LOG_FILE

# Ensure xz is installed
[ -f "/usr/bin/xz" ] || ( apt-get install -y xz-utils)
[ -f "/usr/bin/xz" ] || (apt-get install -y xz-utils)

USER=$(grep 1000 "/etc/passwd" | cut -f 1 -d:)
[ -z "$USER" ] || usermod -aG docker "$USER"
Expand All @@ -56,50 +54,50 @@ install_docker() {

# DOCKER-COMPOSE FOR LEGACY SCRIPTS, SHOULD BE REMOVED EVENTUALLY
alias_docker_compose() {
cat > /usr/local/bin/docker-compose<<EOL
cat >/usr/local/bin/docker-compose <<EOL
#!/bin/bash
docker compose "\$@"
EOL
chmod +x /usr/local/bin/docker-compose
}

# WIREGUARD INSTALLATION
# WIREGUARD INSTALLATION
install_wireguard_dkms() {
apt-get update -y

apt-get install wireguard-dkms -y | tee -a $LOG_FILE

if modprobe wireguard >/dev/null 2>&1 ; then
if modprobe wireguard >/dev/null 2>&1; then
echo -e "\e[32m \n\n Verified wiregurd-dkms installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
else
echo -e "\e[31m \n\n WARNING: wireguard kernel module is not installed, Wireguard DAppNode package might not work! \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
fi
}

# LSOF INSTALLATION: used to scan host port 80 in use, https package installation will deppend on it
# LSOF INSTALLATION: used to scan host port 80 in use, https package installation will deppend on it
install_lsof() {
apt-get update -y
apt-get install lsof -y | tee -a $LOG_FILE
if lsof -v >/dev/null 2>&1 ; then
if lsof -v >/dev/null 2>&1; then
echo -e "\e[32m \n\n Verified lsof installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
else
echo -e "\e[31m \n\n WARNING: lsof not installed, HTTPS DAppNode package might not be installed! \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
fi
}

# IPTABLES INSTALLATION: mandatory for docker, on bullseye is not installed by default
install_iptables () {
install_iptables() {
apt-get update -y
apt-get install iptables -y | tee -a $LOG_FILE
if iptables -v >/dev/null 2>&1 ; then
if iptables -v >/dev/null 2>&1; then
echo -e "\e[32m \n\n Verified iptables installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
else
echo -e "\e[31m \n\n WARNING: iptables not installed, Docker may not work! \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
fi
}

# HOST UPDATE
host_update () {
host_update() {
apt-get update 2>&1 | tee -a $LOG_FILE
apt-get -y upgrade 2>&1 | tee -a $LOG_FILE
}
Expand All @@ -122,8 +120,7 @@ if [ "$1" == "UPDATE" ]; then
host_update 2>&1 | tee -a $LOG_FILE
fi


if find /etc/apt/ -name "*.list" -print0 | xargs --null cat | grep -q "https://download.docker.com/linux/$lsb_dist" ; then
if find /etc/apt/ -name "*.list" -print0 | xargs --null cat | grep -q "https://download.docker.com/linux/$lsb_dist"; then
echo -e "\e[32m \n\n docker repo is already added \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
else
add_docker_repo | tee -a $LOG_FILE
Expand All @@ -136,15 +133,8 @@ else
install_docker 2>&1 | tee -a $LOG_FILE
fi

# Only install docker-compose if needed
if docker-compose -v >/dev/null 2>&1; then
echo -e "\e[32m \n\n docker-compose is already aliased \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
else
alias_docker_compose 2>&1 | tee -a $LOG_FILE
fi

# Only install wireguard-dkms if needed
if modprobe wireguard >/dev/null 2>&1 ; then
if modprobe wireguard >/dev/null 2>&1; then
echo -e "\e[32m \n\n wireguard-dkms is already installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
else
install_wireguard_dkms 2>&1 | tee -a $LOG_FILE
Expand All @@ -158,15 +148,22 @@ else
fi

#Check connectivity
{ [ -f /etc/network/interfaces ] && grep "iface en.* inet dhcp" /etc/network/interfaces &>/dev/null; } || { echo "Interfaces not found"; exit 1; }
{ [ -f /etc/network/interfaces ] && grep "iface en.* inet dhcp" /etc/network/interfaces &>/dev/null; } || {
echo "Interfaces not found"
exit 1
}

## Add missing interfaces
if [ -f /usr/src/dappnode/hotplug ]; then
# shellcheck disable=SC2013
for IFACE in $(grep "en.*" /usr/src/dappnode/hotplug); do
# shellcheck disable=SC2143
if [[ $(grep -L "$IFACE" /etc/network/interfaces) ]]; then
{ echo "# $IFACE"; echo "allow-hotplug $IFACE"; echo "iface $IFACE inet dhcp"; } >> /etc/network/interfaces
{
echo "# $IFACE"
echo "allow-hotplug $IFACE"
echo "iface $IFACE inet dhcp"
} >>/etc/network/interfaces
fi
done
fi

0 comments on commit 79efe27

Please sign in to comment.