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

Sets PRIVATE_NETWORK_IP properly under MacOS #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 7 additions & 3 deletions bin/down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/bin/bash
basedir=$(dirname "$0")/..

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
IP_ADDR=$(ifconfig -l | xargs -n1 ipconfig getifaddr)
IP_ADDR=$(hostname -i | cut -f1)
elif [[ "$OSTYPE" == "darwin"* ]]; then
IP_ADDR=$(ip route get 1 | awk '{print $NF;exit}')
IP_ADDR=$(ipconfig getifaddr en1)
if [[ -z "$IP_ADDR" ]]; then
IP_ADDR=$(ipconfig getifaddr en0)
fi
fi
PRIVATE_NETWORK_IP=${ADDR} mutagen-compose -f "$basedir"/docker-compose.yml down
PRIVATE_NETWORK_IP=${IP_ADDR} mutagen-compose -f "$basedir"/docker-compose.yml down
22 changes: 16 additions & 6 deletions bin/init
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,36 @@ prefix='\n\033[1;37m'
suffix='\033[0m\n'

servicesdir=$basedir/services
echo -e ${prefix}Cloning source repositories$suffix
echo -e "${prefix}Cloning source repositories$suffix"
git clone https://github.com/Hubs-Foundation/reticulum.git "$servicesdir"/reticulum
git clone https://github.com/Hubs-Foundation/dialog.git "$servicesdir"/dialog
git clone https://github.com/Hubs-Foundation/hubs.git "$servicesdir"/hubs
git clone https://github.com/Hubs-Foundation/Spoke.git "$servicesdir"/spoke

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
IP_ADDR=$(hostname -i | cut -f1)
elif [[ "$OSTYPE" == "darwin"* ]]; then
IP_ADDR=$(ipconfig getifaddr en1)
if [[ -z "$IP_ADDR" ]]; then
IP_ADDR=$(ipconfig getifaddr en0)
fi
fi
export PRIVATE_NETWORK_IP=$IP_ADDR

composefile=$basedir/docker-compose.yml
echo -e ${prefix}Initializing Reticulum$suffix &&
echo -e "${prefix}Initializing Reticulum$suffix" &&
docker-compose -f "$composefile" build reticulum &&
mutagen-compose -f "$composefile" run --rm reticulum sh -c 'trapped-mix do deps.get, deps.compile, ecto.create' &&
echo -e ${prefix}Initializing Dialog$suffix &&
echo -e "${prefix}Initializing Dialog$suffix" &&
docker-compose -f "$composefile" build dialog &&
mutagen-compose -f "$composefile" run --rm dialog conditional-npm-ci &&
echo -e ${prefix}Initializing Hubs Admin$suffix &&
echo -e "${prefix}Initializing Hubs Admin$suffix" &&
docker-compose -f "$composefile" build hubs-admin &&
mutagen-compose -f "$composefile" run --rm hubs-admin conditional-npm-ci &&
echo -e ${prefix}Initializing Hubs Client$suffix &&
echo -e "${prefix}Initializing Hubs Client$suffix" &&
docker-compose -f "$composefile" build hubs-client &&
mutagen-compose -f "$composefile" run --rm hubs-client conditional-npm-ci &&
echo -e ${prefix}Initializing Spoke$suffix &&
echo -e "${prefix}Initializing Spoke$suffix" &&
mutagen-compose -f "$composefile" run --rm spoke yarn install

code=$?
Expand Down
10 changes: 10 additions & 0 deletions bin/reset
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/bin/bash
basedir=$(readlink -f "$(dirname "$0")"/..)

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
IP_ADDR=$(hostname -i | cut -f1)
elif [[ "$OSTYPE" == "darwin"* ]]; then
IP_ADDR=$(ipconfig getifaddr en1)
if [[ -z "$IP_ADDR" ]]; then
IP_ADDR=$(ipconfig getifaddr en0)
fi
fi
export PRIVATE_NETWORK_IP=$IP_ADDR

mutagen-compose -f "$basedir"/docker-compose.yml down --volumes --rmi local &&
rm -rf "$basedir"/services/reticulum/deps &&
"$basedir"/bin/init
9 changes: 6 additions & 3 deletions bin/up
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ echo -e ${prefix}The mutagen daemon will stay running until you stop it manually
echo -e ${prefix}Running mutagen-compose...$suffix

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
IP_ADDR=$(ifconfig -l | xargs -n1 ipconfig getifaddr)
IP_ADDR=$(hostname -i | cut -f1)
elif [[ "$OSTYPE" == "darwin"* ]]; then
IP_ADDR=$(ip route get 1 | awk '{print $NF;exit}')
IP_ADDR=$(ipconfig getifaddr en1)
if [[ -z "$IP_ADDR" ]]; then
IP_ADDR=$(ipconfig getifaddr en0)
fi
fi
PRIVATE_NETWORK_IP=${ADDR} mutagen-compose -f "$basedir"/docker-compose.yml up --build --detach
PRIVATE_NETWORK_IP=${IP_ADDR} mutagen-compose -f "$basedir"/docker-compose.yml up --build --detach