Created
March 7, 2018 19:05
-
-
Save rhysyngsun/81d7c59cf2021413c3c002350ae76701 to your computer and use it in GitHub Desktop.
odl-hosts.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Usage: | |
# ./odl-hosts.sh [ROOT_DOMAIN] | |
# | |
# Dependencies: | |
# - hostess: https://github.com/cbednarski/hostess | |
# - jq: https://stedolan.github.io/jq/ | |
# specify the root domain | |
ROOT_DOMAIN=${1:-'odl.local'} | |
HOSTESS=$(which hostess) | |
MM_HOSTNAME="mm.${ROOT_DOMAIN}" | |
MM_IP=$( | |
docker inspect micromasters_web_1 | | |
jq '.[0].NetworkSettings.Networks.micromasters_default.Gateway' -r | |
) | |
OD_HOSTNAME="od.${ROOT_DOMAIN}" | |
OD_IP=$( | |
docker inspect opendiscussions_web_1 | | |
jq '.[0].NetworkSettings.Networks.opendiscussions_default.Gateway' -r | |
) | |
echo "Aliasing ${MM_HOSTNAME} to $MM_IP" | |
sudo $HOSTESS add $MM_HOSTNAME $MM_IP | |
echo "Aliasing $OD_HOSTNAME to $OD_IP" | |
sudo $HOSTESS add $OD_HOSTNAME $OD_IP | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment