From a8161b16c8a170d63c3414db05f395944b6cee59 Mon Sep 17 00:00:00 2001 From: Luka Gulin Date: Sat, 29 Oct 2022 14:05:11 +0200 Subject: [PATCH 1/7] add docker repo --- scripts/dappnode_install_pre.sh | 91 +++++++++------------------------ 1 file changed, 24 insertions(+), 67 deletions(-) diff --git a/scripts/dappnode_install_pre.sh b/scripts/dappnode_install_pre.sh index 76e7374c..4951f771 100755 --- a/scripts/dappnode_install_pre.sh +++ b/scripts/dappnode_install_pre.sh @@ -4,19 +4,9 @@ DAPPNODE_DIR="/usr/src/dappnode" LOGS_DIR="$DAPPNODE_DIR/logs" -DOCKER_PKG="docker-ce_20.10.6~3-0~debian-bullseye_amd64.deb" -DOCKER_CLI_PKG="docker-ce-cli_20.10.6~3-0~debian-bullseye_amd64.deb" -CONTAINERD_PKG="containerd.io_1.4.4-1_amd64.deb" -DOCKER_REPO="https://download.docker.com/linux/debian/dists/bullseye/pool/stable/amd64" -DOCKER_PATH="${DAPPNODE_DIR}/bin/docker/${DOCKER_PKG}" -DOCKER_CLI_PATH="${DAPPNODE_DIR}/bin/docker/${DOCKER_CLI_PKG}" -CONTAINERD_PATH="${DAPPNODE_DIR}/bin/docker/${CONTAINERD_PKG}" -DCMP_PATH="/usr/local/bin/docker-compose" -DOCKER_URL="${DOCKER_REPO}/${DOCKER_PKG}" -DOCKER_CLI_URL="${DOCKER_REPO}/${DOCKER_CLI_PKG}" -CONTAINERD_URL="${DOCKER_REPO}/${CONTAINERD_PKG}" -DCMP_URL="https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-x86_64" WGET="wget -q --show-progress --progress=bar:force" +lsb_dist="$(. /etc/os-release && echo "$ID")" + #!ISOBUILD Do not modify, variables above imported for ISO build @@ -31,48 +21,24 @@ detect_installation_type() { fi } -# DOCKER INSTALLATION -install_docker() { - # STEP 0: Detect if it's a Debian 9 (stretch) or Debian 10 (Buster) installation - # ---------------------------------------- - if [ -f "/etc/os-release" ] && grep -q "buster" "/etc/os-release"; then - DOCKER_PKG="docker-ce_20.10.2~3-0~debian-buster_amd64.deb" - DOCKER_CLI_PKG="docker-ce-cli_20.10.2~3-0~debian-buster_amd64.deb" - CONTAINERD_PKG="containerd.io_1.4.3-1_amd64.deb" - DOCKER_REPO="https://download.docker.com/linux/debian/dists/buster/pool/stable/amd64" - DOCKER_PATH="${DAPPNODE_DIR}/bin/docker/${DOCKER_PKG}" - DOCKER_CLI_PATH="${DAPPNODE_DIR}/bin/docker/${DOCKER_CLI_PKG}" - CONTAINERD_PATH="${DAPPNODE_DIR}/bin/docker/${CONTAINERD_PKG}" - DOCKER_URL="${DOCKER_REPO}/${DOCKER_PKG}" - DOCKER_CLI_URL="${DOCKER_REPO}/${DOCKER_CLI_PKG}" - CONTAINERD_URL="${DOCKER_REPO}/${CONTAINERD_PKG}" - elif [ -f "/etc/os-release" ] && grep -q "stretch" "/etc/os-release"; then - DOCKER_PKG="docker-ce_19.03.8~3-0~debian-stretch_amd64.deb" - DOCKER_CLI_PKG="docker-ce-cli_19.03.8~3-0~debian-stretch_amd64.deb" - CONTAINERD_PKG="containerd.io_1.2.6-3_amd64.deb" - DOCKER_REPO="https://download.docker.com/linux/debian/dists/stretch/pool/stable/amd64" - DOCKER_PATH="${DAPPNODE_DIR}/bin/docker/${DOCKER_PKG}" - DOCKER_CLI_PATH="${DAPPNODE_DIR}/bin/docker/${DOCKER_CLI_PKG}" - CONTAINERD_PATH="${DAPPNODE_DIR}/bin/docker/${CONTAINERD_PKG}" - DOCKER_URL="${DOCKER_REPO}/${DOCKER_PKG}" - DOCKER_CLI_URL="${DOCKER_REPO}/${DOCKER_CLI_PKG}" - CONTAINERD_URL="${DOCKER_REPO}/${CONTAINERD_PKG}" - fi - # STEP 1: Download files - # ---------------------------------------- - [ -f $DOCKER_PATH ] || $WGET -O $DOCKER_PATH $DOCKER_URL - [ -f $DOCKER_CLI_PATH ] || $WGET -O $DOCKER_CLI_PATH $DOCKER_CLI_URL - [ -f $CONTAINERD_PATH ] || $WGET -O $CONTAINERD_PATH $CONTAINERD_URL +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 +} - # STEP 2: Install packages - # ---------------------------------------- - dpkg -i $CONTAINERD_PATH 2>&1 | tee -a $LOG_FILE - dpkg -i $DOCKER_CLI_PATH 2>&1 | tee -a $LOG_FILE - dpkg -i $DOCKER_PATH 2>&1 | tee -a $LOG_FILE +# DOCKER INSTALLATION +install_docker() { + apt-get update -y + 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 update -y && 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" @@ -91,18 +57,7 @@ install_docker() { # DOCKER COMPOSE INSTALLATION install_docker_compose() { - # STEP 0: Declare paths and directories - # ---------------------------------------- - - # Ensure paths exist - mkdir -p "$(dirname "$DCMP_PATH")" 2>&1 | tee -a $LOG_FILE - - # STEP 1: Download files - # ---------------------------------------- - - [ -f $DCMP_PATH ] || $WGET -O $DCMP_PATH $DCMP_URL - # Give permissions - chmod +x $DCMP_PATH 2>&1 | tee -a $LOG_FILE + apt-get install -y docker-compose | tee -a $LOG_FILE # Disable check if ISO installation since it is not possible to check in this way if [ "$ISO_INSTALLATION" = "false" ]; then @@ -119,10 +74,6 @@ install_docker_compose() { # WIREGUARD INSTALLATION install_wireguard_dkms() { apt-get update -y - if [ -f "/etc/os-release" ] && grep -q "buster" "/etc/os-release"; then - echo "deb http://deb.debian.org/debian/ buster-backports main" > /etc/apt/sources.list.d/buster-backports.list - printf 'Package: *\nPin: release a=buster-backports\nPin-Priority: 90\n' > /etc/apt/preferences.d/limit-backports - fi apt-get install wireguard-dkms -y | tee -a $LOG_FILE @@ -170,7 +121,6 @@ detect_installation_type # Ensure paths exist mkdir -p $DAPPNODE_DIR mkdir -p $LOGS_DIR -mkdir -p "$(dirname "$DOCKER_PATH")" touch $LOG_FILE @@ -180,6 +130,13 @@ if [ "$1" == "UPDATE" ]; then host_update 2>&1 | tee -a $LOG_FILE fi + +if [[ -n $(find /etc/apt/ -name "*.list" | xargs cat | grep "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 +fi + # Only install docker if needed if docker -v >/dev/null 2>&1; then echo -e "\e[32m \n\n docker is already installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE From 4241adc0094e5c29c8632248525938dfa1ddf7e0 Mon Sep 17 00:00:00 2001 From: Luka Gulin Date: Sat, 29 Oct 2022 14:13:19 +0200 Subject: [PATCH 2/7] Lint fix --- scripts/dappnode_install_pre.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/dappnode_install_pre.sh b/scripts/dappnode_install_pre.sh index 4951f771..c12d58c2 100755 --- a/scripts/dappnode_install_pre.sh +++ b/scripts/dappnode_install_pre.sh @@ -4,7 +4,6 @@ DAPPNODE_DIR="/usr/src/dappnode" LOGS_DIR="$DAPPNODE_DIR/logs" -WGET="wget -q --show-progress --progress=bar:force" lsb_dist="$(. /etc/os-release && echo "$ID")" @@ -27,7 +26,7 @@ add_docker_repo() { 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 + 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 } @@ -131,7 +130,7 @@ if [ "$1" == "UPDATE" ]; then fi -if [[ -n $(find /etc/apt/ -name "*.list" | xargs cat | grep "https://download.docker.com/linux/$lsb_dist") ]] ; then +if find /etc/apt/ -name "*.list" -print0 | xargs 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 From cecea413fa60c84b51734a31b75dc1b72f8e952e Mon Sep 17 00:00:00 2001 From: Luka Gulin Date: Sat, 29 Oct 2022 14:27:03 +0200 Subject: [PATCH 3/7] Remove package download from ISO --- iso/scripts/generate_dappnode_iso_debian.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/iso/scripts/generate_dappnode_iso_debian.sh b/iso/scripts/generate_dappnode_iso_debian.sh index 8323bfa1..fab03c1f 100755 --- a/iso/scripts/generate_dappnode_iso_debian.sh +++ b/iso/scripts/generate_dappnode_iso_debian.sh @@ -38,19 +38,11 @@ echo "Downloading third-party packages..." sed '1,/^\#\!ISOBUILD/!d' /usr/src/app/scripts/dappnode_install_pre.sh >/tmp/vars.sh # shellcheck disable=SC1091 source /tmp/vars.sh -mkdir -p /images/bin/docker -cd /images/bin/docker -[ -f "${DOCKER_PKG}" ] || wget "${DOCKER_URL}" -[ -f "${DOCKER_CLI_PKG}" ] || wget "${DOCKER_CLI_URL}" -[ -f "${CONTAINERD_PKG}" ] || wget "${CONTAINERD_URL}" -[ -f docker-compose-linux-x86_64 ] || wget "${DCMP_URL}" -cd - # /usr/src/app/dappnode-iso echo "Creating necessary directories and copying files..." mkdir -p /usr/src/app/dappnode-iso/dappnode cp -r /usr/src/app/scripts /usr/src/app/dappnode-iso/dappnode cp -r /usr/src/app/dappnode/* /usr/src/app/dappnode-iso/dappnode -cp -vr /images/bin /usr/src/app/dappnode-iso/dappnode/ echo "Customizing preseed..." mkdir -p /tmp/makeinitrd From 3b1fbf7b6c5a1917f57933998ae9a5e31b29d2c1 Mon Sep 17 00:00:00 2001 From: Luka Gulin Date: Sat, 29 Oct 2022 14:52:57 +0200 Subject: [PATCH 4/7] Update readme --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a260cf1e..af9b2707 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ Get your DAppNode and start contributing to decentralization by running your own ### Install DAppNode with ISO -DAppNode ISO available in: [latest DAppNode release](https://github.com/dappnode/DAppNode/releases) +DAppNode ISO available is in: [latest DAppNode release](https://github.com/dappnode/DAppNode/releases). Install DAppNode on your host machine by burning DAppNode ISO to a DVD or creating a bootable USB. Follow the tutorial of your operating system below and come back when you are finished: @@ -150,13 +150,13 @@ _Note_: ISO could be generated as unattended/attended by editing the env var ava ### Install DAppNode with scripts -Scripts available in: [latest DAppNode release](https://github.com/dappnode/DAppNode/releases) +Scripts are available in: [latest DAppNode release](https://github.com/dappnode/DAppNode/releases). -DAppNode could be also installed on a host machine with an OS already running on it. DAppNode has been developed and configured to be run on debian host machines so is preferably to install DAppNode on Debian or debian based (like Ubuntu) host machines. +DAppNode could be also installed on a host machine with an OS already running on it. DAppNode has been developed and configured to be run on Debian host machines. Therefore, it should work on Debian or Debian based (like Ubuntu) host machines. Minimum recommended Debian version is 11. -**1. Prerrequisites** +**1. Prerequisites** -Before install DAppNode with the script option, make sure you fullfill the requirements by running the following script: +Before installing DAppNode with the script option, make sure you fullfill the requirements by running the following script: ```bash sudo wget -O - https://prerequisites.dappnode.io | sudo bash @@ -172,7 +172,7 @@ sudo wget -O - https://installer.dappnode.io | sudo bash **3. Uninstall DAppNode** -Uinstall DAppNode on your host machine by running the following command: +Uinstall DAppNode from your host machine by running the following command: ```bash wget -qO - https://uninstaller.dappnode.io | sudo bash @@ -188,7 +188,7 @@ sudo wget -O - https://installer.dappnode.io | sudo UPDATE=true bash ## Releases -Create releases manually with github actions, the github action to run is: **Pre-release**. Requirements are: +Create releases manually with Github actions, the Github action to run is: **Pre-release**. The requirements are: - Introduce the core packages versions - There must exist the corresponding core package release for the specified version From d269fd127cfa78b6e46149cfbf527bb284be9682 Mon Sep 17 00:00:00 2001 From: Luka Gulin Date: Sat, 29 Oct 2022 14:57:12 +0200 Subject: [PATCH 5/7] Spelling --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index af9b2707..4c731030 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ DAppNode is empowering people by creating a simple, transparent system for hosti ## Discover DAppNode -DAppNode lowers the barrier of entry for non tech-savy participants. It allows you to deploy, update, and manage P2P clients and nodes without leaving your browser. No terminal or command line interface. +DAppNode lowers the barrier of entry for non tech-savvy participants. It allows you to deploy, update, and manage P2P clients and nodes without leaving your browser. No terminal or command line interface.

