Skip to content

Commit

Permalink
Merge pull request #507 from dappnode/3alpha/move-docker-to-repo-install
Browse files Browse the repository at this point in the history
Move Docker install to Docker repo
  • Loading branch information
3alpha authored Nov 9, 2022
2 parents 579b12b + 1c6f545 commit 3e37742
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 91 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<p align="center">
<a href="https://install.dappnode.io">
Expand All @@ -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.

Expand Down Expand Up @@ -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:

Expand All @@ -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 fulfill the requirements by running the following script:

```bash
sudo wget -O - https://prerequisites.dappnode.io | sudo bash
Expand All @@ -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:
Uninstall DAppNode from your host machine by running the following command:

```bash
wget -qO - https://uninstaller.dappnode.io | sudo bash
Expand All @@ -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
Expand All @@ -206,15 +206,15 @@ 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

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/dappnode/DAppNode/tags).

## 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
Expand Down
2 changes: 0 additions & 2 deletions iso/preseeds/preseed.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions iso/preseeds/preseed_unattended.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 0 additions & 8 deletions iso/scripts/generate_dappnode_iso_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
92 changes: 24 additions & 68 deletions scripts/dappnode_install_pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,8 @@

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

Expand All @@ -31,48 +20,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"
Expand All @@ -91,18 +56,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
Expand All @@ -119,10 +73,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

Expand Down Expand Up @@ -170,7 +120,6 @@ detect_installation_type
# Ensure paths exist
mkdir -p $DAPPNODE_DIR
mkdir -p $LOGS_DIR
mkdir -p "$(dirname "$DOCKER_PATH")"

touch $LOG_FILE

Expand All @@ -180,6 +129,13 @@ 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
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
Expand Down

0 comments on commit 3e37742

Please sign in to comment.