Skip to content

Commit

Permalink
include debug yaml in download and fix colors (airbytehq#23315)
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler authored Feb 22, 2023
1 parent f9bc114 commit 6aab423
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ dd-java-agent.jar

# Files needed to run airbyte-platform that are downloaded on-the-fly via run-ab-platform.sh
docker-compose.yaml
docker-compose.debug.yaml
.env
.env.dev
flags.yml
flags.yml
73 changes: 37 additions & 36 deletions run-ab-platform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,28 @@ PS4="$blue_text""${BASH_SOURCE}:${LINENO}: ""$default_text"
Help()
{
# Display Help
echo "This Script will download the necessary files for running docker compose"
echo "It will also run docker compose up"
echo "Take Warning! These assets may become stale over time!"
echo -e "This Script will download the necessary files for running docker compose"
echo -e "It will also run docker compose up"
echo -e "Take Warning! These assets may become stale over time!"
echo
# $0 is the currently running program
echo "Syntax: $0"
echo "options:"
echo " -d --download Only download files - don't run docker compose"
echo " -r --refresh ${red_text}DELETE${default_text} existing assets and re-download new ones"
echo " -h --help Print this Help."
echo " -x --debug Verbose mode."
echo
echo -e "Syntax: $0"
echo -e "options:"
echo -e " -d --download Only download files - don't run docker compose"
echo -e " -r --refresh ${red_text}DELETE${default_text} existing assets and re-download new ones"
echo -e " -h --help Print this Help."
echo -e " -x --debug Verbose mode."
echo -e ""
}

########## Declare assets care about ##########
docker_compose_yaml="docker-compose.yaml"
dot_env=".env"
dot_env_dev=".env.dev"
flags="flags.yml"
docker_compose_yaml="docker-compose.yaml"
docker_compose_debug_yaml="docker-compose.debug.yaml"
dot_env=".env"
dot_env_dev=".env.dev"
flags="flags.yml"
# any string is an array to POSIX shell. Space seperates values
all_files="$docker_compose_yaml $dot_env $dot_env_dev $flags"
all_files="$docker_compose_yaml $docker_compose_debug_yaml $dot_env $dot_env_dev $flags"
base_github_url="https://raw.githubusercontent.com/airbytehq/airbyte-platform/main/"

############################################################
Expand All @@ -52,13 +53,13 @@ Download()
if test -f $file; then
# Check if the assets are old. A possibly sharp corner
if test $(find $file -type f -mtime +60 > /dev/null); then
echo "$red_text""Warning your $file may be stale!""$default_text"
echo "$red_text""rm $file to refresh!""$default_text"
echo -e "$red_text""Warning your $file may be stale!""$default_text"
echo -e "$red_text""rm $file to refresh!""$default_text"
else
echo "$blue_text""found $file locally!""$default_text"
echo -e "$blue_text""found $file locally!""$default_text"
fi
else
echo "$blue_text""Downloading $file""$default_text"
echo -e "$blue_text""Downloading $file""$default_text"
curl --location\
--fail\
--silent\
Expand All @@ -71,11 +72,11 @@ Download()
DeleteLocalAssets()
{
for file in $all_files; do
echo "$blue_text""Attempting to delete $file!""$default_text"
echo -e "$blue_text""Attempting to delete $file!""$default_text"
if test -f $file; then
rm $file && echo "It's gone!"
rm $file && echo -e "It's gone!"
else
echo "$file not found locally. Nothing to delete."
echo -e "$file not found locally. Nothing to delete."
fi
done
}
Expand Down Expand Up @@ -119,16 +120,16 @@ done
# Make sure the console is huuuge
if test $(tput cols) -ge 64; then
# Make it green!
echo "\033[32m"
echo " █████╗ ██╗██████╗ ██████╗ ██╗ ██╗████████╗███████╗"
echo "██╔══██╗██║██╔══██╗██╔══██╗╚██╗ ██╔╝╚══██╔══╝██╔════╝"
echo "███████║██║██████╔╝██████╔╝ ╚████╔╝ ██║ █████╗ "
echo "██╔══██║██║██╔══██╗██╔══██╗ ╚██╔╝ ██║ ██╔══╝ "
echo "██║ ██║██║██║ ██║██████╔╝ ██║ ██║ ███████╗"
echo "╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚══════╝"
echo " Move Data"
echo -e "\033[32m"
echo -e " █████╗ ██╗██████╗ ██████╗ ██╗ ██╗████████╗███████╗"
echo -e "██╔══██╗██║██╔══██╗██╔══██╗╚██╗ ██╔╝╚══██╔══╝██╔════╝"
echo -e "███████║██║██████╔╝██████╔╝ ╚████╔╝ ██║ █████╗ "
echo -e "██╔══██║██║██╔══██╗██╔══██╗ ╚██╔╝ ██║ ██╔══╝ "
echo -e "██║ ██║██║██║ ██║██████╔╝ ██║ ██║ ███████╗"
echo -e "╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚══════╝"
echo -e " Move Data"
# Make it less green
echo "\033[0m"
echo -e "\033[0m"
sleep 1
fi

Expand All @@ -142,25 +143,25 @@ Download
########## Source Envionmental Variables ##########

for file in $dot_env $dot_env_dev; do
echo "$blue_text""Loading Shell Variables from $file...""$default_text"
echo -e "$blue_text""Loading Shell Variables from $file...""$default_text"
source $file
done


########## Start Docker ##########

echo
echo "$blue_text""Starting Docker Compose""$default_text"
echo -e "$blue_text""Starting Docker Compose""$default_text"

docker-compose up

# $? is the exit code of the last command. So here: docker-compose up
if test $? -ne 0; then
echo "$red_text""Docker compose failed. If you are seeing container conflicts""$default_text"
echo "$red_text""please consider removing old containers""$default_text"
echo -e "$red_text""Docker compose failed. If you are seeing container conflicts""$default_text"
echo -e "$red_text""please consider removing old containers""$default_text"
fi

########## Ending Docker ##########
docker-compose down

echo "$blue_text""Starting Docker Compose""$default_text"
echo -e "$blue_text""Starting Docker Compose""$default_text"

0 comments on commit 6aab423

Please sign in to comment.