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

Update dncore_network to private subnet #602

Closed
wants to merge 3 commits into from
Closed
Changes from all 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
21 changes: 20 additions & 1 deletion scripts/dappnode_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ SWGET="wget -q -O-"
CONTENT_HASH_PKGS=(geth besu nethermind erigon prysm teku lighthouse nimbus lodestar)
ARCH=$(dpkg --print-architecture)
WELCOME_MESSAGE="\nChoose a way to connect to your DAppNode, then go to \e[1mhttp://my.dappnode\e[0m\n\n\e[1m- Wifi\e[0m\t\tScan and connect to DAppNodeWIFI. Get wifi credentials with \e[32mdappnode_wifi\e[0m\n\n\e[1m- Local Proxy\e[0m\tConnect to the same router as your DAppNode. Then go to \e[1mhttp://dappnode.local\e[0m\n\n\e[1m- Wireguard\e[0m\tDownload Wireguard app on your device. Get your dappnode wireguard credentials with \e[32mdappnode_wireguard\e[0m\n\n\e[1m- Open VPN\e[0m\tDownload OPen VPN app on your device. Get your openVPN creds with \e[32mdappnode_openvpn\e[0m\n\n\nTo see a full list of commands available execute \e[32mdappnode_help\e[0m\n"
# Network
SUBNET="10.20.0.0/24"

# Clean if update
if [ "$UPDATE" = true ]; then
Expand Down Expand Up @@ -317,8 +319,25 @@ if [ "$ARCH" == "amd64" ]; then
installExtraDpkg
fi

if [ -z "$(docker network ls | grep dncore_network)" ] && [ "$(docker network inspect dncore_network -f '{{range .IPAM.Config}}{{.Subnet}}{{end}}')" != "$SUBNET" ]; then
echo -e "\e[32mDisconnecting containers from dncore_network...\e[0m" 2>&1 | tee -a $LOGFILE
# Disconnect all containers from dncore_network and store them in a variable
CONTAINERS=$(docker network inspect dncore_network -f '{{range $key, $value := .Containers}}{{$key}} {{end}}')
for CONTAINER in $CONTAINERS; do
docker network disconnect dncore_network $CONTAINER 2>&1 | tee -a $LOGFILE
done
echo -e "\e[32mRemoving legacy dncore_network...\e[0m" 2>&1 | tee -a $LOGFILE
docker network rm dncore_network 2>&1 | tee -a $LOGFILE
fi
echo -e "\e[32mCreating dncore_network if needed...\e[0m" 2>&1 | tee -a $LOGFILE
docker network create --driver bridge --subnet 172.33.0.0/16 dncore_network 2>&1 | tee -a $LOGFILE
docker network create --driver bridge --subnet "${SUBNET}" dncore_network 2>&1 | tee -a $LOGFILE
# Connect all containers to dncore_network if any
if [ -n "$CONTAINERS" ]; then
echo -e "\e[32mConnecting containers to dncore_network...\e[0m" 2>&1 | tee -a $LOGFILE
for CONTAINER in $CONTAINERS; do
docker network connect dncore_network $CONTAINER 2>&1 | tee -a $LOGFILE
done
fi

echo -e "\e[32mBuilding DAppNode Core if needed...\e[0m" 2>&1 | tee -a $LOGFILE
dappnode_core_build
Expand Down
Loading