Skip to content

Commit

Permalink
Fix missing space in docker compose command
Browse files Browse the repository at this point in the history
  • Loading branch information
evertramos committed Nov 27, 2022
1 parent c2b581a commit d223a5f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions docker-compose/docker-compose-check-services-exists.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#-----------------------------------------------------------------------
# This function has one main objective:
# 1. Check if the services on a docker composeexists in docker
# 1. Check if the services on a docker compose exists in docker
#
# You must/might inform the parameters below:
# 1. The compose file full path string
Expand All @@ -41,11 +41,11 @@ docker_compose_check_service_exists()
LOCAL_QTY_SERVICES=${3:-0}

[[ $LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME == "" || $LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME == null ]] && \
echoerror "You must inform the docker composefull file path to the function: '${FUNCNAME[0]}'"
echoerror "You must inform the docker compose full file path to the function: '${FUNCNAME[0]}'"

[[ "$DEBUG" == true ]] && echo "Checking if docker composeservices exists for: '$LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME/$LOCAL_DOCKER_COMPOSE_FILE_NAME'"
[[ "$DEBUG" == true ]] && echo "Checking if docker compose services exists for: '$LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME/$LOCAL_DOCKER_COMPOSE_FILE_NAME'"

LOCAL_RESULTS=$(docker compose--file "$LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME/$LOCAL_DOCKER_COMPOSE_FILE_NAME" ps --quiet | wc -l)
LOCAL_RESULTS=$(docker compose --file "$LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME/$LOCAL_DOCKER_COMPOSE_FILE_NAME" ps --quiet | wc -l)

# Check results
if [[ $LOCAL_RESULTS > $LOCAL_QTY_SERVICES ]]; then
Expand Down
8 changes: 4 additions & 4 deletions docker-compose/docker-compose-check-services-is-running.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#-----------------------------------------------------------------------
# This function has one main objective:
# 1. Check if the services on a docker composefile is running
# 1. Check if the services on a docker compose file is running
#
# You must/might inform the parameters below:
# 1. The compose file full path string
Expand All @@ -41,11 +41,11 @@ docker_compose_check_service_is_running()
LOCAL_QTY_SERVICES=${3:-0}

[[ $LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME == "" || $LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME == null ]] && \
echoerror "You must inform the docker composefull file path to the function: '${FUNCNAME[0]}'"
echoerror "You must inform the docker compose full file path to the function: '${FUNCNAME[0]}'"

[[ "$DEBUG" == true ]] && echo "Checking if docker composeservices are running for: '$LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME/$LOCAL_DOCKER_COMPOSE_FILE_NAME'"
[[ "$DEBUG" == true ]] && echo "Checking if docker compose services are running for: '$LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME/$LOCAL_DOCKER_COMPOSE_FILE_NAME'"

LOCAL_RESULTS=$(docker compose--file "$LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME/$LOCAL_DOCKER_COMPOSE_FILE_NAME" ps | grep "Up" | wc -l)
LOCAL_RESULTS=$(docker compose --file "$LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME/$LOCAL_DOCKER_COMPOSE_FILE_NAME" ps | grep "Up" | wc -l)

# Check results
if [[ $LOCAL_RESULTS > $LOCAL_QTY_SERVICES ]]; then
Expand Down
6 changes: 3 additions & 3 deletions docker-compose/docker-compose-replace-string.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

#-----------------------------------------------------------------------
# This function has one main objective:
# 1. Update specific string in docker composefile
# 1. Update specific string in docker compose file
#
# You must/might inform the parameters below:
# 1. Path where the compose file are located (/path/docker-compose.yml)
# 2. String that should be REPLACED
# 3. New String
# 4. [optional] docker composefile name (default: docker-compose.yml)
# 4. [optional] docker compose file name (default: docker-compose.yml)
#
#-----------------------------------------------------------------------

Expand All @@ -46,6 +46,6 @@ docker_compose_replace_string()
# Check if file exists
[[ "$DEBUG" == true ]] && echo "Updating in file '$LOCAL_DOCKER_COMPOSE_FULL_FILE_PATH' the string from: '$LOCAL_REPLACE_STRING_FROM' to: '$LOCAL_REPLACE_STRING_TO' - [function: ${FUNCNAME[0]}]"

# Update the docker composefile
# Update the docker compose file
file_update_file $LOCAL_DOCKER_COMPOSE_FULL_FILE_PATH $LOCAL_REPLACE_STRING_FROM $LOCAL_REPLACE_STRING_TO
}
12 changes: 6 additions & 6 deletions docker-compose/docker-compose-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

#-----------------------------------------------------------------------
# This function has one main objective:
# 1. Start the docker composeservice
# 1. Start the docker compose service
#
# You must/might inform the parameters below:
# 1. Path where the compose file are located (/path/docker-compose.yml)
# 2. [optional] (default: false) pull docker composeimages before start
# 3. [optional] (default: docker-compose.yml) docker composefile name
# 2. [optional] (default: false) pull docker compose images before start
# 3. [optional] (default: docker-compose.yml) docker compose file name
# 4. [optional] (default: .env) .env file name
# 5. [optional] (default: same location in arg. 1) .env file location
#
Expand All @@ -46,13 +46,13 @@ docker_compose_start()

