From 3f4ee921170bdc955c4c483387b51d6f88253e0e Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 8 Mar 2022 16:33:10 +0000 Subject: [PATCH 01/51] Update CHANGELOG.md --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93c9d87a..21bbf034 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.13.5...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.13.6...1.x) + +## [v1.13.6](https://github.com/laravel/sail/compare/v1.13.5...v1.13.6) - 2022-03-08 + +### Changed + +- Allow overriding docker-compose.yml path using ENV by @prageeth in https://github.com/laravel/sail/pull/352 & @taylorotwell in https://github.com/laravel/sail/commit/6205041336b09b965af1d6af29261584e787bf52 ## [v1.13.5](https://github.com/laravel/sail/compare/v1.13.3...v1.13.5) - 2022-02-22 From effd2762b8df0573e366d07d9f4df70cb2162251 Mon Sep 17 00:00:00 2001 From: Breno Ribeiro Date: Tue, 8 Mar 2022 17:47:07 -0300 Subject: [PATCH 02/51] The input device is not a TTY (#353) * Add failing test for TTY issue * Fix TTY issue in console * Clean up unneeded variable * Move test script to a gist * Update sail Co-authored-by: Breno Ribeiro Co-authored-by: Taylor Otwell --- bin/sail | 168 +++++++++++++++++++++++++++---------------------------- 1 file changed, 81 insertions(+), 87 deletions(-) diff --git a/bin/sail b/bin/sail index c721d8ac..8e6b2129 100755 --- a/bin/sail +++ b/bin/sail @@ -75,16 +75,17 @@ else EXEC="yes" fi +ARGS=(-f "$SAIL_FILE") + if [ $# -gt 0 ]; then # Proxy PHP commands to the "php" binary on the application container... if [ "$1" == "php" ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - php "$@" + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" "php" "$@") else sail_is_not_running fi @@ -94,10 +95,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - ./vendor/bin/"$@" + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" ./vendor/bin/"$@") else sail_is_not_running fi @@ -107,10 +107,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - composer "$@" + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" "composer" "$@") else sail_is_not_running fi @@ -120,10 +119,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - php artisan "$@" + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" php artisan "$@") else sail_is_not_running fi @@ -133,11 +131,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - -e XDEBUG_SESSION=1 \ - "$APP_SERVICE" \ - php artisan "$@" + ARGS+=(exec -u sail -e XDEBUG_SESSION=1) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" php artisan "$@") else sail_is_not_running fi @@ -147,10 +143,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - php artisan test "$@" + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" php artisan test "$@") else sail_is_not_running fi @@ -160,10 +155,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - php vendor/bin/phpunit "$@" + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" php vendor/bin/phpunit "$@") else sail_is_not_running fi @@ -173,12 +167,11 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - -e "APP_URL=http://${APP_SERVICE}" \ - -e "DUSK_DRIVER_URL=http://selenium:4444/wd/hub" \ - "$APP_SERVICE" \ - php artisan dusk "$@" + ARGS+=(exec -u sail) + [ ! -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 "$@") else sail_is_not_running fi @@ -188,12 +181,11 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - -e "APP_URL=http://${APP_SERVICE}" \ - -e "DUSK_DRIVER_URL=http://selenium:4444/wd/hub" \ - "$APP_SERVICE" \ - php artisan dusk:fails "$@" + ARGS+=(exec -u sail) + [ ! -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 "$@") else sail_is_not_running fi @@ -203,10 +195,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - php artisan tinker + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" php artisan tinker) else sail_is_not_running fi @@ -216,10 +207,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - node "$@" + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" node "$@") else sail_is_not_running fi @@ -229,10 +219,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - npm "$@" + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" npm "$@") else sail_is_not_running fi @@ -242,10 +231,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - npx "$@" + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" npx "$@") else sail_is_not_running fi @@ -255,10 +243,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - yarn "$@" + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" yarn "$@") else sail_is_not_running fi @@ -268,9 +255,10 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - mysql \ - bash -c 'MYSQL_PWD=${MYSQL_PASSWORD} mysql -u ${MYSQL_USER} ${MYSQL_DATABASE}' + ARGS+=(exec) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=(mysql bash -c) + ARGS+=('MYSQL_PWD=${MYSQL_PASSWORD} mysql -u ${MYSQL_USER} ${MYSQL_DATABASE}') else sail_is_not_running fi @@ -280,9 +268,10 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - mariadb \ - bash -c 'MYSQL_PWD=${MYSQL_PASSWORD} mysql -u ${MYSQL_USER} ${MYSQL_DATABASE}' + ARGS+=(exec) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=(mariadb bash -c) + ARGS+=('MYSQL_PWD=${MYSQL_PASSWORD} mysql -u ${MYSQL_USER} ${MYSQL_DATABASE}') else sail_is_not_running fi @@ -292,9 +281,10 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - pgsql \ - bash -c 'PGPASSWORD=${PGPASSWORD} psql -U ${POSTGRES_USER} ${POSTGRES_DB}' + ARGS+=(exec) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=(pgsql bash -c) + ARGS+=('PGPASSWORD=${PGPASSWORD} psql -U ${POSTGRES_USER} ${POSTGRES_DB}') else sail_is_not_running fi @@ -304,10 +294,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - bash "$@" + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" bash "$@") else sail_is_not_running fi @@ -317,9 +306,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - "$APP_SERVICE" \ - bash "$@" + ARGS+=(exec) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" bash "$@") else sail_is_not_running fi @@ -329,9 +318,9 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - redis \ - redis-cli + ARGS+=(exec) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=(redis redis-cli) else sail_is_not_running fi @@ -342,19 +331,24 @@ if [ $# -gt 0 ]; then 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" \ - --server-host="$SAIL_SHARE_SERVER_HOST" \ - --server-port="$SAIL_SHARE_SERVER_PORT" \ - --auth="$SAIL_SHARE_TOKEN" \ - --subdomain="$SAIL_SHARE_SUBDOMAIN" \ - "$@" + --server-host="$SAIL_SHARE_SERVER_HOST" \ + --server-port="$SAIL_SHARE_SERVER_PORT" \ + --auth="$SAIL_SHARE_TOKEN" \ + --subdomain="$SAIL_SHARE_SUBDOMAIN" \ + "$@" + + exit else sail_is_not_running fi # Pass unknown commands to the "docker-compose" binary... else - docker-compose -f $SAIL_FILE "$@" + ARGS+=("$@") fi else - docker-compose -f $SAIL_FILE ps + ARGS+=(ps) fi + +# Run Docker Compose with the defined arguments... +docker-compose "${ARGS[@]}" From 2092e1ce6e4ba534bff443de8c3a7bb280aba121 Mon Sep 17 00:00:00 2001 From: Breno Ribeiro Date: Fri, 11 Mar 2022 11:11:15 -0300 Subject: [PATCH 03/51] SAIL_FILE environment variable prevents using docker-compose.override.yml (#355) * Allow use of docker-compose.override.yml with default filenames * Allow multiple docker-compose.yml files * Update sail * Update sail Co-authored-by: Taylor Otwell --- bin/sail | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/bin/sail b/bin/sail index 8e6b2129..eba6a856 100755 --- a/bin/sail +++ b/bin/sail @@ -35,7 +35,7 @@ export DB_PORT=${DB_PORT:-3306} export WWWUSER=${WWWUSER:-$UID} export WWWGROUP=${WWWGROUP:-$(id -g)} -export SAIL_FILE=${SAIL_FILE:-"docker-compose.yml"} +export SAIL_FILES=${SAIL_FILES:-""} export SAIL_SHARE_DASHBOARD=${SAIL_SHARE_DASHBOARD:-4040} export SAIL_SHARE_SERVER_HOST=${SAIL_SHARE_SERVER_HOST:-"laravel-sail.site"} export SAIL_SHARE_SERVER_PORT=${SAIL_SHARE_SERVER_PORT:-8080} @@ -50,6 +50,26 @@ function sail_is_not_running { exit 1 } +# Define Docker Compose command prefix... +DOCKER_COMPOSE=(docker-compose) + +if [ -n "$SAIL_FILES" ]; then + # Convert SAIL_FILES to an array... + SAIL_FILES=(${SAIL_FILES//:/ }) + + for FILE in "${SAIL_FILES[@]}"; do + if [ -f "$FILE" ]; then + DOCKER_COMPOSE+=(-f "$FILE") + else + echo -e "${WHITE}Unable to find Docker Compose file: '${FILE}'${NC}" >&2 + + exit 1 + fi + done +fi + +EXEC="yes" + if [ -z "$SAIL_SKIP_CHECKS" ]; then # Ensure that Docker is running... if ! docker info > /dev/null 2>&1; then @@ -59,23 +79,18 @@ if [ -z "$SAIL_SKIP_CHECKS" ]; then fi # Determine if Sail is currently up... - PSRESULT="$(docker-compose -f "$SAIL_FILE" ps -q)" - if docker-compose -f "$SAIL_FILE" ps "$APP_SERVICE" | grep 'Exit\|exited'; then + if "${DOCKER_COMPOSE[@]}" ps "$APP_SERVICE" | grep 'Exit\|exited'; then echo -e "${WHITE}Shutting down old Sail processes...${NC}" >&2 - docker-compose -f "$SAIL_FILE" down > /dev/null 2>&1 + "${DOCKER_COMPOSE[@]}" down > /dev/null 2>&1 EXEC="no" - elif [ -n "$PSRESULT" ]; then - EXEC="yes" - else + elif [ -z "$(${DOCKER_COMPOSE[@]} ps -q)" ]; then EXEC="no" fi -else - EXEC="yes" fi -ARGS=(-f "$SAIL_FILE") +ARGS=() if [ $# -gt 0 ]; then # Proxy PHP commands to the "php" binary on the application container... @@ -351,4 +366,4 @@ else fi # Run Docker Compose with the defined arguments... -docker-compose "${ARGS[@]}" +"${DOCKER_COMPOSE[@]}" "${ARGS[@]}" From 8986e4a10dcb73ca57a0c5aa9f1bebf2e4eaa09e Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 15 Mar 2022 16:02:39 +0000 Subject: [PATCH 04/51] Update CHANGELOG.md --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21bbf034..f68354d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.13.6...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.13.7...1.x) + +## [v1.13.7](https://github.com/laravel/sail/compare/v1.13.6...v1.13.7) - 2022-03-15 + +### Fixed + +- The input device is not a TTY by @ribeirobreno in https://github.com/laravel/sail/pull/353 +- `SAIL_FILE` environment variable prevents using docker-compose.override.yml by @ribeirobreno in https://github.com/laravel/sail/pull/355 ## [v1.13.6](https://github.com/laravel/sail/compare/v1.13.5...v1.13.6) - 2022-03-08 From d817714f46f87d6793e230eb6836cd95e8f6d0a2 Mon Sep 17 00:00:00 2001 From: Alex Mayer Date: Wed, 16 Mar 2022 12:03:07 -0400 Subject: [PATCH 05/51] Update ondrej/php Repository Details (#360) Uses details from launchpad.net page technical details section. https://launchpad.net/~ondrej/+archive/ubuntu/php --- runtimes/7.4/Dockerfile | 5 ++--- runtimes/8.0/Dockerfile | 5 ++--- runtimes/8.1/Dockerfile | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/runtimes/7.4/Dockerfile b/runtimes/7.4/Dockerfile index feab9d52..d852a97e 100644 --- a/runtimes/7.4/Dockerfile +++ b/runtimes/7.4/Dockerfile @@ -17,9 +17,8 @@ RUN apt-get update \ && mkdir -p ~/.gnupg \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C \ - && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C \ - && echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ + && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ + && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php7.4-cli php7.4-dev \ php7.4-pgsql php7.4-sqlite3 php7.4-gd \ diff --git a/runtimes/8.0/Dockerfile b/runtimes/8.0/Dockerfile index 152a0b65..bafe3286 100644 --- a/runtimes/8.0/Dockerfile +++ b/runtimes/8.0/Dockerfile @@ -17,9 +17,8 @@ RUN apt-get update \ && mkdir -p ~/.gnupg \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C \ - && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C \ - && echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ + && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ + && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php8.0-cli php8.0-dev \ php8.0-pgsql php8.0-sqlite3 php8.0-gd \ diff --git a/runtimes/8.1/Dockerfile b/runtimes/8.1/Dockerfile index a29bd44c..167a6d59 100644 --- a/runtimes/8.1/Dockerfile +++ b/runtimes/8.1/Dockerfile @@ -17,9 +17,8 @@ RUN apt-get update \ && mkdir -p ~/.gnupg \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C \ - && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C \ - && echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ + && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ + && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php8.1-cli php8.1-dev \ php8.1-pgsql php8.1-sqlite3 php8.1-gd \ From aa6e89614ce2bdd706d61e742880351faeb1e8c7 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Thu, 17 Mar 2022 10:54:33 +0100 Subject: [PATCH 06/51] Update .styleci.yml --- .styleci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.styleci.yml b/.styleci.yml index 25844cc2..87ab4502 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -1,2 +1,3 @@ php: preset: laravel + version: 8.1 From eb8a8021058eae7401461f257e0aff7d4e237806 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Thu, 17 Mar 2022 11:06:57 +0100 Subject: [PATCH 07/51] Update .styleci.yml --- .styleci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.styleci.yml b/.styleci.yml index 87ab4502..25844cc2 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -1,3 +1,2 @@ php: preset: laravel - version: 8.1 From f69380fb203a4efddb7450d4c3b992865ba76149 Mon Sep 17 00:00:00 2001 From: Walter Woshid <36635504+WalterWoshid@users.noreply.github.com> Date: Thu, 17 Mar 2022 20:55:26 +0100 Subject: [PATCH 08/51] Shell - display available commands / help section (#359) * Added help section to sail binary * ShellCheck corrections (SC2206, SC2086, SC2068) * Added "docker-compose" command * Added color support for Mac and only for terminals with color support * Moved "help" section before docker checks * Suppressed "no such service: laravel.test" message when checking if sail is up * formatting Co-authored-by: Taylor Otwell --- bin/sail | 574 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 337 insertions(+), 237 deletions(-) diff --git a/bin/sail b/bin/sail index eba6a856..d4068bda 100755 --- a/bin/sail +++ b/bin/sail @@ -7,9 +7,6 @@ fi UNAMEOUT="$(uname -s)" -WHITE='\033[1;37m' -NC='\033[0m' - # Verify operating system is supported... case "${UNAMEOUT}" in Linux*) MACHINE=linux;; @@ -23,6 +20,101 @@ if [ "$MACHINE" == "UNKNOWN" ]; then exit 1 fi +# Determine if stdout is a terminal... +if test -t 1; then + # Determine if colors are supported... + ncolors=$(tput colors) + + if test -n "$ncolors" && test "$ncolors" -ge 8; then + BOLD="$(tput bold)" + YELLOW="$(tput setaf 3)" + GREEN="$(tput setaf 2)" + NC="$(tput sgr0)" + fi +fi + +# Function that prints the available commands... +function display_help { + echo "Laravel Sail" + echo + echo "${YELLOW}Usage:${NC}" >&2 + echo " sail COMMAND [options] [arguments]" + echo + echo "Unknown commands are passed to the docker-compose binary." + echo + echo "${YELLOW}docker-compose Commands:${NC}" + echo " ${GREEN}sail up${NC} Start the application" + echo " ${GREEN}sail up -d${NC} Start the application in the background" + echo " ${GREEN}sail stop${NC} Stop the application" + echo " ${GREEN}sail restart${NC} Restart the application" + echo " ${GREEN}sail ps${NC} Display the status of all containers" + echo + echo "${YELLOW}Artisan Commands:${NC}" + echo " ${GREEN}sail artisan ...${NC} Run an Artisan command" + echo " ${GREEN}sail artisan queue:work${NC}" + echo + echo "${YELLOW}PHP Commands:${NC}" + echo " ${GREEN}sail php ...${NC} Run a snippet of PHP code" + echo " ${GREEN}sail php -v${NC}" + echo + echo "${YELLOW}Composer Commands:${NC}" + echo " ${GREEN}sail composer ...${NC} Run a Composer command" + echo " ${GREEN}sail composer require laravel/sanctum${NC}" + echo + echo "${YELLOW}Node Commands:${NC}" + echo " ${GREEN}sail node ...${NC} Run a Node command" + echo " ${GREEN}sail node --version${NC}" + echo + echo "${YELLOW}NPM Commands:${NC}" + echo " ${GREEN}sail npm ...${NC} Run a npm command" + echo " ${GREEN}sail npx${NC} Run a npx command" + echo " ${GREEN}sail npm run prod${NC}" + echo + echo "${YELLOW}Yarn Commands:${NC}" + echo " ${GREEN}sail yarn ...${NC} Run a Yarn command" + echo " ${GREEN}sail yarn run prod${NC}" + echo + echo "${YELLOW}Database Commands:${NC}" + 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 redis${NC} Start a Redis CLI session within the 'redis' container" + echo + echo "${YELLOW}Debugging:${NC}" + echo " ${GREEN}sail debug ...${NC} Run an Artisan command in debug mode" + echo " ${GREEN}sail debug queue:work${NC}" + echo + echo "${YELLOW}Running Tests:${NC}" + echo " ${GREEN}sail test${NC} Run the PHPUnit tests via the Artisan test command" + echo " ${GREEN}sail phpunit ...${NC} Run PHPUnit" + echo " ${GREEN}sail dusk${NC} Run the Dusk tests (Requires the laravel/dusk package)" + echo + echo "${YELLOW}Container CLI:${NC}" + echo " ${GREEN}sail shell${NC} Start a shell session within the application container" + echo " ${GREEN}sail bash${NC} Alias for 'sail shell'" + echo " ${GREEN}sail root-shell${NC} Start a root shell session within the application container" + echo " ${GREEN}sail root-bash${NC} Alias for 'sail root-shell'" + echo " ${GREEN}sail tinker${NC} Start a new Laravel Tinker session" + echo + echo "${YELLOW}Sharing:${NC}" + echo " ${GREEN}sail share${NC} Share the application publicly via a temporary URL" + echo + echo "${YELLOW}Customization:${NC}" + echo " ${GREEN}sail artisan sail:publish${NC} Publish the Sail configuration files" + echo " ${GREEN}sail build --no-cache${NC} Rebuild all of the Sail containers" + + exit 1 +} + +# Proxy the "help" command... +if [ $# -gt 0 ]; then + if [ "$1" == "help" ] || [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ]; then + display_help + fi +else + display_help +fi + # Source the ".env" file so Laravel's environment variables are available... if [ -f ./.env ]; then source ./.env @@ -43,9 +135,9 @@ export SAIL_SHARE_SUBDOMAIN=${SAIL_SHARE_SUBDOMAIN:-""} # Function that outputs Sail is not running... function sail_is_not_running { - echo -e "${WHITE}Sail is not running.${NC}" >&2 + echo "${BOLD}Sail is not running.${NC}" >&2 echo "" >&2 - echo -e "${WHITE}You may Sail using the following commands:${NC} './vendor/bin/sail up' or './vendor/bin/sail up -d'" >&2 + echo "${BOLD}You may Sail using the following commands:${NC} './vendor/bin/sail up' or './vendor/bin/sail up -d'" >&2 exit 1 } @@ -55,13 +147,13 @@ DOCKER_COMPOSE=(docker-compose) if [ -n "$SAIL_FILES" ]; then # Convert SAIL_FILES to an array... - SAIL_FILES=(${SAIL_FILES//:/ }) + SAIL_FILES=("${SAIL_FILES//:/ }") for FILE in "${SAIL_FILES[@]}"; do if [ -f "$FILE" ]; then DOCKER_COMPOSE+=(-f "$FILE") else - echo -e "${WHITE}Unable to find Docker Compose file: '${FILE}'${NC}" >&2 + echo "${BOLD}Unable to find Docker Compose file: '${FILE}'${NC}" >&2 exit 1 fi @@ -73,296 +165,304 @@ EXEC="yes" if [ -z "$SAIL_SKIP_CHECKS" ]; then # Ensure that Docker is running... if ! docker info > /dev/null 2>&1; then - echo -e "${WHITE}Docker is not running.${NC}" >&2 + echo "${BOLD}Docker is not running.${NC}" >&2 exit 1 fi # Determine if Sail is currently up... - if "${DOCKER_COMPOSE[@]}" ps "$APP_SERVICE" | grep 'Exit\|exited'; then - echo -e "${WHITE}Shutting down old Sail processes...${NC}" >&2 + if "${DOCKER_COMPOSE[@]}" ps "$APP_SERVICE" 2>&1 | grep 'Exit\|exited'; then + echo "${BOLD}Shutting down old Sail processes...${NC}" >&2 "${DOCKER_COMPOSE[@]}" down > /dev/null 2>&1 EXEC="no" - elif [ -z "$(${DOCKER_COMPOSE[@]} ps -q)" ]; then + elif [ -z "$("${DOCKER_COMPOSE[@]}" ps -q)" ]; then EXEC="no" fi fi ARGS=() -if [ $# -gt 0 ]; then - # Proxy PHP commands to the "php" binary on the application container... - if [ "$1" == "php" ]; then - shift 1 - - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" "php" "$@") - else - sail_is_not_running - fi +# Proxy PHP commands to the "php" binary on the application container... +if [ "$1" == "php" ]; then + shift 1 - # Proxy vendor binary commands on the application container... - elif [ "$1" == "bin" ]; then - shift 1 + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" "php" "$@") + else + sail_is_not_running + fi - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" ./vendor/bin/"$@") - else - sail_is_not_running - fi +# Proxy vendor binary commands on the application container... +elif [ "$1" == "bin" ]; then + shift 1 - # Proxy Composer commands to the "composer" binary on the application container... - elif [ "$1" == "composer" ]; then - shift 1 + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" ./vendor/bin/"$@") + else + sail_is_not_running + fi - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" "composer" "$@") - else - sail_is_not_running - fi +# Proxy docker-compose commands to the docker-compose binary on the application container... +elif [ "$1" == "docker-compose" ]; then + shift 1 - # Proxy Artisan commands to the "artisan" binary on the application container... - elif [ "$1" == "artisan" ] || [ "$1" == "art" ]; then - shift 1 + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" "${DOCKER_COMPOSE[@]}") + else + sail_is_not_running + fi - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" php artisan "$@") - else - sail_is_not_running - fi +# Proxy Composer commands to the "composer" binary on the application container... +elif [ "$1" == "composer" ]; then + shift 1 - # Proxy the "debug" command to the "php artisan" binary on the application container with xdebug enabled... - elif [ "$1" == "debug" ]; then - shift 1 + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" "composer" "$@") + else + sail_is_not_running + fi - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail -e XDEBUG_SESSION=1) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" php artisan "$@") - else - sail_is_not_running - fi +# Proxy Artisan commands to the "artisan" binary on the application container... +elif [ "$1" == "artisan" ] || [ "$1" == "art" ]; then + shift 1 - # Proxy the "test" command to the "php artisan test" Artisan command... - elif [ "$1" == "test" ]; then - shift 1 + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" php artisan "$@") + else + sail_is_not_running + fi - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" php artisan test "$@") - else - sail_is_not_running - fi +# Proxy the "debug" command to the "php artisan" binary on the application container with xdebug enabled... +elif [ "$1" == "debug" ]; then + shift 1 - # Proxy the "phpunit" command to "php vendor/bin/phpunit"... - elif [ "$1" == "phpunit" ]; then - shift 1 + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail -e XDEBUG_SESSION=1) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" php artisan "$@") + else + sail_is_not_running + fi - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" php vendor/bin/phpunit "$@") - else - sail_is_not_running - fi +# Proxy the "test" command to the "php artisan test" Artisan command... +elif [ "$1" == "test" ]; then + shift 1 - # Proxy the "dusk" command to the "php artisan dusk" Artisan command... - elif [ "$1" == "dusk" ]; then - shift 1 + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" php artisan test "$@") + else + sail_is_not_running + fi - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -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 "$@") - else - sail_is_not_running - fi +# Proxy the "phpunit" command to "php vendor/bin/phpunit"... +elif [ "$1" == "phpunit" ]; then + shift 1 - # Proxy the "dusk:fails" command to the "php artisan dusk:fails" Artisan command... - elif [ "$1" == "dusk:fails" ]; then - shift 1 + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" php vendor/bin/phpunit "$@") + else + sail_is_not_running + fi - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -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 "$@") - else - sail_is_not_running - fi +# Proxy the "dusk" command to the "php artisan dusk" Artisan command... +elif [ "$1" == "dusk" ]; then + shift 1 + + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -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 "$@") + else + sail_is_not_running + fi - # Initiate a Laravel Tinker session within the application container... - elif [ "$1" == "tinker" ] ; then - shift 1 +# Proxy the "dusk:fails" command to the "php artisan dusk:fails" Artisan command... +elif [ "$1" == "dusk:fails" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" php artisan tinker) - else - sail_is_not_running - fi + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -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 "$@") + else + sail_is_not_running + fi - # Proxy Node commands to the "node" binary on the application container... - elif [ "$1" == "node" ]; then - shift 1 +# Initiate a Laravel Tinker session within the application container... +elif [ "$1" == "tinker" ] ; then + shift 1 - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" node "$@") - else - sail_is_not_running - fi + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" php artisan tinker) + else + sail_is_not_running + fi - # Proxy NPM commands to the "npm" binary on the application container... - elif [ "$1" == "npm" ]; then - shift 1 +# Proxy Node commands to the "node" binary on the application container... +elif [ "$1" == "node" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" npm "$@") - else - sail_is_not_running - fi + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" node "$@") + else + sail_is_not_running + fi - # Proxy NPX commands to the "npx" binary on the application container... - elif [ "$1" == "npx" ]; then - shift 1 +# Proxy NPM commands to the "npm" binary on the application container... +elif [ "$1" == "npm" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" npx "$@") - else - sail_is_not_running - fi + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" npm "$@") + else + sail_is_not_running + fi - # Proxy YARN commands to the "yarn" binary on the application container... - elif [ "$1" == "yarn" ]; then - shift 1 +# Proxy NPX commands to the "npx" binary on the application container... +elif [ "$1" == "npx" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" yarn "$@") - else - sail_is_not_running - fi + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" npx "$@") + else + sail_is_not_running + fi - # Initiate a MySQL CLI terminal session within the "mysql" container... - elif [ "$1" == "mysql" ]; then - shift 1 +# Proxy YARN commands to the "yarn" binary on the application container... +elif [ "$1" == "yarn" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=(mysql bash -c) - ARGS+=('MYSQL_PWD=${MYSQL_PASSWORD} mysql -u ${MYSQL_USER} ${MYSQL_DATABASE}') - else - sail_is_not_running - fi + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" yarn "$@") + else + sail_is_not_running + fi - # Initiate a MySQL CLI terminal session within the "mariadb" container... - elif [ "$1" == "mariadb" ]; then - shift 1 +# Initiate a MySQL CLI terminal session within the "mysql" container... +elif [ "$1" == "mysql" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=(mariadb bash -c) - ARGS+=('MYSQL_PWD=${MYSQL_PASSWORD} mysql -u ${MYSQL_USER} ${MYSQL_DATABASE}') - else - sail_is_not_running - fi + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=(mysql bash -c) + ARGS+=("MYSQL_PWD=\${MYSQL_PASSWORD} mysql -u \${MYSQL_USER} \${MYSQL_DATABASE}") + else + sail_is_not_running + fi - # Initiate a PostgreSQL CLI terminal session within the "pgsql" container... - elif [ "$1" == "psql" ]; then - shift 1 +# Initiate a MySQL CLI terminal session within the "mariadb" container... +elif [ "$1" == "mariadb" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=(pgsql bash -c) - ARGS+=('PGPASSWORD=${PGPASSWORD} psql -U ${POSTGRES_USER} ${POSTGRES_DB}') - else - sail_is_not_running - fi + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=(mariadb bash -c) + ARGS+=("MYSQL_PWD=\${MYSQL_PASSWORD} mysql -u \${MYSQL_USER} \${MYSQL_DATABASE}") + else + sail_is_not_running + fi - # Initiate a Bash shell within the application container... - elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; then - shift 1 +# Initiate a PostgreSQL CLI terminal session within the "pgsql" container... +elif [ "$1" == "psql" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec -u sail) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" bash "$@") - else - sail_is_not_running - fi + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=(pgsql bash -c) + ARGS+=("PGPASSWORD=\${PGPASSWORD} psql -U \${POSTGRES_USER} \${POSTGRES_DB}") + else + sail_is_not_running + fi - # Initiate a root user Bash shell within the application container... - elif [ "$1" == "root-shell" ] ; then - shift 1 +# Initiate a Bash shell within the application container... +elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=("$APP_SERVICE" bash "$@") - else - sail_is_not_running - fi + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" bash "$@") + else + sail_is_not_running + fi - # Initiate a Redis CLI terminal session within the "redis" container... - elif [ "$1" == "redis" ] ; then - shift 1 +# Initiate a root user Bash shell within the application container... +elif [ "$1" == "root-shell" ] || [ "$1" == "root-bash" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - ARGS+=(exec) - [ ! -t 0 ] && ARGS+=(-T) - ARGS+=(redis redis-cli) - else - sail_is_not_running - fi + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" bash "$@") + else + sail_is_not_running + fi - # Share the site... - elif [ "$1" == "share" ]; then - shift 1 +# Initiate a Redis CLI terminal session within the "redis" container... +elif [ "$1" == "redis" ] ; 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" \ - --server-host="$SAIL_SHARE_SERVER_HOST" \ - --server-port="$SAIL_SHARE_SERVER_PORT" \ - --auth="$SAIL_SHARE_TOKEN" \ - --subdomain="$SAIL_SHARE_SUBDOMAIN" \ - "$@" + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=(redis redis-cli) + else + sail_is_not_running + fi - exit - 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" \ + --server-host="$SAIL_SHARE_SERVER_HOST" \ + --server-port="$SAIL_SHARE_SERVER_PORT" \ + --auth="$SAIL_SHARE_TOKEN" \ + --subdomain="$SAIL_SHARE_SUBDOMAIN" \ + "$@" - # Pass unknown commands to the "docker-compose" binary... + exit else - ARGS+=("$@") + sail_is_not_running fi + +# Pass unknown commands to the "docker-compose" binary... else - ARGS+=(ps) + ARGS+=("$@") fi # Run Docker Compose with the defined arguments... From fda7347ad35bb0b883def6dc63cdb0132c9c6c49 Mon Sep 17 00:00:00 2001 From: Breno Ribeiro Date: Fri, 18 Mar 2022 10:47:41 -0300 Subject: [PATCH 09/51] [1.x] Fixes docker-compose not found in non-bash shells (#364) * Fixes docker-compose not found in non-bash shells * Remove a stray "!" --- bin/sail | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/sail b/bin/sail index d4068bda..f09f3c1a 100755 --- a/bin/sail +++ b/bin/sail @@ -1,10 +1,5 @@ #!/usr/bin/env bash -if ! [ -x "$(command -v docker-compose)" ]; then - shopt -s expand_aliases - alias docker-compose='docker compose' -fi - UNAMEOUT="$(uname -s)" # Verify operating system is supported... @@ -143,7 +138,11 @@ function sail_is_not_running { } # Define Docker Compose command prefix... -DOCKER_COMPOSE=(docker-compose) +if [ -x "$(command -v docker-compose)" ]; then + DOCKER_COMPOSE=(docker-compose) +else + DOCKER_COMPOSE=(docker compose) +fi if [ -n "$SAIL_FILES" ]; then # Convert SAIL_FILES to an array... From b00f1b64afff9c16355d23bb1e0f83a7ea9bbb7e Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Wed, 23 Mar 2022 13:35:34 +0100 Subject: [PATCH 10/51] Update update-changelog.yml --- .github/workflows/update-changelog.yml | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index 0200e2b9..eaeaf1f8 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -6,24 +6,4 @@ on: jobs: update: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - ref: ${{ github.ref_name }} - - - name: Update Changelog - uses: stefanzweifel/changelog-updater-action@v1 - with: - latest-version: ${{ github.event.release.tag_name }} - release-notes: ${{ github.event.release.body }} - compare-url-target-revision: ${{ github.event.release.target_commitish }} - - - name: Commit updated CHANGELOG - uses: stefanzweifel/git-auto-commit-action@v4 - with: - branch: ${{ github.event.release.target_commitish }} - commit_message: Update CHANGELOG.md - file_pattern: CHANGELOG.md + uses: laravel/.github/.github/workflows/update-changelog.yml@main From 6b2f5143fb0fe22fe15d5e13c5f50d698c01b6bb Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 29 Mar 2022 15:54:52 +0000 Subject: [PATCH 11/51] Update CHANGELOG --- CHANGELOG.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f68354d0..6a2efc14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.13.7...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.13.8...1.x) + +## [v1.13.8](https://github.com/laravel/sail/compare/v1.13.7...v1.13.8) - 2022-03-23 + +### Changed + +- Update ondrej/php Repository Details by @amayer5125 in https://github.com/laravel/sail/pull/360 +- Shell - display available commands / help section by @WalterWoshid in https://github.com/laravel/sail/pull/359 + +### Fixes + +- Fixes docker-compose not found in non-bash shells by @ribeirobreno in https://github.com/laravel/sail/pull/364 ## [v1.13.7](https://github.com/laravel/sail/compare/v1.13.6...v1.13.7) - 2022-03-15 From 7bb294fe99fc42c3b1bee83fb667cd7698b3c385 Mon Sep 17 00:00:00 2001 From: AriaieBOY Date: Mon, 4 Apr 2022 19:51:51 +0430 Subject: [PATCH 12/51] update default postgresql version to 14 (#373) * update postgres to version 14 * Update Dockerfile --- runtimes/7.4/Dockerfile | 5 ++++- runtimes/8.0/Dockerfile | 3 +++ runtimes/8.1/Dockerfile | 3 +++ stubs/pgsql.stub | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/runtimes/7.4/Dockerfile b/runtimes/7.4/Dockerfile index d852a97e..af632c89 100644 --- a/runtimes/7.4/Dockerfile +++ b/runtimes/7.4/Dockerfile @@ -4,6 +4,7 @@ LABEL maintainer="Taylor Otwell" ARG WWWGROUP ARG NODE_VERSION=16 +ARG POSTGRES_VERSION=14 WORKDIR /var/www/html @@ -34,10 +35,12 @@ RUN apt-get update \ && npm install -g npm \ && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && echo "deb http://apt.postgresql.org/pub/repos/apt impish-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ + && curl --silent -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ && apt-get update \ && apt-get install -y yarn \ && apt-get install -y mysql-client \ - && apt-get install -y postgresql-client \ + && apt-get install -y postgresql-client-$POSTGRES_VERSION \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/runtimes/8.0/Dockerfile b/runtimes/8.0/Dockerfile index bafe3286..00063e0e 100644 --- a/runtimes/8.0/Dockerfile +++ b/runtimes/8.0/Dockerfile @@ -4,6 +4,7 @@ LABEL maintainer="Taylor Otwell" ARG WWWGROUP ARG NODE_VERSION=16 +ARG POSTGRES_VERSION=14 WORKDIR /var/www/html @@ -34,6 +35,8 @@ RUN apt-get update \ && npm install -g npm \ && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && echo "deb http://apt.postgresql.org/pub/repos/apt impish-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ + && curl --silent -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ && apt-get update \ && apt-get install -y yarn \ && apt-get install -y mysql-client \ diff --git a/runtimes/8.1/Dockerfile b/runtimes/8.1/Dockerfile index 167a6d59..d350b5be 100644 --- a/runtimes/8.1/Dockerfile +++ b/runtimes/8.1/Dockerfile @@ -4,6 +4,7 @@ LABEL maintainer="Taylor Otwell" ARG WWWGROUP ARG NODE_VERSION=16 +ARG POSTGRES_VERSION=14 WORKDIR /var/www/html @@ -35,6 +36,8 @@ RUN apt-get update \ && npm install -g npm \ && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && echo "deb http://apt.postgresql.org/pub/repos/apt impish-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ + && curl --silent -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ && apt-get update \ && apt-get install -y yarn \ && apt-get install -y mysql-client \ diff --git a/stubs/pgsql.stub b/stubs/pgsql.stub index 4d80895c..5aeced5f 100644 --- a/stubs/pgsql.stub +++ b/stubs/pgsql.stub @@ -1,5 +1,5 @@ pgsql: - image: 'postgres:13' + image: 'postgres:14' ports: - '${FORWARD_DB_PORT:-5432}:5432' environment: From f1ee1707a331d3ffe1b41b84cd2eaed71166e32c Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 5 Apr 2022 15:30:53 +0000 Subject: [PATCH 13/51] Update CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a2efc14..5dde7a88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.13.8...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.13.9...1.x) + +## [v1.13.9](https://github.com/laravel/sail/compare/v1.13.8...v1.13.9) - 2022-04-04 + +### Changed + +- Update default PostgreSQL version to v14 by @ariaieboy in https://github.com/laravel/sail/pull/373 ## [v1.13.8](https://github.com/laravel/sail/compare/v1.13.7...v1.13.8) - 2022-03-23 From 30c6b051c474c9d76ace4c91ff61195f8c4a2c6e Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Fri, 8 Apr 2022 11:06:50 +0200 Subject: [PATCH 14/51] Create pull-requests.yml --- .github/workflows/pull-requests.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/pull-requests.yml diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml new file mode 100644 index 00000000..156b46eb --- /dev/null +++ b/.github/workflows/pull-requests.yml @@ -0,0 +1,13 @@ +name: Pull Requests + +on: + pull_request_target: + types: + - opened + +permissions: + pull-requests: write + +jobs: + uneditable: + uses: laravel/.github/.github/workflows/pull-requests.yml@main From cbf55e1a392724313f7726c38578b5e008df6a0f Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Thu, 14 Apr 2022 20:29:22 +0200 Subject: [PATCH 15/51] Fix apt-key for WSL (#384) --- runtimes/7.4/Dockerfile | 2 +- runtimes/8.0/Dockerfile | 2 +- runtimes/8.1/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtimes/7.4/Dockerfile b/runtimes/7.4/Dockerfile index af632c89..f86c49b9 100644 --- a/runtimes/7.4/Dockerfile +++ b/runtimes/7.4/Dockerfile @@ -18,7 +18,7 @@ RUN apt-get update \ && mkdir -p ~/.gnupg \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ + && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php7.4-cli php7.4-dev \ diff --git a/runtimes/8.0/Dockerfile b/runtimes/8.0/Dockerfile index 00063e0e..98aed4bf 100644 --- a/runtimes/8.0/Dockerfile +++ b/runtimes/8.0/Dockerfile @@ -18,7 +18,7 @@ RUN apt-get update \ && mkdir -p ~/.gnupg \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ + && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php8.0-cli php8.0-dev \ diff --git a/runtimes/8.1/Dockerfile b/runtimes/8.1/Dockerfile index d350b5be..c4c56ea7 100644 --- a/runtimes/8.1/Dockerfile +++ b/runtimes/8.1/Dockerfile @@ -18,7 +18,7 @@ RUN apt-get update \ && mkdir -p ~/.gnupg \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ + && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php8.1-cli php8.1-dev \ From 123887447e99bd65e2135ad61cc557cb218adcad Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 19 Apr 2022 15:38:44 +0000 Subject: [PATCH 16/51] Update CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dde7a88..7b49c3f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.13.9...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.13.10...1.x) + +## [v1.13.10](https://github.com/laravel/sail/compare/v1.13.9...v1.13.10) - 2022-04-14 + +### Fixed + +- Fix apt-key for WSL by @driesvints in https://github.com/laravel/sail/pull/384 ## [v1.13.9](https://github.com/laravel/sail/compare/v1.13.8...v1.13.9) - 2022-04-04 From 69013b19d554b2aaa1d57b4237a88e9d720e67d7 Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Sat, 23 Apr 2022 00:50:46 +1000 Subject: [PATCH 17/51] Create a dedicated testing database (#388) --- database/mysql/create-testing-database.sh | 6 ++++++ database/pgsql/create-testing-database.sql | 2 ++ src/Console/InstallCommand.php | 16 ++++++++++++++++ stubs/mariadb.stub | 1 + stubs/mysql.stub | 1 + stubs/pgsql.stub | 1 + 6 files changed, 27 insertions(+) create mode 100755 database/mysql/create-testing-database.sh create mode 100644 database/pgsql/create-testing-database.sql diff --git a/database/mysql/create-testing-database.sh b/database/mysql/create-testing-database.sh new file mode 100755 index 00000000..c20ae5f7 --- /dev/null +++ b/database/mysql/create-testing-database.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +mysql --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL + CREATE DATABASE IF NOT EXISTS testing; + GRANT ALL PRIVILEGES ON testing.* TO '$MYSQL_USER'@'%'; +EOSQL diff --git a/database/pgsql/create-testing-database.sql b/database/pgsql/create-testing-database.sql new file mode 100644 index 00000000..d84dc07b --- /dev/null +++ b/database/pgsql/create-testing-database.sql @@ -0,0 +1,2 @@ +SELECT 'CREATE DATABASE testing' +WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'testing')\gexec diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 9c81f5d6..36797520 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -39,6 +39,7 @@ public function handle() $this->buildDockerCompose($services); $this->replaceEnvVariables($services); + $this->configurePhpUnit(); if ($this->option('devcontainer')) { $this->installDevContainer(); @@ -148,6 +149,21 @@ protected function replaceEnvVariables(array $services) file_put_contents($this->laravel->basePath('.env'), $environment); } + /** + * Configure PHPUnit to use the dedicated testing database. + * + * @return void + */ + protected function configurePhpUnit() + { + $phpunit = file_get_contents($this->laravel->basePath('phpunit.xml')); + + $phpunit = preg_replace('/^.*DB_CONNECTION.*\n/m', '', $phpunit); + $phpunit = str_replace('', '', $phpunit); + + file_put_contents($this->laravel->basePath('phpunit.xml'), $phpunit); + } + /** * Install the devcontainer.json configuration file. * diff --git a/stubs/mariadb.stub b/stubs/mariadb.stub index ec5aa3d0..6beb6bc9 100644 --- a/stubs/mariadb.stub +++ b/stubs/mariadb.stub @@ -11,6 +11,7 @@ MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' volumes: - 'sail-mariadb:/var/lib/mysql' + - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' networks: - sail healthcheck: diff --git a/stubs/mysql.stub b/stubs/mysql.stub index 2e70d8c9..a775a2bc 100644 --- a/stubs/mysql.stub +++ b/stubs/mysql.stub @@ -11,6 +11,7 @@ MYSQL_ALLOW_EMPTY_PASSWORD: 1 volumes: - 'sail-mysql:/var/lib/mysql' + - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' networks: - sail healthcheck: diff --git a/stubs/pgsql.stub b/stubs/pgsql.stub index 5aeced5f..7cff7438 100644 --- a/stubs/pgsql.stub +++ b/stubs/pgsql.stub @@ -9,6 +9,7 @@ POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}' volumes: - 'sail-pgsql:/var/lib/postgresql/data' + - './vendor/laravel/sail/database/pgsql/create-testing-database.sql:/docker-entrypoint-initdb.d/10-create-testing-database.sql' networks: - sail healthcheck: From 453c66fde4109eb49e12299ffe3bf0d667983447 Mon Sep 17 00:00:00 2001 From: Evert van Brussel Date: Wed, 27 Apr 2022 21:10:22 +0800 Subject: [PATCH 18/51] Fix apt-key for WSL (#389) --- runtimes/7.4/Dockerfile | 2 +- runtimes/8.0/Dockerfile | 2 +- runtimes/8.1/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtimes/7.4/Dockerfile b/runtimes/7.4/Dockerfile index f86c49b9..0ca5d9f0 100644 --- a/runtimes/7.4/Dockerfile +++ b/runtimes/7.4/Dockerfile @@ -18,7 +18,7 @@ RUN apt-get update \ && mkdir -p ~/.gnupg \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ + && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php7.4-cli php7.4-dev \ diff --git a/runtimes/8.0/Dockerfile b/runtimes/8.0/Dockerfile index 98aed4bf..ba1b1a16 100644 --- a/runtimes/8.0/Dockerfile +++ b/runtimes/8.0/Dockerfile @@ -18,7 +18,7 @@ RUN apt-get update \ && mkdir -p ~/.gnupg \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ + && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php8.0-cli php8.0-dev \ diff --git a/runtimes/8.1/Dockerfile b/runtimes/8.1/Dockerfile index c4c56ea7..da38211c 100644 --- a/runtimes/8.1/Dockerfile +++ b/runtimes/8.1/Dockerfile @@ -18,7 +18,7 @@ RUN apt-get update \ && mkdir -p ~/.gnupg \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ + && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php8.1-cli php8.1-dev \ From a58578916516d9bfa288fcf7a6ebb4b5e3f0241b Mon Sep 17 00:00:00 2001 From: driesvints Date: Wed, 27 Apr 2022 13:45:45 +0000 Subject: [PATCH 19/51] Update CHANGELOG --- CHANGELOG.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b49c3f7..1591a139 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.13.10...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.14.0...1.x) + +## [v1.14.0](https://github.com/laravel/sail/compare/v1.13.10...v1.14.0) - 2022-04-27 + +### Added + +- Create a dedicated testing database by @jessarcher in https://github.com/laravel/sail/pull/388 + +### Fixed + +- Fix apt-key for WSL by @Evertt in https://github.com/laravel/sail/pull/389 ## [v1.13.10](https://github.com/laravel/sail/compare/v1.13.9...v1.13.10) - 2022-04-14 From 9a7348dedfccc894718a21f71c09d669747e3f33 Mon Sep 17 00:00:00 2001 From: Ryo Kobayashi <40686845+ryoluo@users.noreply.github.com> Date: Mon, 2 May 2022 22:58:40 +0900 Subject: [PATCH 20/51] Expose 8080 port for hot module replacement (#391) --- stubs/docker-compose.stub | 1 + 1 file changed, 1 insertion(+) diff --git a/stubs/docker-compose.stub b/stubs/docker-compose.stub index 040c78ca..fe6356c8 100644 --- a/stubs/docker-compose.stub +++ b/stubs/docker-compose.stub @@ -12,6 +12,7 @@ services: - 'host.docker.internal:host-gateway' ports: - '${APP_PORT:-80}:80' + - '${HMR_PORT:-8080}:8080' environment: WWWUSER: '${WWWUSER}' LARAVEL_SAIL: 1 From 8cf8bbf8add4a39618be5f97b772488e2acf2f23 Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 3 May 2022 15:53:45 +0000 Subject: [PATCH 21/51] Update CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1591a139..188abcca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.14.0...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.14.1...1.x) + +## [v1.14.1](https://github.com/laravel/sail/compare/v1.14.0...v1.14.1) - 2022-05-02 + +### Changed + +- Expose 8080 port for hot module replacement by @ryoluo in https://github.com/laravel/sail/pull/391 ## [v1.14.0](https://github.com/laravel/sail/compare/v1.13.10...v1.14.0) - 2022-04-27 From a7bd0c98d8bac027cc16715b0a661b13ec2dc02a Mon Sep 17 00:00:00 2001 From: Kyle Millloy Date: Thu, 5 May 2022 11:23:34 -0600 Subject: [PATCH 22/51] allow phpunit configuration to work with a dist file --- src/Console/InstallCommand.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 36797520..85258432 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -156,7 +156,13 @@ protected function replaceEnvVariables(array $services) */ protected function configurePhpUnit() { - $phpunit = file_get_contents($this->laravel->basePath('phpunit.xml')); + $file = $this->laravel->basePath('phpunit.xml'); + + if (! file_exists($file)) { + $file = $this->laravel->basePath('phpunit.xml.dist'); + } + + $phpunit = file_get_contents($file); $phpunit = preg_replace('/^.*DB_CONNECTION.*\n/m', '', $phpunit); $phpunit = str_replace('', '', $phpunit); From e02f5896c8486a90d2718afe496d1ad97151306d Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 5 May 2022 13:44:16 -0500 Subject: [PATCH 23/51] formatting --- src/Console/InstallCommand.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 85258432..a12fe9a4 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -156,13 +156,11 @@ protected function replaceEnvVariables(array $services) */ protected function configurePhpUnit() { - $file = $this->laravel->basePath('phpunit.xml'); - - if (! file_exists($file)) { - $file = $this->laravel->basePath('phpunit.xml.dist'); + if (! file_exists($path = $this->laravel->basePath('phpunit.xml'))) { + $path = $this->laravel->basePath('phpunit.xml.dist'); } - $phpunit = file_get_contents($file); + $phpunit = file_get_contents($path); $phpunit = preg_replace('/^.*DB_CONNECTION.*\n/m', '', $phpunit); $phpunit = str_replace('', '', $phpunit); From cee088fbe57432dd15678e3f7b6a8259f3073c46 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Tue, 10 May 2022 14:58:49 +0200 Subject: [PATCH 24/51] Fix missing usage of POSTGRES_VERSION (#398) --- runtimes/8.0/Dockerfile | 2 +- runtimes/8.1/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtimes/8.0/Dockerfile b/runtimes/8.0/Dockerfile index ba1b1a16..08a6ac98 100644 --- a/runtimes/8.0/Dockerfile +++ b/runtimes/8.0/Dockerfile @@ -40,7 +40,7 @@ RUN apt-get update \ && apt-get update \ && apt-get install -y yarn \ && apt-get install -y mysql-client \ - && apt-get install -y postgresql-client \ + && apt-get install -y postgresql-client-$POSTGRES_VERSION \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/runtimes/8.1/Dockerfile b/runtimes/8.1/Dockerfile index da38211c..540b0733 100644 --- a/runtimes/8.1/Dockerfile +++ b/runtimes/8.1/Dockerfile @@ -41,7 +41,7 @@ RUN apt-get update \ && apt-get update \ && apt-get install -y yarn \ && apt-get install -y mysql-client \ - && apt-get install -y postgresql-client \ + && apt-get install -y postgresql-client-$POSTGRES_VERSION \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* From b47d4568a9808b3f815d9eeaff491cb629a6f9bf Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 10 May 2022 15:40:14 +0000 Subject: [PATCH 25/51] Update CHANGELOG --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 188abcca..9dec3187 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.14.1...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.14.2...1.x) + +## [v1.14.2](https://github.com/laravel/sail/compare/v1.14.1...v1.14.2) - 2022-05-10 + +### Fixed + +- Allow Sail to read from phpunit.xml and phpunit.xml.dist when running the install command by @kylemilloy in https://github.com/laravel/sail/pull/394 +- Fix missing usage of POSTGRES_VERSION by @driesvints in https://github.com/laravel/sail/pull/398 ## [v1.14.1](https://github.com/laravel/sail/compare/v1.14.0...v1.14.1) - 2022-05-02 From 2669e6bb9e8a725f18c18c3be31b1ab846516eac Mon Sep 17 00:00:00 2001 From: Mehdi Rajabi Date: Tue, 10 May 2022 21:54:23 +0430 Subject: [PATCH 26/51] Changed os of PHP8.1 to Ubuntu 22.04 LTS (#395) --- runtimes/8.1/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtimes/8.1/Dockerfile b/runtimes/8.1/Dockerfile index 540b0733..30a05c7a 100644 --- a/runtimes/8.1/Dockerfile +++ b/runtimes/8.1/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:21.10 +FROM ubuntu:22.04 LABEL maintainer="Taylor Otwell" @@ -19,7 +19,7 @@ RUN apt-get update \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ - && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ + && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php8.1-cli php8.1-dev \ php8.1-pgsql php8.1-sqlite3 php8.1-gd \ From db461d0d541d88d80a40727ecfb2ac30c07f5804 Mon Sep 17 00:00:00 2001 From: driesvints Date: Thu, 12 May 2022 09:38:11 +0000 Subject: [PATCH 27/51] Update CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dec3187..a56503b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.14.2...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.14.3...1.x) + +## [v1.14.3](https://github.com/laravel/sail/compare/v1.14.2...v1.14.3) - 2022-05-10 + +### Changed + +- Changed Ubuntu 21.10 to Ubuntu 22.04 LTS by @mehdirajabi59 in https://github.com/laravel/sail/pull/395 ## [v1.14.2](https://github.com/laravel/sail/compare/v1.14.1...v1.14.2) - 2022-05-10 From 0e0e51f19c758c79acbda11e3870641fbad5b7d9 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Thu, 12 May 2022 14:53:10 +0200 Subject: [PATCH 28/51] Update Dockerfile --- runtimes/8.1/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtimes/8.1/Dockerfile b/runtimes/8.1/Dockerfile index 30a05c7a..f6f32d20 100644 --- a/runtimes/8.1/Dockerfile +++ b/runtimes/8.1/Dockerfile @@ -36,7 +36,7 @@ RUN apt-get update \ && npm install -g npm \ && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ - && echo "deb http://apt.postgresql.org/pub/repos/apt impish-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ + && echo "deb http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ && curl --silent -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ && apt-get update \ && apt-get install -y yarn \ From 8f528fc5bcf483fecbfe731baa1c5d4dce0694a6 Mon Sep 17 00:00:00 2001 From: driesvints Date: Thu, 12 May 2022 12:54:05 +0000 Subject: [PATCH 29/51] Update CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a56503b4..b1271601 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.14.3...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.14.4...1.x) + +## [v1.14.4](https://github.com/laravel/sail/compare/v1.14.3...v1.14.4) - 2022-05-12 + +### Fixed + +- Fixes incorrectly referenced distro https://github.com/laravel/sail/commit/0e0e51f19c758c79acbda11e3870641fbad5b7d9 ## [v1.14.3](https://github.com/laravel/sail/compare/v1.14.2...v1.14.3) - 2022-05-10 From 1a003c46b5a441495ff910a4a0f1d922834be6b7 Mon Sep 17 00:00:00 2001 From: Mehdi Rajabi Date: Mon, 16 May 2022 20:13:28 +0430 Subject: [PATCH 30/51] Updated sail helps section (#407) * Updated sail help section * Update sail * Update sail Co-authored-by: Taylor Otwell --- bin/sail | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/sail b/bin/sail index f09f3c1a..40e31740 100755 --- a/bin/sail +++ b/bin/sail @@ -83,6 +83,7 @@ function display_help { echo " ${GREEN}sail test${NC} Run the PHPUnit tests via the Artisan test command" echo " ${GREEN}sail phpunit ...${NC} Run PHPUnit" echo " ${GREEN}sail dusk${NC} Run the Dusk tests (Requires the laravel/dusk package)" + echo " ${GREEN}sail dusk:fails${NC} Re-run previously failed Dusk tests (Requires the laravel/dusk package)" echo echo "${YELLOW}Container CLI:${NC}" echo " ${GREEN}sail shell${NC} Start a shell session within the application container" @@ -94,6 +95,9 @@ function display_help { echo "${YELLOW}Sharing:${NC}" echo " ${GREEN}sail share${NC} Share the application publicly via a temporary URL" echo + echo "${YELLOW}Binaries:${NC}" + echo " ${GREEN}sail bin ...${NC} Run Composer binary scripts from the vendor/bin directory" + echo echo "${YELLOW}Customization:${NC}" echo " ${GREEN}sail artisan sail:publish${NC} Publish the Sail configuration files" echo " ${GREEN}sail build --no-cache${NC} Rebuild all of the Sail containers" From 4b90a06d761850665b022f1c312c802959327283 Mon Sep 17 00:00:00 2001 From: tbollinger Date: Mon, 16 May 2022 14:12:29 -0400 Subject: [PATCH 31/51] Cleans up deprecated apt-key usage (#408) * Replacing deprecated apt-key command for 8.1 * Replacing deprecated apt-key command for 8.0 * Replacing deprecated apt-key command for 7.4 * Force curl commands to display output on errors Co-authored-by: Trenton Bollinger --- runtimes/7.4/Dockerfile | 16 +++++++++------- runtimes/8.0/Dockerfile | 16 +++++++++------- runtimes/8.1/Dockerfile | 16 +++++++++------- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/runtimes/7.4/Dockerfile b/runtimes/7.4/Dockerfile index 0ca5d9f0..cc500cec 100644 --- a/runtimes/7.4/Dockerfile +++ b/runtimes/7.4/Dockerfile @@ -18,8 +18,10 @@ RUN apt-get update \ && mkdir -p ~/.gnupg \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ - && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ + && echo "keyserver hkp://keyserver.ubuntu.com:80" >> ~/.gnupg/dirmngr.conf \ + && gpg --recv-key 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c \ + && gpg --export 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c > /usr/share/keyrings/ppa_ondrej_php.gpg \ + && echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php7.4-cli php7.4-dev \ php7.4-pgsql php7.4-sqlite3 php7.4-gd \ @@ -30,13 +32,13 @@ RUN apt-get update \ php7.4-msgpack php7.4-igbinary php7.4-ldap \ php7.4-redis php7.4-xdebug \ && php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \ - && curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \ + && curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \ && apt-get install -y nodejs \ && npm install -g npm \ - && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ - && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ - && echo "deb http://apt.postgresql.org/pub/repos/apt impish-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ - && curl --silent -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ + && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null \ + && echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \ + && echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt impish-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ && apt-get update \ && apt-get install -y yarn \ && apt-get install -y mysql-client \ diff --git a/runtimes/8.0/Dockerfile b/runtimes/8.0/Dockerfile index 08a6ac98..096adad9 100644 --- a/runtimes/8.0/Dockerfile +++ b/runtimes/8.0/Dockerfile @@ -18,8 +18,10 @@ RUN apt-get update \ && mkdir -p ~/.gnupg \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ - && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ + && echo "keyserver hkp://keyserver.ubuntu.com:80" >> ~/.gnupg/dirmngr.conf \ + && gpg --recv-key 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c \ + && gpg --export 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c > /usr/share/keyrings/ppa_ondrej_php.gpg \ + && echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu impish main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php8.0-cli php8.0-dev \ php8.0-pgsql php8.0-sqlite3 php8.0-gd \ @@ -30,13 +32,13 @@ RUN apt-get update \ php8.0-msgpack php8.0-igbinary php8.0-ldap \ php8.0-redis php8.0-swoole php8.0-xdebug \ && php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \ - && curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \ + && curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \ && apt-get install -y nodejs \ && npm install -g npm \ - && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ - && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ - && echo "deb http://apt.postgresql.org/pub/repos/apt impish-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ - && curl --silent -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ + && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null \ + && echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \ + && echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt impish-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ && apt-get update \ && apt-get install -y yarn \ && apt-get install -y mysql-client \ diff --git a/runtimes/8.1/Dockerfile b/runtimes/8.1/Dockerfile index f6f32d20..0277709f 100644 --- a/runtimes/8.1/Dockerfile +++ b/runtimes/8.1/Dockerfile @@ -18,8 +18,10 @@ RUN apt-get update \ && mkdir -p ~/.gnupg \ && chmod 600 ~/.gnupg \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ - && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \ - && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ + && echo "keyserver hkp://keyserver.ubuntu.com:80" >> ~/.gnupg/dirmngr.conf \ + && gpg --recv-key 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c \ + && gpg --export 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c > /usr/share/keyrings/ppa_ondrej_php.gpg \ + && echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ && apt-get update \ && apt-get install -y php8.1-cli php8.1-dev \ php8.1-pgsql php8.1-sqlite3 php8.1-gd \ @@ -31,13 +33,13 @@ RUN apt-get update \ php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole \ php8.1-memcached php8.1-pcov php8.1-xdebug \ && php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \ - && curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \ + && curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \ && apt-get install -y nodejs \ && npm install -g npm \ - && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ - && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ - && echo "deb http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ - && curl --silent -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ + && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarn.gpg >/dev/null \ + && echo "deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \ + && echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ && apt-get update \ && apt-get install -y yarn \ && apt-get install -y mysql-client \ From 1da083e30e6b0d646535c0afc2afeffdccb7181d Mon Sep 17 00:00:00 2001 From: Erfan <37825504+erfantkerfan@users.noreply.github.com> Date: Mon, 16 May 2022 22:43:03 +0430 Subject: [PATCH 32/51] use docker compose (GO) (#405) --- bin/sail | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/sail b/bin/sail index 40e31740..e5072568 100755 --- a/bin/sail +++ b/bin/sail @@ -142,10 +142,10 @@ function sail_is_not_running { } # Define Docker Compose command prefix... -if [ -x "$(command -v docker-compose)" ]; then - DOCKER_COMPOSE=(docker-compose) -else +if [ -x "$(command -v docker compose)" ]; then DOCKER_COMPOSE=(docker compose) +else + DOCKER_COMPOSE=(docker-compose) fi if [ -n "$SAIL_FILES" ]; then From 6e4847f0d4f2865f2168f6d806d5309ad2860de9 Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 17 May 2022 15:45:44 +0000 Subject: [PATCH 33/51] Update CHANGELOG --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1271601..27e4190e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.14.4...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.14.5...1.x) + +## [v1.14.5](https://github.com/laravel/sail/compare/v1.14.4...v1.14.5) - 2022-05-16 + +### Changed + +- Updated sail helps section by @mehdirajabi59 in https://github.com/laravel/sail/pull/407 +- Cleans up deprecated apt-key usage by @tbollinger in https://github.com/laravel/sail/pull/408 +- use docker compose (GO) by @erfantkerfan in https://github.com/laravel/sail/pull/405 ## [v1.14.4](https://github.com/laravel/sail/compare/v1.14.3...v1.14.4) - 2022-05-12 From f00f3a8f83e71436d473cda7700ae7b4b68d26cc Mon Sep 17 00:00:00 2001 From: Affekt Software Development Date: Wed, 18 May 2022 17:56:59 +0200 Subject: [PATCH 34/51] Checks if docker compose or docker-compose is installed (#409) Co-authored-by: Benjamin Takats --- bin/sail | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/sail b/bin/sail index e5072568..e2ac5774 100755 --- a/bin/sail +++ b/bin/sail @@ -142,7 +142,8 @@ function sail_is_not_running { } # Define Docker Compose command prefix... -if [ -x "$(command -v docker compose)" ]; then +docker compose &> /dev/null +if [ $? == 0 ]; then DOCKER_COMPOSE=(docker compose) else DOCKER_COMPOSE=(docker-compose) From c049316f9bcb02598607307f18b514b66202b639 Mon Sep 17 00:00:00 2001 From: tdondich Date: Sat, 21 May 2022 10:14:14 -0700 Subject: [PATCH 35/51] Update meilisearch stub to reflect new data path (#414) Meilisearch, since v0.27 has updated their working data path to /meili_data. See: https://blog.meilisearch.com/whats-new-in-v0-27/ --- stubs/meilisearch.stub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/meilisearch.stub b/stubs/meilisearch.stub index 538d56d7..bd236c00 100644 --- a/stubs/meilisearch.stub +++ b/stubs/meilisearch.stub @@ -3,7 +3,7 @@ ports: - '${FORWARD_MEILISEARCH_PORT:-7700}:7700' volumes: - - 'sail-meilisearch:/data.ms' + - 'sail-meilisearch:/meili_data' networks: - sail healthcheck: From 344078fca62af81ad5c5bd2e1805c15cd16318c0 Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 24 May 2022 15:11:25 +0000 Subject: [PATCH 36/51] Update CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27e4190e..1ab10977 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.14.5...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.14.6...1.x) + +## [v1.14.6](https://github.com/laravel/sail/compare/v1.14.5...v1.14.6) - 2022-05-18 + +### Fixed + +- Checks if docker compose or docker-compose is installed by @affektde in https://github.com/laravel/sail/pull/409 ## [v1.14.5](https://github.com/laravel/sail/compare/v1.14.4...v1.14.5) - 2022-05-16 From e334a678a4678e60882d7ee649f06d81bb4ac313 Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 24 May 2022 15:11:47 +0000 Subject: [PATCH 37/51] Update CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ab10977..d2c374f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.14.6...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.14.7...1.x) + +## [v1.14.7](https://github.com/laravel/sail/compare/v1.14.6...v1.14.7) - 2022-05-21 + +### Changed + +- Update meilisearch stub to reflect new data path by @tdondich in https://github.com/laravel/sail/pull/414 ## [v1.14.6](https://github.com/laravel/sail/compare/v1.14.5...v1.14.6) - 2022-05-18 From 04b425968c6a76940bddd2cfa40bf9e9ce78eee8 Mon Sep 17 00:00:00 2001 From: Ryo Kobayashi <40686845+ryoluo@users.noreply.github.com> Date: Tue, 31 May 2022 23:48:21 +0900 Subject: [PATCH 38/51] Run supervisord with pid 1 (#419) --- runtimes/7.4/start-container | 2 +- runtimes/8.0/start-container | 2 +- runtimes/8.1/start-container | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtimes/7.4/start-container b/runtimes/7.4/start-container index b99ddd05..b8643990 100644 --- a/runtimes/7.4/start-container +++ b/runtimes/7.4/start-container @@ -13,5 +13,5 @@ chmod -R ugo+rw /.composer if [ $# -gt 0 ]; then exec gosu $WWWUSER "$@" else - /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf + exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf fi diff --git a/runtimes/8.0/start-container b/runtimes/8.0/start-container index b99ddd05..b8643990 100644 --- a/runtimes/8.0/start-container +++ b/runtimes/8.0/start-container @@ -13,5 +13,5 @@ chmod -R ugo+rw /.composer if [ $# -gt 0 ]; then exec gosu $WWWUSER "$@" else - /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf + exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf fi diff --git a/runtimes/8.1/start-container b/runtimes/8.1/start-container index b99ddd05..b8643990 100644 --- a/runtimes/8.1/start-container +++ b/runtimes/8.1/start-container @@ -13,5 +13,5 @@ chmod -R ugo+rw /.composer if [ $# -gt 0 ]; then exec gosu $WWWUSER "$@" else - /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf + exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf fi From e05b22f52e3c957e732fea8d1f754715948e1f3a Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 31 May 2022 15:21:58 +0000 Subject: [PATCH 39/51] Update CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2c374f3..f219dc8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.14.7...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.14.8...1.x) + +## [v1.14.8](https://github.com/laravel/sail/compare/v1.14.7...v1.14.8) - 2022-05-31 + +### Changed + +- Run supervisord with pid 1 by @ryoluo in https://github.com/laravel/sail/pull/419 ## [v1.14.7](https://github.com/laravel/sail/compare/v1.14.6...v1.14.7) - 2022-05-21 From 8435763e7735f6eff15b03df014cea1217fc826e Mon Sep 17 00:00:00 2001 From: Bram Date: Mon, 6 Jun 2022 16:28:04 +0200 Subject: [PATCH 40/51] Allow for creation of databases needed for parallel testing (#424) --- database/mysql/create-testing-database.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/mysql/create-testing-database.sh b/database/mysql/create-testing-database.sh index c20ae5f7..c98b1367 100755 --- a/database/mysql/create-testing-database.sh +++ b/database/mysql/create-testing-database.sh @@ -2,5 +2,5 @@ mysql --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL CREATE DATABASE IF NOT EXISTS testing; - GRANT ALL PRIVILEGES ON testing.* TO '$MYSQL_USER'@'%'; + GRANT ALL PRIVILEGES ON `testing%`.* TO '$MYSQL_USER'@'%'; EOSQL From ba4061e6b7ab0e4d3c8f415f8c86821b981b5eb0 Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 7 Jun 2022 15:21:44 +0000 Subject: [PATCH 41/51] Update CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f219dc8b..a8e6dfba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.14.8...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.14.9...1.x) + +## [v1.14.9](https://github.com/laravel/sail/compare/v1.14.8...v1.14.9) - 2022-06-06 + +### Changed + +- Allow for creation of databases needed for parallel testing by @bram-pkg in https://github.com/laravel/sail/pull/424 ## [v1.14.8](https://github.com/laravel/sail/compare/v1.14.7...v1.14.8) - 2022-05-31 From 5af71e09cda31741490a03e185497c741a2a55e3 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Wed, 8 Jun 2022 11:32:21 +0200 Subject: [PATCH 42/51] Update pull-requests.yml --- .github/workflows/pull-requests.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml index 156b46eb..18b32b32 100644 --- a/.github/workflows/pull-requests.yml +++ b/.github/workflows/pull-requests.yml @@ -1,9 +1,8 @@ -name: Pull Requests +name: pull requests on: pull_request_target: - types: - - opened + types: [opened] permissions: pull-requests: write From aa3e334abb51f2a4b2d995d986c5e76d08448114 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Wed, 8 Jun 2022 11:33:50 +0200 Subject: [PATCH 43/51] Update update-changelog.yml --- .github/workflows/update-changelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index eaeaf1f8..1625bda1 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -1,4 +1,4 @@ -name: "Update Changelog" +name: update changelog on: release: From 0ea5d683af4d189071efcdb9e83946c10dab82c3 Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Thu, 9 Jun 2022 17:10:28 +1000 Subject: [PATCH 44/51] Fix testing DB creation (#429) --- database/mysql/create-testing-database.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/mysql/create-testing-database.sh b/database/mysql/create-testing-database.sh index c98b1367..aeb1826f 100755 --- a/database/mysql/create-testing-database.sh +++ b/database/mysql/create-testing-database.sh @@ -2,5 +2,5 @@ mysql --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL CREATE DATABASE IF NOT EXISTS testing; - GRANT ALL PRIVILEGES ON `testing%`.* TO '$MYSQL_USER'@'%'; + GRANT ALL PRIVILEGES ON \`testing%\`.* TO '$MYSQL_USER'@'%'; EOSQL From 757648756b420dbd188c0bd7c4aab13fb4acc254 Mon Sep 17 00:00:00 2001 From: driesvints Date: Thu, 9 Jun 2022 07:11:26 +0000 Subject: [PATCH 45/51] Update CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8e6dfba..e4f98cd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.14.9...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.14.10...1.x) + +## [v1.14.10](https://github.com/laravel/sail/compare/v1.14.9...v1.14.10) - 2022-06-09 + +### Fixed + +- Fix testing DB creation by @jessarcher in https://github.com/laravel/sail/pull/429 ## [v1.14.9](https://github.com/laravel/sail/compare/v1.14.8...v1.14.9) - 2022-06-06 From 6edf45a247b3688e0d07e149570a62fd9bc11c73 Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Tue, 14 Jun 2022 04:32:48 +1000 Subject: [PATCH 46/51] Revert "Expose 8080 port for hot module replacement (#391)" (#432) This reverts commit 9a7348dedfccc894718a21f71c09d669747e3f33. --- stubs/docker-compose.stub | 1 - 1 file changed, 1 deletion(-) diff --git a/stubs/docker-compose.stub b/stubs/docker-compose.stub index fe6356c8..040c78ca 100644 --- a/stubs/docker-compose.stub +++ b/stubs/docker-compose.stub @@ -12,7 +12,6 @@ services: - 'host.docker.internal:host-gateway' ports: - '${APP_PORT:-80}:80' - - '${HMR_PORT:-8080}:8080' environment: WWWUSER: '${WWWUSER}' LARAVEL_SAIL: 1 From d953120ec318db3f176e14e55927ace10197eb64 Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 21 Jun 2022 15:18:12 +0000 Subject: [PATCH 47/51] Update CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4f98cd5..0190ebe3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.14.10...1.x) +## [Unreleased](https://github.com/laravel/sail/compare/v1.14.11...1.x) + +## [v1.14.11](https://github.com/laravel/sail/compare/v1.14.10...v1.14.11) - 2022-06-14 + +### Fixed + +- Revert "Expose 8080 port for hot module replacement" by @jessarcher in https://github.com/laravel/sail/pull/432 ## [v1.14.10](https://github.com/laravel/sail/compare/v1.14.9...v1.14.10) - 2022-06-09 From b69e7bceb09c65e4bf5a3d4169bc28275798aec7 Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Wed, 22 Jun 2022 05:51:16 +1000 Subject: [PATCH 48/51] Publish Vite port (#433) --- stubs/docker-compose.stub | 1 + 1 file changed, 1 insertion(+) diff --git a/stubs/docker-compose.stub b/stubs/docker-compose.stub index 040c78ca..3904765d 100644 --- a/stubs/docker-compose.stub +++ b/stubs/docker-compose.stub @@ -12,6 +12,7 @@ services: - 'host.docker.internal:host-gateway' ports: - '${APP_PORT:-80}:80' + - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' environment: WWWUSER: '${WWWUSER}' LARAVEL_SAIL: 1 From 087d166189ca0e7134cae21d7f4e09f07853f4f5 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 23 Jun 2022 14:48:43 +0100 Subject: [PATCH 49/51] Adds `sail pint` (#439) --- bin/sail | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bin/sail b/bin/sail index e2ac5774..b6266eb5 100755 --- a/bin/sail +++ b/bin/sail @@ -82,6 +82,7 @@ function display_help { echo "${YELLOW}Running Tests:${NC}" echo " ${GREEN}sail test${NC} Run the PHPUnit tests via the Artisan test command" echo " ${GREEN}sail phpunit ...${NC} Run PHPUnit" + echo " ${GREEN}sail pint ...${NC} Run Pint" echo " ${GREEN}sail dusk${NC} Run the Dusk tests (Requires the laravel/dusk package)" echo " ${GREEN}sail dusk:fails${NC} Re-run previously failed Dusk tests (Requires the laravel/dusk package)" echo @@ -284,6 +285,18 @@ elif [ "$1" == "phpunit" ]; then sail_is_not_running fi +# Proxy the "pint" command to "php vendor/bin/pint"... +elif [ "$1" == "pint" ]; then + shift 1 + + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" php vendor/bin/pint "$@") + else + sail_is_not_running + fi + # Proxy the "dusk" command to the "php artisan dusk" Artisan command... elif [ "$1" == "dusk" ]; then shift 1 From 52a14c005172b36c38040d9aaa5427c86b8e6336 Mon Sep 17 00:00:00 2001 From: GoodM4ven <81492351+GoodM4ven@users.noreply.github.com> Date: Thu, 23 Jun 2022 17:51:33 +0300 Subject: [PATCH 50/51] [1.x] Fixed devcontainer permissions (#438) Co-authored-by: GoodM4ven --- stubs/devcontainer.stub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/devcontainer.stub b/stubs/devcontainer.stub index e1c9005e..271144ab 100644 --- a/stubs/devcontainer.stub +++ b/stubs/devcontainer.stub @@ -15,8 +15,8 @@ // "onecentlin.laravel-blade" ], "remoteUser": "sail", + "postCreateCommand": "chown -R 1000:1000 /var/www/html" // "forwardPorts": [], // "runServices": [], - // "postCreateCommand": "apt-get update && apt-get install -y curl", // "shutdownAction": "none", } From 676e1ff33c1b8af657779f62f57360c376cba666 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Fri, 24 Jun 2022 15:56:11 +0200 Subject: [PATCH 51/51] Update default PostgreSQL versions for PHP 8.0 and 7.4 runtimes (#441) * Update Dockerfile * Update Dockerfile --- runtimes/7.4/Dockerfile | 2 +- runtimes/8.0/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtimes/7.4/Dockerfile b/runtimes/7.4/Dockerfile index cc500cec..ef5f9ed5 100644 --- a/runtimes/7.4/Dockerfile +++ b/runtimes/7.4/Dockerfile @@ -4,7 +4,7 @@ LABEL maintainer="Taylor Otwell" ARG WWWGROUP ARG NODE_VERSION=16 -ARG POSTGRES_VERSION=14 +ARG POSTGRES_VERSION=13 WORKDIR /var/www/html diff --git a/runtimes/8.0/Dockerfile b/runtimes/8.0/Dockerfile index 096adad9..13d80427 100644 --- a/runtimes/8.0/Dockerfile +++ b/runtimes/8.0/Dockerfile @@ -4,7 +4,7 @@ LABEL maintainer="Taylor Otwell" ARG WWWGROUP ARG NODE_VERSION=16 -ARG POSTGRES_VERSION=14 +ARG POSTGRES_VERSION=13 WORKDIR /var/www/html