Skip to content

Commit

Permalink
fixed incorrect variable names and wait for containers to be up with …
Browse files Browse the repository at this point in the history
…the restart command
  • Loading branch information
anandbagmar committed Aug 8, 2023
1 parent b0701e1 commit 6d6890f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions dockerContainers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,22 @@ echo " GRID_PORT_2: $GRID_PORT_2"
CURRENT_DIR=${PWD##*/}
echo "CURRENT_DIR: ${CURRENT_DIR}"

DOCKER_COMPOSE_UP_CMD="docker-compose -f $DOCKER_COMPOSE_FILE_NAME -p ${CURRENT_DIR} down"
DOCKER_COMPOSE_DOWN_CMD="docker-compose -f $DOCKER_COMPOSE_FILE_NAME -p ${CURRENT_DIR} up --force-recreate -d"
DOCKER_COMPOSE_DOWN_CMD="docker-compose -f $DOCKER_COMPOSE_FILE_NAME -p ${CURRENT_DIR} down"
DOCKER_COMPOSE_UP_CMD="docker-compose -f $DOCKER_COMPOSE_FILE_NAME -p ${CURRENT_DIR} up --force-recreate -d"

if [[ ( $1 == "up" ) || ( $1 == "start" ) ]]; then
echo "Start docker containers using command: '${DOCKER_COMPOSE_DOWN_CMD}'"
${DOCKER_COMPOSE_DOWN_CMD}
echo "Start docker containers using command: '${DOCKER_COMPOSE_UP_CMD}'"
${DOCKER_COMPOSE_UP_CMD}
./wait_for_containers_to_be_up.sh
elif [[ ( $1 == "down" ) || ( $1 == "stop" ) ]]; then
echo "Stop docker containers using command: '${DOCKER_COMPOSE_UP_CMD}'"
${DOCKER_COMPOSE_UP_CMD}
echo "Stop docker containers using command: '${DOCKER_COMPOSE_DOWN_CMD}'"
${DOCKER_COMPOSE_DOWN_CMD}
elif [[ ( $1 == "restart" ) ]]; then
echo "Restarting docker containers using command: '${DOCKER_COMPOSE_UP_CMD}' and then '${DOCKER_COMPOSE_DOWN_CMD}'"
${DOCKER_COMPOSE_UP_CMD}
sleep 2
echo "Restarting docker containers using command: '${DOCKER_COMPOSE_DOWN_CMD}' and then '${DOCKER_COMPOSE_UP_CMD}'"
${DOCKER_COMPOSE_DOWN_CMD}
sleep 2
${DOCKER_COMPOSE_UP_CMD}
./wait_for_containers_to_be_up.sh
else
echo "Invalid command provided. Pass either 'up/start' or 'down/stop' as a parameter"
exit 1
Expand Down

0 comments on commit 6d6890f

Please sign in to comment.