[[ $LOCAL_DOCKER_COMPOSE_PATH == "" || $LOCAL_DOCKER_COMPOSE_PATH == null ]] && echoerror "You must inform the required argument(s) to the function: '${FUNCNAME[0]}'"

[[ "$DEBUG" == true ]] && echo "Starting docker composer service for '$LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME' - [function: ${FUNCNAME[0]}]"
[[ "$DEBUG" == true ]] && echo "Starting docker compose service for '$LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME' - [function: ${FUNCNAME[0]}]"

# Pull if set
[[ "$LOCAL_PULL_BEFORE_START" == true ]] && docker compose--env-file $LOCAL_DOCKER_COMPOSE_ENV_FULL_FILE --file $LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME pull
[[ "$LOCAL_PULL_BEFORE_START" == true ]] && docker compose --env-file $LOCAL_DOCKER_COMPOSE_ENV_FULL_FILE --file $LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME pull

# Start service
if ! docker compose--env-file $LOCAL_DOCKER_COMPOSE_ENV_FULL_FILE --file $LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME up -d; then
if ! docker compose --env-file $LOCAL_DOCKER_COMPOSE_ENV_FULL_FILE --file $LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME up -d; then
ERROR_DOCKER_COMPOSE_START=true
fi
}
10 changes: 5 additions & 5 deletions docker-compose/docker-compose-stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

#-----------------------------------------------------------------------
# This function has one main objective:
# 1. Stop the docker composeservice
# 1. Stop the docker compose service
#
# You must inform the parameters below:
# 1. Path where the compose file are located (/path/docker-compose.yml)
# 2. [optional] (default: docker-compose.yml) docker composefile name
# 2. [optional] (default: docker-compose.yml) docker compose file name
# 3. [optional] (default: .env) .env file name
# 4. [optional] (default: same location in arg. 1) .env file location
#
Expand All @@ -42,12 +42,12 @@ docker_compose_stop()
LOCAL_DOCKER_COMPOSE_ENV_PATH=${4:-$LOCAL_DOCKER_COMPOSE_PATH}
LOCAL_DOCKER_COMPOSE_ENV_FULL_FILE="${LOCAL_DOCKER_COMPOSE_ENV_PATH%/}/$LOCAL_DOCKER_COMPOSE_ENV_FILE"

[[ $LOCAL_DOCKER_COMPOSE_PATH == "" ]] && [[ $LOCAL_DOCKER_COMPOSE_PATH == null ]] && echoerror "You must inform the docker composefile path to the function: '${FUNCNAME[0]}'"
[[ $LOCAL_DOCKER_COMPOSE_PATH == "" ]] && [[ $LOCAL_DOCKER_COMPOSE_PATH == null ]] && echoerror "You must inform the docker compose file path to the function: '${FUNCNAME[0]}'"

[[ "$DEBUG" == true ]] && echo "Stopping docker composer service for '$LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME' - [function: ${FUNCNAME[0]}]"
[[ "$DEBUG" == true ]] && echo "Stopping docker compose service for '$LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME' - [function: ${FUNCNAME[0]}]"

# Stop service or return error variable
if ! docker compose--env-file $LOCAL_DOCKER_COMPOSE_ENV_FULL_FILE --file $LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME down; then
if ! docker compose --env-file $LOCAL_DOCKER_COMPOSE_ENV_FULL_FILE --file $LOCAL_DOCKER_COMPOSE_FULL_FILE_NAME down; then
ERROR_DOCKER_COMPOSE_STOP=true
fi
}
8 changes: 4 additions & 4 deletions docker-compose/docker-compose-wpcli-search-replace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

#-----------------------------------------------------------------------
# This function has one main objective:
# 1. Run wp-cli search and replace function at a docker composefile
# 1. Run wp-cli search and replace function at a docker compose file
#
# You must/might inform the parameters below:
# 1. Path where the compose file are located (/path/docker-compose.yml)
# 2. String that should be REPLACED in database
# 3. New String
# 4. [optional] docker composefile name (default: docker-compose.yml)
# 4. [optional] docker compose file name (default: docker-compose.yml)
#
#-----------------------------------------------------------------------

Expand All @@ -46,9 +46,9 @@ docker_compose_wpcli_search_replace()
# Check if file exists
[[ "$DEBUG" == true ]] && echo "Updating in file '$LOCAL_DOCKER_COMPOSE_FULL_FILE_PATH' the string from: '$LOCAL_REPLACE_STRING_FROM' to: '$LOCAL_REPLACE_STRING_TO' - [function: ${FUNCNAME[0]}]"

# Update the docker composefile
# Update the docker compose file
cd $(dirname $LOCAL_DOCKER_COMPOSE_FULL_FILE_PATH) > /dev/null 2>&1
if ! docker composerun --rm wpcli search-replace $LOCAL_REPLACE_STRING_FROM $LOCAL_REPLACE_STRING_TO; then
if ! docker compose run --rm wpcli search-replace $LOCAL_REPLACE_STRING_FROM $LOCAL_REPLACE_STRING_TO; then
ERROR_DOCKER_COMPOSE_WPCLI_SEARCH_REPLACE=true
fi
cd - > /dev/null 2>&1
Expand Down

0 comments on commit d223a5f

Please sign in to comment.