diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml new file mode 100644 index 00000000..18b32b32 --- /dev/null +++ b/.github/workflows/pull-requests.yml @@ -0,0 +1,12 @@ +name: pull requests + +on: + pull_request_target: + types: [opened] + +permissions: + pull-requests: write + +jobs: + uneditable: + uses: laravel/.github/.github/workflows/pull-requests.yml@main diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index 0200e2b9..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: @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 93c9d87a..0190ebe3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,121 @@ # Release Notes -## [Unreleased](https://github.com/laravel/sail/compare/v1.13.5...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 + +### 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 + +### 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 + +### 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 + +### 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 + +### 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 + +### 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 + +### 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 + +### 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 + +### 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 + +### 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 + +### 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 + +### 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 + +### 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 + +### 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 + +### 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 + +### 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 diff --git a/bin/sail b/bin/sail index c721d8ac..b6266eb5 100755 --- a/bin/sail +++ b/bin/sail @@ -1,15 +1,7 @@ #!/usr/bin/env bash -if ! [ -x "$(command -v docker-compose)" ]; then - shopt -s expand_aliases - alias docker-compose='docker compose' -fi - UNAMEOUT="$(uname -s)" -WHITE='\033[1;37m' -NC='\033[0m' - # Verify operating system is supported... case "${UNAMEOUT}" in Linux*) MACHINE=linux;; @@ -23,6 +15,106 @@ 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 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 + 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}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" + + 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 @@ -35,7 +127,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} @@ -43,318 +135,352 @@ 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 } +# Define Docker Compose command prefix... +docker compose &> /dev/null +if [ $? == 0 ]; then + DOCKER_COMPOSE=(docker compose) +else + DOCKER_COMPOSE=(docker-compose) +fi + +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 "${BOLD}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 - 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... - PSRESULT="$(docker-compose -f "$SAIL_FILE" ps -q)" - if docker-compose -f "$SAIL_FILE" 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 -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 -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 "$@" - else - sail_is_not_running - fi +ARGS=() - # Proxy vendor binary commands on the application container... - elif [ "$1" == "bin" ]; then - shift 1 +# 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" \ - ./vendor/bin/"$@" - else - sail_is_not_running - fi + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" "php" "$@") + else + sail_is_not_running + fi - # Proxy Composer commands to the "composer" binary on the application container... - elif [ "$1" == "composer" ]; then - shift 1 +# Proxy vendor binary commands on the application container... +elif [ "$1" == "bin" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - composer "$@" - 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 Artisan commands to the "artisan" binary on the application container... - elif [ "$1" == "artisan" ] || [ "$1" == "art" ]; then - shift 1 +# Proxy docker-compose commands to the docker-compose binary on the application container... +elif [ "$1" == "docker-compose" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$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" "${DOCKER_COMPOSE[@]}") + 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 Composer commands to the "composer" binary on the application container... +elif [ "$1" == "composer" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - -e XDEBUG_SESSION=1 \ - "$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" "composer" "$@") + else + sail_is_not_running + fi - # Proxy the "test" command to the "php artisan test" Artisan command... - elif [ "$1" == "test" ]; 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 - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - php artisan test "$@" - 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 the "phpunit" command to "php vendor/bin/phpunit"... - elif [ "$1" == "phpunit" ]; 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 - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - php vendor/bin/phpunit "$@" - 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 the "dusk" command to the "php artisan dusk" Artisan command... - elif [ "$1" == "dusk" ]; 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 "$@" - 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:fails" command to the "php artisan dusk:fails" Artisan command... - elif [ "$1" == "dusk:fails" ]; 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 "$@" - 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 - # Initiate a Laravel Tinker session within the application container... - elif [ "$1" == "tinker" ] ; then - shift 1 +# Proxy the "phpunit" command to "php vendor/bin/phpunit"... +elif [ "$1" == "phpunit" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - php artisan tinker - 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 Node commands to the "node" binary on the application container... - elif [ "$1" == "node" ]; then - shift 1 +# Proxy the "pint" command to "php vendor/bin/pint"... +elif [ "$1" == "pint" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$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 vendor/bin/pint "$@") + else + sail_is_not_running + fi - # Proxy NPM commands to the "npm" binary on the application container... - elif [ "$1" == "npm" ]; then - shift 1 +# Proxy the "dusk" command to the "php artisan dusk" Artisan command... +elif [ "$1" == "dusk" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - npm "$@" - 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 NPX commands to the "npx" binary on the application container... - elif [ "$1" == "npx" ]; 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 - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - npx "$@" - 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 YARN commands to the "yarn" binary on the application container... - elif [ "$1" == "yarn" ]; then - shift 1 +# Initiate a Laravel Tinker session within the application container... +elif [ "$1" == "tinker" ] ; then + shift 1 - if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - yarn "$@" - 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 - # Initiate a MySQL CLI terminal session within the "mysql" container... - elif [ "$1" == "mysql" ]; then - shift 1 +# Proxy Node commands to the "node" binary on the application container... +elif [ "$1" == "node" ]; 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}' - 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 - # Initiate a MySQL CLI terminal session within the "mariadb" container... - elif [ "$1" == "mariadb" ]; then - shift 1 +# Proxy NPM commands to the "npm" binary on the application container... +elif [ "$1" == "npm" ]; 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}' - 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 - # Initiate a PostgreSQL CLI terminal session within the "pgsql" container... - elif [ "$1" == "psql" ]; then - shift 1 +# Proxy NPX commands to the "npx" binary on the application container... +elif [ "$1" == "npx" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - pgsql \ - bash -c 'PGPASSWORD=${PGPASSWORD} psql -U ${POSTGRES_USER} ${POSTGRES_DB}' - 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 Bash shell within the application container... - elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; then - shift 1 +# Proxy YARN commands to the "yarn" binary on the application container... +elif [ "$1" == "yarn" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - -u sail \ - "$APP_SERVICE" \ - bash "$@" - 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 root user Bash shell within the application container... - elif [ "$1" == "root-shell" ] ; then - shift 1 +# Initiate a MySQL CLI terminal session within the "mysql" container... +elif [ "$1" == "mysql" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - "$APP_SERVICE" \ - bash "$@" - 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 Redis CLI terminal session within the "redis" container... - elif [ "$1" == "redis" ] ; then - shift 1 +# Initiate a MySQL CLI terminal session within the "mariadb" container... +elif [ "$1" == "mariadb" ]; then + shift 1 - if [ "$EXEC" == "yes" ]; then - docker-compose -f $SAIL_FILE exec \ - redis \ - redis-cli - 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 PostgreSQL CLI terminal session within the "pgsql" container... +elif [ "$1" == "psql" ]; then + shift 1 - # Share the site... - elif [ "$1" == "share" ]; 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 - docker run --init --rm -p $SAIL_SHARE_DASHBOARD:4040 -t beyondcodegmbh/expose-server:latest share http://host.docker.internal:"$APP_PORT" \ +# Initiate a Bash shell within the application container... +elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; 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 + +# 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+=("$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 + + if [ "$EXEC" == "yes" ]; then + ARGS+=(exec) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=(redis redis-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" \ --server-host="$SAIL_SHARE_SERVER_HOST" \ --server-port="$SAIL_SHARE_SERVER_PORT" \ --auth="$SAIL_SHARE_TOKEN" \ --subdomain="$SAIL_SHARE_SUBDOMAIN" \ "$@" - else - sail_is_not_running - fi - # Pass unknown commands to the "docker-compose" binary... + exit else - docker-compose -f $SAIL_FILE "$@" + sail_is_not_running fi + +# Pass unknown commands to the "docker-compose" binary... else - docker-compose -f $SAIL_FILE ps + ARGS+=("$@") fi + +# Run Docker Compose with the defined arguments... +"${DOCKER_COMPOSE[@]}" "${ARGS[@]}" diff --git a/database/mysql/create-testing-database.sh b/database/mysql/create-testing-database.sh new file mode 100755 index 00000000..aeb1826f --- /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/runtimes/7.4/Dockerfile b/runtimes/7.4/Dockerfile index feab9d52..ef5f9ed5 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=13 WORKDIR /var/www/html @@ -17,9 +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 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 \ + && 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,15 +32,17 @@ 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 \ + && 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 \ - && 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/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/Dockerfile b/runtimes/8.0/Dockerfile index 152a0b65..13d80427 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=13 WORKDIR /var/www/html @@ -17,9 +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 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 \ + && 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,15 +32,17 @@ 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 \ + && 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 \ - && 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/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/Dockerfile b/runtimes/8.1/Dockerfile index a29bd44c..0277709f 100644 --- a/runtimes/8.1/Dockerfile +++ b/runtimes/8.1/Dockerfile @@ -1,9 +1,10 @@ -FROM ubuntu:21.10 +FROM ubuntu:22.04 LABEL maintainer="Taylor Otwell" ARG WWWGROUP ARG NODE_VERSION=16 +ARG POSTGRES_VERSION=14 WORKDIR /var/www/html @@ -17,9 +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 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 \ + && 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,15 +33,17 @@ 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 \ + && 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 \ - && 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/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 diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 9c81f5d6..a12fe9a4 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,25 @@ 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() + { + if (! file_exists($path = $this->laravel->basePath('phpunit.xml'))) { + $path = $this->laravel->basePath('phpunit.xml.dist'); + } + + $phpunit = file_get_contents($path); + + $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/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", } 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 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/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: 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 4d80895c..7cff7438 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: @@ -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: