This commit is contained in:
2025-05-12 14:25:25 +02:00
parent ab2db755ef
commit 9e378ca2b7
2719 changed files with 46505 additions and 60181 deletions

164
vendor/laravel/sail/bin/sail vendored Normal file → Executable file
View File

@@ -83,7 +83,9 @@ function display_help {
echo " ${GREEN}sail mysql${NC} Start a MySQL CLI session within the 'mysql' container"
echo " ${GREEN}sail mariadb${NC} Start a MySQL CLI session within the 'mariadb' container"
echo " ${GREEN}sail psql${NC} Start a PostgreSQL CLI session within the 'pgsql' container"
echo " ${GREEN}sail mongodb${NC} Start a Mongo Shell session within the 'mongodb' container"
echo " ${GREEN}sail redis${NC} Start a Redis CLI session within the 'redis' container"
echo " ${GREEN}sail valkey${NC} Start a Valkey CLI session within the 'valkey' container"
echo
echo "${YELLOW}Debugging:${NC}"
echo " ${GREEN}sail debug ...${NC} Run an Artisan command in debug mode"
@@ -110,6 +112,7 @@ function display_help {
echo
echo "${YELLOW}Binaries:${NC}"
echo " ${GREEN}sail bin ...${NC} Run Composer binary scripts from the vendor/bin directory"
echo " ${GREEN}sail run ...${NC} Run a command within the application container"
echo
echo "${YELLOW}Customization:${NC}"
echo " ${GREEN}sail artisan sail:publish${NC} Publish the Sail configuration files"
@@ -138,6 +141,7 @@ fi
# Define environment variables...
export APP_PORT=${APP_PORT:-80}
export APP_SERVICE=${APP_SERVICE:-"laravel.test"}
export APP_USER=${APP_USER:-"sail"}
export DB_PORT=${DB_PORT:-3306}
export WWWUSER=${WWWUSER:-$UID}
export WWWGROUP=${WWWGROUP:-$(id -g)}
@@ -210,9 +214,9 @@ if [ "$1" == "php" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" "php" "$@")
ARGS+=("$APP_SERVICE" "php")
else
sail_is_not_running
fi
@@ -222,9 +226,25 @@ elif [ "$1" == "bin" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
CMD=$1
shift 1
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" ./vendor/bin/"$@")
ARGS+=("$APP_SERVICE" ./vendor/bin/"$CMD")
else
sail_is_not_running
fi
# Proxy commands on the application container...
elif [ "$1" == "run" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
CMD=$1
shift 1
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" "$CMD")
else
sail_is_not_running
fi
@@ -234,7 +254,7 @@ elif [ "$1" == "docker-compose" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" "${DOCKER_COMPOSE[@]}")
else
@@ -246,9 +266,9 @@ elif [ "$1" == "composer" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" "composer" "$@")
ARGS+=("$APP_SERVICE" "composer")
else
sail_is_not_running
fi
@@ -258,9 +278,9 @@ elif [ "$1" == "artisan" ] || [ "$1" == "art" ] || [ "$1" == "a" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php artisan "$@")
ARGS+=("$APP_SERVICE" php artisan)
else
sail_is_not_running
fi
@@ -270,9 +290,9 @@ elif [ "$1" == "debug" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail -e XDEBUG_SESSION=1)
ARGS+=(exec -u "$APP_USER" -e XDEBUG_TRIGGER=1)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php artisan "$@")
ARGS+=("$APP_SERVICE" php artisan)
else
sail_is_not_running
fi
@@ -282,9 +302,9 @@ elif [ "$1" == "test" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php artisan test "$@")
ARGS+=("$APP_SERVICE" php artisan test)
else
sail_is_not_running
fi
@@ -294,9 +314,9 @@ elif [ "$1" == "phpunit" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php vendor/bin/phpunit "$@")
ARGS+=("$APP_SERVICE" php vendor/bin/phpunit)
else
sail_is_not_running
fi
@@ -306,9 +326,9 @@ elif [ "$1" == "pest" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php vendor/bin/pest "$@")
ARGS+=("$APP_SERVICE" php vendor/bin/pest)
else
sail_is_not_running
fi
@@ -318,9 +338,9 @@ elif [ "$1" == "pint" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php vendor/bin/pint "$@")
ARGS+=("$APP_SERVICE" php vendor/bin/pint)
else
sail_is_not_running
fi
@@ -330,11 +350,11 @@ elif [ "$1" == "dusk" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(-e "APP_URL=http://${APP_SERVICE}")
ARGS+=(-e "DUSK_DRIVER_URL=http://selenium:4444/wd/hub")
ARGS+=("$APP_SERVICE" php artisan dusk "$@")
ARGS+=("$APP_SERVICE" php artisan dusk)
else
sail_is_not_running
fi
@@ -344,21 +364,21 @@ elif [ "$1" == "dusk:fails" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(-e "APP_URL=http://${APP_SERVICE}")
ARGS+=(-e "DUSK_DRIVER_URL=http://selenium:4444/wd/hub")
ARGS+=("$APP_SERVICE" php artisan dusk:fails "$@")
ARGS+=("$APP_SERVICE" php artisan dusk:fails)
else
sail_is_not_running
fi
# Initiate a Laravel Tinker session within the application container...
elif [ "$1" == "tinker" ] ; then
elif [ "$1" == "tinker" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php artisan tinker)
else
@@ -370,9 +390,9 @@ elif [ "$1" == "node" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" node "$@")
ARGS+=("$APP_SERVICE" node)
else
sail_is_not_running
fi
@@ -382,9 +402,9 @@ elif [ "$1" == "npm" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" npm "$@")
ARGS+=("$APP_SERVICE" npm)
else
sail_is_not_running
fi
@@ -394,9 +414,9 @@ elif [ "$1" == "npx" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" npx "$@")
ARGS+=("$APP_SERVICE" npx)
else
sail_is_not_running
fi
@@ -406,9 +426,9 @@ elif [ "$1" == "pnpm" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" pnpm "$@")
ARGS+=("$APP_SERVICE" pnpm)
else
sail_is_not_running
fi
@@ -418,21 +438,21 @@ elif [ "$1" == "pnpx" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" pnpx "$@")
ARGS+=("$APP_SERVICE" pnpx)
else
sail_is_not_running
fi
# Proxy YARN commands to the "yarn" binary on the application container...
# Proxy Yarn commands to the "yarn" binary on the application container...
elif [ "$1" == "yarn" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" yarn "$@")
ARGS+=("$APP_SERVICE" yarn)
else
sail_is_not_running
fi
@@ -442,9 +462,9 @@ elif [ "$1" == "bun" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" bun "$@")
ARGS+=("$APP_SERVICE" bun)
else
sail_is_not_running
fi
@@ -454,9 +474,9 @@ elif [ "$1" == "bunx" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" bunx "$@")
ARGS+=("$APP_SERVICE" bunx)
else
sail_is_not_running
fi
@@ -482,7 +502,7 @@ elif [ "$1" == "mariadb" ]; then
ARGS+=(exec)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(mariadb bash -c)
ARGS+=("MYSQL_PWD=\${MYSQL_PASSWORD} mysql -u \${MYSQL_USER} \${MYSQL_DATABASE}")
ARGS+=("MYSQL_PWD=\${MYSQL_PASSWORD} mariadb -u \${MYSQL_USER} \${MYSQL_DATABASE}")
else
sail_is_not_running
fi
@@ -505,9 +525,9 @@ elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" bash "$@")
ARGS+=("$APP_SERVICE" bash)
else
sail_is_not_running
fi
@@ -519,13 +539,25 @@ elif [ "$1" == "root-shell" ] || [ "$1" == "root-bash" ]; then
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u root)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" bash "$@")
ARGS+=("$APP_SERVICE" bash)
else
sail_is_not_running
fi
# Initiate a MongoDB Shell within the "mongodb" container...
elif [ "$1" == "mongodb" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(mongodb mongosh --port "${FORWARD_MONGODB_PORT:-27017}" --username "$MONGODB_USERNAME" --password "$MONGODB_PASSWORD" --authenticationDatabase admin)
else
sail_is_not_running
fi
# Initiate a Redis CLI terminal session within the "redis" container...
elif [ "$1" == "redis" ] ; then
elif [ "$1" == "redis" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
@@ -536,12 +568,24 @@ elif [ "$1" == "redis" ] ; then
sail_is_not_running
fi
# Initiate a Valkey CLI terminal session within the "valkey" container...
elif [ "$1" == "valkey" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(valkey valkey-cli)
else
sail_is_not_running
fi
# Share the site...
elif [ "$1" == "share" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
docker run --init --rm -p "$SAIL_SHARE_DASHBOARD":4040 -t beyondcodegmbh/expose-server:latest share http://host.docker.internal:"$APP_PORT" \
docker run --init --rm --add-host=host.docker.internal:host-gateway -p "$SAIL_SHARE_DASHBOARD":4040 -t beyondcodegmbh/expose-server:latest share http://host.docker.internal:"$APP_PORT" \
--server-host="$SAIL_SHARE_SERVER_HOST" \
--server-port="$SAIL_SHARE_SERVER_PORT" \
--auth="$SAIL_SHARE_TOKEN" \
@@ -559,18 +603,30 @@ elif [ "$1" == "share" ]; then
elif [ "$1" == "open" ]; then
shift 1
if command -v open &>/dev/null; then
OPEN="open"
elif command -v xdg-open &>/dev/null; then
OPEN="xdg-open"
else
echo "Neither open nor xdg-open is available. Exiting."
exit 1
fi
if [ "$EXEC" == "yes" ]; then
open "$APP_URL"
if [[ -n "$APP_PORT" && "$APP_PORT" != "80" ]]; then
FULL_URL="${APP_URL}:${APP_PORT}"
else
FULL_URL="$APP_URL"
fi
$OPEN "$FULL_URL"
exit
else
sail_is_not_running
fi
# Pass unknown commands to the "docker-compose" binary...
else
ARGS+=("$@")
fi
# Run Docker Compose with the defined arguments...
"${DOCKER_COMPOSE[@]}" "${ARGS[@]}"
"${DOCKER_COMPOSE[@]}" "${ARGS[@]}" "$@"