2020-02-18 23:55:06 -05:00
|
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
2020-05-21 02:11:19 -04:00
|
|
|
|
. "$DIR/.common.sh"
|
2020-02-18 23:55:06 -05:00
|
|
|
|
|
|
|
|
|
# Ensure docker-compose exists
|
|
|
|
|
if hash docker-compose 2>/dev/null; then
|
|
|
|
|
cd "${DIR}/.."
|
|
|
|
|
echo -e "${BLUE}❯ ${CYAN}Starting Dev Stack ...${RESET}"
|
2024-10-15 21:06:29 -04:00
|
|
|
|
echo -e "${BLUE}❯ $(docker-compose config)${RESET}"
|
2020-02-18 23:55:06 -05:00
|
|
|
|
|
2024-10-15 21:06:29 -04:00
|
|
|
|
# Bring up a stack, in steps so we can inject IPs everywhere
|
|
|
|
|
docker-compose up -d pdns pdns-db
|
|
|
|
|
PDNS_IP=$(get_container_ip "pdns")
|
|
|
|
|
echo -e "${BLUE}❯ ${YELLOW}PDNS IP is ${PDNS_IP}${RESET}"
|
|
|
|
|
|
|
|
|
|
# adjust the dnsrouter config
|
|
|
|
|
LOCAL_DNSROUTER_CONFIG="$DIR/../docker/dev/dnsrouter-config.json"
|
|
|
|
|
rm -rf "$LOCAL_DNSROUTER_CONFIG.tmp"
|
|
|
|
|
# IMPORTANT: changes to dnsrouter-config.json will affect this line:
|
|
|
|
|
jq --arg a "$PDNS_IP" '.servers[0].upstreams[1].upstream = $a' "$LOCAL_DNSROUTER_CONFIG" > "$LOCAL_DNSROUTER_CONFIG.tmp"
|
|
|
|
|
|
|
|
|
|
docker-compose up -d dnsrouter
|
|
|
|
|
DNSROUTER_IP=$(get_container_ip "dnsrouter")
|
|
|
|
|
echo -e "${BLUE}❯ ${YELLOW}DNS Router IP is ${DNSROUTER_IP}"
|
|
|
|
|
|
|
|
|
|
if [ "${DNSROUTER_IP:-}" = "" ]; then
|
|
|
|
|
echo -e "${RED}❯ ERROR: DNS Router IP is not set${RESET}"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# mount the resolver
|
|
|
|
|
LOCAL_RESOLVE="$DIR/../docker/dev/resolv.conf"
|
|
|
|
|
rm -rf "${LOCAL_RESOLVE}"
|
|
|
|
|
printf "nameserver %s\noptions ndots:0" "${DNSROUTER_IP}" > "${LOCAL_RESOLVE}"
|
|
|
|
|
|
|
|
|
|
# bring up all remaining containers, except cypress!
|
|
|
|
|
docker-compose up -d --remove-orphans stepca squid
|
2024-12-23 17:57:54 -05:00
|
|
|
|
docker-compose pull db db-postgres authentik-redis authentik authentik-worker authentik-ldap
|
|
|
|
|
docker-compose build --pull --parallel fullstack
|
|
|
|
|
docker-compose up -d --remove-orphans fullstack
|
2024-10-15 21:06:29 -04:00
|
|
|
|
docker-compose up -d --remove-orphans swagger
|
|
|
|
|
|
|
|
|
|
# wait for main container to be healthy
|
|
|
|
|
bash "$DIR/wait-healthy" "$(docker-compose ps --all -q fullstack)" 120
|
2020-02-18 23:55:06 -05:00
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
echo -e "${CYAN}Admin UI: http://127.0.0.1:3081${RESET}"
|
|
|
|
|
echo -e "${CYAN}Nginx: http://127.0.0.1:3080${RESET}"
|
|
|
|
|
echo -e "${CYAN}Swagger Doc: http://127.0.0.1:3001${RESET}"
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
|
|
if [ "$1" == "-f" ]; then
|
|
|
|
|
echo -e "${BLUE}❯ ${YELLOW}Following Backend Container:${RESET}"
|
2024-12-23 17:57:54 -05:00
|
|
|
|
docker logs -f npm2dev.core
|
2020-02-18 23:55:06 -05:00
|
|
|
|
else
|
|
|
|
|
echo -e "${YELLOW}Hint:${RESET} You can follow the output of some of the containers with:"
|
2024-12-23 17:57:54 -05:00
|
|
|
|
echo " docker logs -f npm2dev.core"
|
2020-02-18 23:55:06 -05:00
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
echo -e "${RED}❯ docker-compose command is not available${RESET}"
|
|
|
|
|
fi
|