@@ -45,7 +45,7 @@ DAppNode lowers the barrier of entry for non tech-savy participants. It allows y ## Develop with DAppNode -DAppNode modular architecture allows any team to or project to publish a dockerized application to the DAppNode packages eco-system. Benefit from an enthusiatic crypto savy user based and offer a user interface-only experience to lower onboarding friction. +DAppNode modular architecture allows any team to or project to publish a dockerized application to the DAppNode packages eco-system. Benefit from an enthusiastic crypto savvy user based and offer a user interface-only experience to lower onboarding friction. Check out the [DAppNodeSDK](https://github.com/dappnode/DAppNodeSDK) to learn how to get started. @@ -156,7 +156,7 @@ DAppNode could be also installed on a host machine with an OS already running on **1. Prerequisites** -Before installing DAppNode with the script option, make sure you fullfill the requirements by running the following script: +Before installing DAppNode with the script option, make sure you fulfill the requirements by running the following script: ```bash sudo wget -O - https://prerequisites.dappnode.io | sudo bash @@ -172,7 +172,7 @@ sudo wget -O - https://installer.dappnode.io | sudo bash **3. Uninstall DAppNode** -Uinstall DAppNode from your host machine by running the following command: +Uninstall DAppNode from your host machine by running the following command: ```bash wget -qO - https://uninstaller.dappnode.io | sudo bash @@ -206,7 +206,7 @@ The release will contain: ## Testing with artifacts -Generate ISOs and test them by running the github action: **Artifacts**. This action will generate an artifacts with the same assets as the release, useful for testing purposes. +Generate ISOs and test them by running the Github action: **Artifacts**. This action will generate an artifacts with the same assets as the release, useful for testing purposes. ## Versioning @@ -214,7 +214,7 @@ We use [SemVer](http://semver.org/) for versioning. For the versions available, ## Team members -Members of the [White Hat Group (WHG)](https://motherboard.vice.com/en_us/article/qvp5b3/how-ethereum-coders-hacked-back-to-rescue-dollar208-million-in-ethereum) have spent countless hours boostraping and developing DAppNode in 2017. Currently, the project is mantained by a growing multi-disciplary team: +Members of the [White Hat Group (WHG)](https://motherboard.vice.com/en_us/article/qvp5b3/how-ethereum-coders-hacked-back-to-rescue-dollar208-million-in-ethereum) have spent countless hours bootstrapping and developing DAppNode in 2017. Currently, the project is maintained by a growing multi-disciplinary team: - **Adviser & Instigator:** Jordi Baylina - **Project Lead:** Eduadiez From b1b520fc60c28b3bb4fb866013d87ae1e3a1a7a6 Mon Sep 17 00:00:00 2001 From: Luka Gulin Date: Sat, 29 Oct 2022 17:51:06 +0200 Subject: [PATCH 6/7] Small Bug fix --- scripts/dappnode_install_pre.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dappnode_install_pre.sh b/scripts/dappnode_install_pre.sh index c12d58c2..7d744137 100755 --- a/scripts/dappnode_install_pre.sh +++ b/scripts/dappnode_install_pre.sh @@ -130,7 +130,7 @@ if [ "$1" == "UPDATE" ]; then fi -if find /etc/apt/ -name "*.list" -print0 | xargs 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 From 1c6f5453f51b2ed4df34a378be26d9259ef6ea8b Mon Sep 17 00:00:00 2001 From: Luka Gulin Date: Sun, 30 Oct 2022 08:41:37 +0100 Subject: [PATCH 7/7] Iso fix --- iso/preseeds/preseed.cfg | 2 -- iso/preseeds/preseed_unattended.cfg | 2 -- scripts/dappnode_install_pre.sh | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/iso/preseeds/preseed.cfg b/iso/preseeds/preseed.cfg index d7ff36cc..ef736a0f 100644 --- a/iso/preseeds/preseed.cfg +++ b/iso/preseeds/preseed.cfg @@ -35,10 +35,8 @@ d-i preseed/late_command string \ in-target mkdir -p /usr/src/dappnode; \ cp -ar /cdrom/dappnode/* /target/usr/src/dappnode/; \ cp -a /cdrom/dappnode/scripts/rc.local /target/etc/rc.local; \ - cp -a /cdrom/dappnode/bin/docker/docker-compose-Linux-x86_64 /target/usr/local/bin/docker-compose; \ in-target chmod +x /usr/src/dappnode/scripts/dappnode_install_pre.sh; \ in-target chmod +x /usr/src/dappnode/scripts/static_ip.sh; \ - in-target chmod +x /usr/local/bin/docker-compose; \ in-target gpasswd -a $(getent passwd "1000" | cut -d: -f1) sudo; \ /target/usr/src/dappnode/scripts/static_ip.sh; \ in-target /usr/src/dappnode/scripts/dappnode_install_pre.sh UPDATE diff --git a/iso/preseeds/preseed_unattended.cfg b/iso/preseeds/preseed_unattended.cfg index 11d41849..79ac3277 100644 --- a/iso/preseeds/preseed_unattended.cfg +++ b/iso/preseeds/preseed_unattended.cfg @@ -75,9 +75,7 @@ d-i preseed/late_command string \ cp -a /etc/network/interfaces /target/etc/network/interfaces; \ cp -ar /cdrom/dappnode/* /target/usr/src/dappnode/; \ cp -a /cdrom/dappnode/scripts/rc.local /target/etc/rc.local; \ - cp -a /cdrom/dappnode/bin/docker/docker-compose-Linux-x86_64 /target/usr/local/bin/docker-compose; \ in-target chmod +x /usr/src/dappnode/scripts/dappnode_install_pre.sh; \ - in-target chmod +x /usr/local/bin/docker-compose; \ in-target touch /usr/src/dappnode/.firstboot; \ in-target /usr/src/dappnode/scripts/dappnode_install_pre.sh UPDATE d-i finish-install/reboot_in_progress note diff --git a/scripts/dappnode_install_pre.sh b/scripts/dappnode_install_pre.sh index 7d744137..96654f94 100755 --- a/scripts/dappnode_install_pre.sh +++ b/scripts/dappnode_install_pre.sh @@ -23,7 +23,7 @@ detect_installation_type() { add_docker_repo() { apt-get update -y - apt-get remove -y docker docker-engine docker.io containerd runc | tee -a $LOG_FILE + 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