Skip to content

Commit

Permalink
try to open docker rather than failing the setup script (#1151)
Browse files Browse the repository at this point in the history
* try to open docker rather than failing

* allow non-docker users to launch whatever it is they're using
  • Loading branch information
NovemberTang authored Jul 8, 2024
1 parent dac3533 commit aa095c8
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions packages/dev-environment/script/start
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ MAIN_ENV_FILE=$ROOT_DIR/.env
LOCAL_ENV_FILE=$HOME/.gu/service_catalogue/.env.local
clear='\033[0m'
cyan='\033[0;36m'
yellow="\033[1;33m"

step() {
((STEP_COUNT++))
Expand All @@ -23,9 +24,9 @@ create_sql_migrations() {
rm -rf "$SQL_DIR"
mkdir -p "$SQL_DIR"

MIGRATIONS=$(ls -d $ROOT_DIR/packages/common/prisma/migrations/*/)
MIGRATIONS=$(ls -d "$ROOT_DIR"/packages/common/prisma/migrations/*/)
for MIGRATION in $MIGRATIONS; do
cp $MIGRATION/migration.sql $SQL_DIR/$(basename $MIGRATION).sql;
cp "$MIGRATION"/migration.sql "$SQL_DIR"/$(basename "$MIGRATION").sql;
done
}

Expand All @@ -46,13 +47,21 @@ check_aws_credentials() {

start_containers() {
step "Launching Docker containers"

if (docker info) 2>&1 >/dev/null; then
docker-compose -f "${DIR}/../docker-compose.yaml" --env-file "$MAIN_ENV_FILE" --env-file "$LOCAL_ENV_FILE" up -d --build
else
echo "Docker is not running. Please start Docker."
exit 1
fi

set +e
open -a Docker
set -e

while (! docker stats --no-stream ); do
# Docker takes a few seconds to initialize
sleep 5
echo -e "${yellow}Do you have an alternative Docker install, such as podman or minikube, aliased to 'docker'? If so, please launch it now${clear}"
echo "Standing by for Docker to start..."
echo ""
done

docker-compose -f "${DIR}/../docker-compose.yaml" --env-file "$MAIN_ENV_FILE" --env-file "$LOCAL_ENV_FILE" up -d --build

}

check_vpn_connection() {
Expand Down

0 comments on commit aa095c8

Please sign in to comment.