Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from docker-compose to docker compose #598

Merged
merged 6 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .dappnode_profile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ DNCORE_YMLS=$(find $DAPPNODE_CORE_DIR -name "docker-compose-*.yml" -printf "-f %
DNCORE_YMLS_ARRAY=($(find /usr/src/dappnode/DNCORE -name "docker-compose-*.yml" | sort))

# Returns docker core containers status
alias dappnode_status='docker-compose $DNCORE_YMLS ps'
alias dappnode_status='docker compose $DNCORE_YMLS ps'
# Stop docker core containers
alias dappnode_stop='docker-compose $DNCORE_YMLS stop && docker stop $(docker container ls -a -q -f name=DAppNode*)'
alias dappnode_stop='docker compose $DNCORE_YMLS stop && docker stop $(docker container ls -a -q -f name=DAppNode*)'
# Start docker core containers
alias dappnode_start='docker-compose $DNCORE_YMLS up -d && docker start $(docker container ls -a -q -f name=DAppNode*)'
alias dappnode_start='docker compose $DNCORE_YMLS up -d && docker start $(docker container ls -a -q -f name=DAppNode*)'
# Return open-vpn credentials from a specific user. e.g: dappnode_get dappnode_admin
alias dappnode_openvpn_get='docker exec -i DAppNodeCore-vpn.dnp.dappnode.eth vpncli get'
# Return open-vpn admin credentials
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ Install DAppNode on your host machine by burning DAppNode ISO to a DVD or creati
```bash
git clone https://github.com/dappnode/DAppNode.git
cd DAppNode
docker-compose build
docker-compose up
docker compose build
docker compose up
```

DAppNode iso will be generated inside images folder, to verify it:
Expand Down
2 changes: 1 addition & 1 deletion iso/scripts/generate_dappnode_iso_debian.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

# Source = https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.2.0-amd64-netinst.iso
# Source = https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.4.0-amd64-netinst.iso
ISO_NAME=debian-12.4.0-amd64-netinst.iso
ISO_PATH="/images/${ISO_NAME}"
ISO_URL=https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/
Expand Down
12 changes: 6 additions & 6 deletions iso/scripts/generate_docker_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,42 @@ echo "Downloading source code & building DNP_WIREGUARD..."
curl -LJO https://github.com/dappnode/DNP_WIREGUARD/archive/refs/tags/"v${WIREGUARD_VERSION}.tar.gz" || { echo "Failed to download DNP_WIREGUARD"; exit 1; }
mkdir DNP_WIREGUARD
tar -xzf "DNP_WIREGUARD-${WIREGUARD_VERSION}.tar.gz" -C ./DNP_WIREGUARD --strip-components=1 || { echo "Failed to extract DNP_WIREGUARD"; exit 1; }
docker-compose -f ./DNP_WIREGUARD/docker-compose.yml build || { echo "Failed to build DNP_WIREGUARD"; exit 1; }
docker compose -f ./DNP_WIREGUARD/docker-compose.yml build || { echo "Failed to build DNP_WIREGUARD"; exit 1; }
docker save wireguard.dnp.dappnode.eth:"${WIREGUARD_VERSION}" | xz -e9vT0 >/images/wireguard.dnp.dappnode.eth_"${WIREGUARD_VERSION}"_linux-amd64.txz || { echo "Failed to save DNP_WIREGUARD"; exit 1; }

echo "Downloading source code & building DNP_HTTPS..."
curl -LJO https://github.com/dappnode/DNP_HTTPS/archive/refs/tags/"v${HTTPS_VERSION}.tar.gz" || { echo "Failed to download DNP_HTTPS"; exit 1; }
mkdir DNP_HTTPS
tar -xzf "DNP_HTTPS-${HTTPS_VERSION}.tar.gz" -C ./DNP_HTTPS --strip-components=1 || { echo "Failed to extract DNP_HTTPS"; exit 1; }
docker-compose -f ./DNP_HTTPS/docker-compose.yml build || { echo "Failed to build DNP_HTTPS"; exit 1; }
docker compose -f ./DNP_HTTPS/docker-compose.yml build || { echo "Failed to build DNP_HTTPS"; exit 1; }
docker save https.dnp.dappnode.eth: "${HTTPS_VERSION}" | xz -e9vT0 >/images/https.dnp.dappnode.eth_"${HTTPS_VERSION}"_linux-amd64.txz || { echo "Failed to save DNP_HTTPS"; exit 1; }

echo "Downloading source code & building DNP_IPFS..."
curl -LJO https://github.com/dappnode/DNP_IPFS/archive/refs/tags/"v${IPFS_VERSION}.tar.gz" || { echo "Failed to download DNP_IPFS"; exit 1; }
mkdir DNP_IPFS
tar -xzf "DNP_IPFS-${IPFS_VERSION}.tar.gz" -C ./DNP_IPFS --strip-components=1 || { echo "Failed to extract DNP_IPFS"; exit 1; }
docker-compose -f ./DNP_IPFS/docker-compose.yml build || { echo "Failed to build DNP_IPFS"; exit 1; }
docker compose -f ./DNP_IPFS/docker-compose.yml build || { echo "Failed to build DNP_IPFS"; exit 1; }
docker save ipfs.dnp.dappnode.eth:"${IPFS_VERSION}" | xz -e9vT0 >/images/ipfs.dnp.dappnode.eth_"${IPFS_VERSION}"_linux-amd64.txz || { echo "Failed to save DNP_IPFS"; exit 1; }

echo "Downloading source code & building DNP_BIND..."
curl -LJO https://github.com/dappnode/DNP_BIND/archive/refs/tags/"v${BIND_VERSION}.tar.gz" || { echo "Failed to download DNP_BIND"; exit 1; }
mkdir DNP_BIND
tar -xzf "DNP_BIND-${BIND_VERSION}.tar.gz" -C ./DNP_BIND --strip-components=1 || { echo "Failed to extract DNP_BIND"; exit 1; }
docker-compose -f ./DNP_BIND/docker-compose.yml build || { echo "Failed to build DNP_BIND"; exit 1; }
docker compose -f ./DNP_BIND/docker-compose.yml build || { echo "Failed to build DNP_BIND"; exit 1; }
docker save bind.dnp.dappnode.eth:"${BIND_VERSION}" | xz -e9vT0 >/images/bind.dnp.dappnode.eth_"${BIND_VERSION}"_linux-amd64.txz || { echo "Failed to save DNP_BIND"; exit 1; }

echo "Downloading source code & building DNP_DAPPMANAGER..."
curl -LJO https://github.com/dappnode/DNP_DAPPMANAGER/archive/refs/tags/"v${DAPPMANAGER_VERSION}.tar.gz" || { echo "Failed to download DNP_DAPPMANAGER"; exit 1; }
mkdir DNP_DAPPMANAGER
tar -xzf "DNP_DAPPMANAGER-${DAPPMANAGER_VERSION}.tar.gz" -C ./DNP_DAPPMANAGER --strip-components=1 || { echo "Failed to extract DNP_DAPPMANAGER"; exit 1; }
docker-compose -f ./DNP_DAPPMANAGER/docker-compose.yml build || { echo "Failed to build DNP_DAPPMANAGER"; exit 1; }
docker compose -f ./DNP_DAPPMANAGER/docker-compose.yml build || { echo "Failed to build DNP_DAPPMANAGER"; exit 1; }
docker save dappmanager.dnp.dappnode.eth:"${DAPPMANAGER_VERSION}" | xz -e9vT0 >/images/dappmanager.dnp.dappnode.eth_"${DAPPMANAGER_VERSION}"_linux-amd64.txz || { echo "Failed to save DNP_DAPPMANAGER"; exit 1; }

echo "Downloading source code & building DNP_WIFI..."
curl -LJO https://github.com/dappnode/DNP_WIFI/archive/refs/tags/"v${WIFI_VERSION}.tar.gz" || { echo "Failed to download DNP_WIFI"; exit 1; }
mkdir DNP_WIFI
tar -xzf "DNP_WIFI-${WIFI_VERSION}.tar.gz" -C ./DNP_WIFI --strip-components=1 || { echo "Failed to extract DNP_WIFI"; exit 1; }
docker-compose -f ./DNP_WIFI/docker-compose.yml build || { echo "Failed to build DNP_WIFI"; exit 1; }
docker compose -f ./DNP_WIFI/docker-compose.yml build || { echo "Failed to build DNP_WIFI"; exit 1; }
docker save wifi.dnp.dappnode.eth:"${WIFI_VERSION}" | xz -e9vT0 >/images/wifi.dnp.dappnode.eth_"${WIFI_VERSION}"_linux-amd64.txz || { echo "Failed to save DNP_WIFI"; exit 1; }

echo "Coping dappnode_all_docker_images_linux-amd64.txz to dappnode dir..."
Expand Down
4 changes: 2 additions & 2 deletions scripts/dappnode_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ dappnode_core_build() {
# Change version in YAML to the custom one
DOCKER_VER=$(echo "${!ver##*:}" | sed 's/\//_/g')
sed -i "s~^\(\s*image\s*:\s*\).*~\1${comp,,}.dnp.dappnode.eth:${DOCKER_VER}~" DNP_"${comp}"/docker-compose.yml
docker-compose -f ./DNP_"${comp}"/docker-compose.yml build
docker compose -f ./DNP_"${comp}"/docker-compose.yml build
cp ./DNP_"${comp}"/docker-compose.yml "${DAPPNODE_CORE_DIR}"/docker-compose-"${comp,,}".yml
cp ./DNP_"${comp}"/dappnode_package.json "${DAPPNODE_CORE_DIR}"/dappnode_package-"${comp,,}".json
rm -r ./DNP_"${comp}"
Expand Down Expand Up @@ -225,7 +225,7 @@ dappnode_start() {
# Execute `compose-up` independently
# To execute `compose-up` against more than 1 compose, composes files must share compose file version (e.g 3.5)
for comp in "${DNCORE_YMLS_ARRAY[@]}"; do
docker-compose -f "$comp" up -d 2>&1 | tee -a $LOGFILE
docker compose -f "$comp" up -d 2>&1 | tee -a $LOGFILE
echo "${comp} started" 2>&1 | tee -a $LOGFILE
done
echo -e "\e[32mDAppNode started\e[0m" 2>&1 | tee -a $LOGFILE
Expand Down
27 changes: 10 additions & 17 deletions scripts/dappnode_install_pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ add_docker_repo() {
# DOCKER INSTALLATION
install_docker() {
apt-get update -y
apt-get install -y docker-ce docker-ce-cli containerd.io | tee -a $LOG_FILE
apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin | tee -a $LOG_FILE

# Ensure xz is installed
[ -f "/usr/bin/xz" ] || ( apt-get install -y xz-utils)
Expand All @@ -54,20 +54,13 @@ install_docker() {
fi
}

# DOCKER COMPOSE INSTALLATION
install_docker_compose() {
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
# Validate the installation of docker-compose
if docker-compose -v; then
echo -e "\e[32m \n\n Verified docker-compose installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
else
echo -e "\e[31m \n\n ERROR: docker-compose is not installed \n\n Please re-install it \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
exit 1
fi
fi
# DOCKER-COMPOSE FOR LEGACY SCRIPTS, SHOULD BE REMOVED EVENTUALLY
alias_docker_compose() {
cat > /usr/local/bin/docker-compose<<EOL
#!/bin/bash
docker compose "\$@"
EOL
chmod +x /usr/local/bin/docker-compose
}

# WIREGUARD INSTALLATION
Expand Down Expand Up @@ -145,9 +138,9 @@ 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 installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
echo -e "\e[32m \n\n docker-compose is already aliased \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
else
install_docker_compose 2>&1 | tee -a $LOG_FILE
alias_docker_compose 2>&1 | tee -a $LOG_FILE
fi

# Only install wireguard-dkms if needed
Expand Down
4 changes: 2 additions & 2 deletions scripts/dappnode_test_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ else
error_exit
fi

if docker-compose -v >/dev/null 2>&1; then
echo -e "\e[32m docker-compose installed ok\e[0m"
if docker compose -v >/dev/null 2>&1; then
echo -e "\e[32m docker compose installed ok\e[0m"
else
error_exit
fi
Expand Down
Loading