fix: smoke check관련 수정

This commit is contained in:
2026-06-19 15:37:50 +09:00
parent 07eb48f27c
commit 84d35c1409
3 changed files with 38 additions and 17 deletions

View File

@@ -21,6 +21,10 @@ require_command() {
command -v "$1" >/dev/null 2>&1 || fail "Required command not found: $1"
}
has_command() {
command -v "$1" >/dev/null 2>&1
}
load_env() {
[ -f "$ENV_FILE" ] || fail "Env file not found: $ENV_FILE"
@@ -37,7 +41,6 @@ load_env() {
}
db_dump() {
require_command mysqldump
require_command gzip
load_env
@@ -45,15 +48,22 @@ db_dump() {
output_path="$BACKUP_ROOT/db/${DB_NAME}_${TIMESTAMP}.sql.gz"
log "Creating DB dump: $output_path"
MYSQL_PWD="$DB_PASS" mysqldump \
--host="$DB_HOST" \
--port="$DB_PORT" \
--user="$DB_USER" \
--single-transaction \
--quick \
--routines \
--triggers \
"$DB_NAME" | gzip > "$output_path"
if has_command mysqldump; then
MYSQL_PWD="$DB_PASS" mysqldump \
--host="$DB_HOST" \
--port="$DB_PORT" \
--user="$DB_USER" \
--single-transaction \
--quick \
--routines \
--triggers \
"$DB_NAME" | gzip > "$output_path"
elif has_command docker; then
docker exec itam-backend sh -lc "MYSQL_PWD=\"$DB_PASS\" exec mysqldump --host=\"$DB_HOST\" --port=\"$DB_PORT\" --user=\"$DB_USER\" --single-transaction --quick --routines --triggers \"$DB_NAME\"" | gzip > "$output_path"
else
fail "Required command not found: mysqldump (and docker fallback unavailable)"
fi
log "DB dump completed: $output_path"
}