D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
t
/
a
/
t
/
tattooscyy
/
www
/
public
/
plugins
/
cropper
/
css
/
canvas
/
Filename :
sail.tar
back
Copy
README.md 0000604 00000003735 15225276652 0006043 0 ustar 00 <p align="center"><img src="https://raw.githubusercontent.com/laravel/sail/HEAD/art/logo.svg" alt="Logo Laravel Sail"></p> <p align="center"> <a href="https://packagist.org/packages/laravel/sail"> <img src="https://img.shields.io/packagist/dt/laravel/sail" alt="Total Downloads"> </a> <a href="https://packagist.org/packages/laravel/sail"> <img src="https://img.shields.io/packagist/v/laravel/sail" alt="Latest Stable Version"> </a> <a href="https://packagist.org/packages/laravel/sail"> <img src="https://img.shields.io/packagist/l/laravel/sail" alt="License"> </a> </p> ## Introduction Sail provides a Docker powered local development experience for Laravel that is compatible with macOS, Windows (WSL2), and Linux. Other than Docker, no software or libraries are required to be installed on your local computer before using Sail. Sail's simple CLI means you can start building your Laravel application without any previous Docker experience. #### Inspiration Laravel Sail is inspired by and derived from [Vessel](https://github.com/shipping-docker/vessel) by [Chris Fidao](https://github.com/fideloper). If you're looking for a thorough introduction to Docker, check out Chris' course: [Shipping Docker](https://serversforhackers.com/shipping-docker). ## Official Documentation Documentation for Sail can be found on the [Laravel website](https://laravel.com/docs/sail). ## Contributing Thank you for considering contributing to Sail! You can read the contribution guide [here](.github/CONTRIBUTING.md). ## Code of Conduct In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). ## Security Vulnerabilities Please review [our security policy](https://github.com/laravel/sail/security/policy) on how to report security vulnerabilities. ## License Laravel Sail is open-sourced software licensed under the [MIT license](LICENSE.md). runtimes/8.0/supervisord.conf 0000604 00000000566 15225276652 0012172 0 ustar 00 [supervisord] nodaemon=true user=root logfile=/var/log/supervisor/supervisord.log pidfile=/var/run/supervisord.pid [program:php] command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80 user=sail environment=LARAVEL_SAIL="1" stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 runtimes/8.0/php.ini 0000604 00000000116 15225276652 0010215 0 ustar 00 [PHP] post_max_size = 100M upload_max_filesize = 100M variables_order = EGPCS runtimes/8.0/start-container 0000604 00000000442 15225276652 0011767 0 ustar 00 #!/usr/bin/env bash if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER sail fi if [ ! -d /.composer ]; then mkdir /.composer fi chmod -R ugo+rw /.composer if [ $# -gt 0 ];then exec gosu $WWWUSER "$@" else /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf fi runtimes/8.0/Dockerfile 0000604 00000004342 15225276652 0010724 0 ustar 00 FROM ubuntu:21.04 LABEL maintainer="Taylor Otwell" ARG WWWGROUP WORKDIR /var/www/html ENV DEBIAN_FRONTEND noninteractive ENV TZ=UTC RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update \ && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 \ && 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 hirsute 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 \ php8.0-curl php8.0-memcached \ php8.0-imap php8.0-mysql php8.0-mbstring \ php8.0-xml php8.0-zip php8.0-bcmath php8.0-soap \ php8.0-intl php8.0-readline php8.0-pcov \ php8.0-msgpack php8.0-igbinary php8.0-ldap \ php8.0-redis php8.0-swoole php8.0-xdebug \ && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \ && curl -sL https://deb.nodesource.com/setup_16.x | bash - \ && apt-get install -y nodejs \ && 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 \ && apt-get update \ && apt-get install -y yarn \ && apt-get install -y mysql-client \ && apt-get install -y postgresql-client \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.0 RUN groupadd --force -g $WWWGROUP sail RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail COPY start-container /usr/local/bin/start-container COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY php.ini /etc/php/8.0/cli/conf.d/99-sail.ini RUN chmod +x /usr/local/bin/start-container EXPOSE 8000 ENTRYPOINT ["start-container"] runtimes/7.4/start-container 0000604 00000000442 15225276652 0011772 0 ustar 00 #!/usr/bin/env bash if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER sail fi if [ ! -d /.composer ]; then mkdir /.composer fi chmod -R ugo+rw /.composer if [ $# -gt 0 ];then exec gosu $WWWUSER "$@" else /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf fi runtimes/7.4/Dockerfile 0000604 00000004324 15225276652 0010727 0 ustar 00 FROM ubuntu:21.04 LABEL maintainer="Taylor Otwell" ARG WWWGROUP WORKDIR /var/www/html ENV DEBIAN_FRONTEND noninteractive ENV TZ=UTC RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update \ && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 \ && 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 hirsute 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 \ php7.4-curl php7.4-memcached \ php7.4-imap php7.4-mysql php7.4-mbstring \ php7.4-xml php7.4-zip php7.4-bcmath php7.4-soap \ php7.4-intl php7.4-readline php7.4-pcov \ php7.4-msgpack php7.4-igbinary php7.4-ldap \ php7.4-redis php7.4-xdebug \ && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \ && curl -sL https://deb.nodesource.com/setup_16.x | bash - \ && apt-get install -y nodejs \ && 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 \ && apt-get update \ && apt-get install -y yarn \ && apt-get install -y mysql-client \ && apt-get install -y postgresql-client \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN setcap "cap_net_bind_service=+ep" /usr/bin/php7.4 RUN groupadd --force -g $WWWGROUP sail RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail COPY start-container /usr/local/bin/start-container COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY php.ini /etc/php/7.4/cli/conf.d/99-sail.ini RUN chmod +x /usr/local/bin/start-container EXPOSE 8000 ENTRYPOINT ["start-container"] runtimes/7.4/php.ini 0000604 00000000116 15225276652 0010220 0 ustar 00 [PHP] post_max_size = 100M upload_max_filesize = 100M variables_order = EGPCS runtimes/7.4/supervisord.conf 0000604 00000000566 15225276652 0012175 0 ustar 00 [supervisord] nodaemon=true user=root logfile=/var/log/supervisor/supervisord.log pidfile=/var/run/supervisord.pid [program:php] command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80 user=sail environment=LARAVEL_SAIL="1" stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 LICENSE.md 0000604 00000002117 15225276652 0006161 0 ustar 00 The MIT License (MIT) Copyright (c) Taylor Otwell Copyright (c) Chris Fidao Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. stubs/memcached.stub 0000604 00000000201 15225276652 0010512 0 ustar 00 memcached: image: 'memcached:alpine' ports: - '11211:11211' networks: - sail stubs/mariadb.stub 0000604 00000001101 15225276652 0010203 0 ustar 00 mariadb: image: 'mariadb:10' ports: - '${FORWARD_DB_PORT:-3306}:3306' environment: MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' MYSQL_DATABASE: '${DB_DATABASE}' MYSQL_USER: '${DB_USERNAME}' MYSQL_PASSWORD: '${DB_PASSWORD}' MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' volumes: - 'sailmariadb:/var/lib/mysql' networks: - sail healthcheck: test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"] retries: 3 timeout: 5s stubs/mailhog.stub 0000604 00000000331 15225276652 0010230 0 ustar 00 mailhog: image: 'mailhog/mailhog:latest' ports: - '${FORWARD_MAILHOG_PORT:-1025}:1025' - '${FORWARD_MAILHOG_DASHBOARD_PORT:-8025}:8025' networks: - sail stubs/redis.stub 0000604 00000000454 15225276652 0007724 0 ustar 00 redis: image: 'redis:alpine' ports: - '${FORWARD_REDIS_PORT:-6379}:6379' volumes: - 'sailredis:/data' networks: - sail healthcheck: test: ["CMD", "redis-cli", "ping"] retries: 3 timeout: 5s stubs/selenium.stub 0000604 00000000216 15225276652 0010433 0 ustar 00 selenium: image: 'selenium/standalone-chrome' volumes: - '/dev/shm:/dev/shm' networks: - sail stubs/meilisearch.stub 0000604 00000000600 15225276652 0011074 0 ustar 00 meilisearch: image: 'getmeili/meilisearch:latest' ports: - '${FORWARD_MEILISEARCH_PORT:-7700}:7700' volumes: - 'sailmeilisearch:/data.ms' networks: - sail healthcheck: test: ["CMD", "wget", "--no-verbose", "--spider", "http://localhost:7700/health"] retries: 3 timeout: 5s stubs/pgsql.stub 0000604 00000001076 15225276652 0007745 0 ustar 00 pgsql: image: 'postgres:13' ports: - '${FORWARD_DB_PORT:-5432}:5432' environment: PGPASSWORD: '${DB_PASSWORD:-secret}' POSTGRES_DB: '${DB_DATABASE}' POSTGRES_USER: '${DB_USERNAME}' POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}' volumes: - 'sailpgsql:/var/lib/postgresql/data' networks: - sail healthcheck: test: ["CMD", "pg_isready", "-q", "-d", "${DB_DATABASE}", "-U", "${DB_USERNAME}"] retries: 3 timeout: 5s stubs/docker-compose.stub 0000604 00000001432 15225276652 0011525 0 ustar 00 # For more information: https://laravel.com/docs/sail version: '3' services: laravel.test: build: context: ./vendor/laravel/sail/runtimes/8.0 dockerfile: Dockerfile args: WWWGROUP: '${WWWGROUP}' image: sail-8.0/app extra_hosts: - 'host.docker.internal:host-gateway' ports: - '${APP_PORT:-80}:80' environment: WWWUSER: '${WWWUSER}' LARAVEL_SAIL: 1 XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' volumes: - '.:/var/www/html' networks: - sail {{depends}} {{services}} networks: sail: driver: bridge {{volumes}} stubs/mysql.stub 0000604 00000001074 15225276652 0007762 0 ustar 00 mysql: image: 'mysql:8.0' ports: - '${FORWARD_DB_PORT:-3306}:3306' environment: MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' MYSQL_DATABASE: '${DB_DATABASE}' MYSQL_USER: '${DB_USERNAME}' MYSQL_PASSWORD: '${DB_PASSWORD}' MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' volumes: - 'sailmysql:/var/lib/mysql' networks: - sail healthcheck: test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"] retries: 3 timeout: 5s stubs/minio.stub 0000604 00000001076 15225276652 0007732 0 ustar 00 minio: image: 'minio/minio:latest' ports: - '${FORWARD_MINIO_PORT:-9000}:9000' - '${FORWARD_MINIO_CONSOLE_PORT:-8900}:8900' environment: MINIO_ROOT_USER: 'sail' MINIO_ROOT_PASSWORD: 'password' volumes: - 'sailminio:/data/minio' networks: - sail command: minio server /data/minio --console-address ":8900" healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] retries: 3 timeout: 5s stubs/devcontainer.stub 0000604 00000001120 15225276652 0011266 0 ustar 00 // https://aka.ms/devcontainer.json { "name": "Existing Docker Compose (Extend)", "dockerComposeFile": [ "../docker-compose.yml" ], "service": "laravel.test", "workspaceFolder": "/var/www/html", "settings": {}, "extensions": [ // "mikestead.dotenv", // "amiralizadeh9480.laravel-extra-intellisense", // "ryannaddy.laravel-artisan", // "onecentlin.laravel5-snippets", // "onecentlin.laravel-blade" ], "remoteUser": "sail", // "forwardPorts": [], // "runServices": [], // "postCreateCommand": "apt-get update && apt-get install -y curl", // "shutdownAction": "none", } composer.json 0000604 00000002060 15225276652 0007274 0 ustar 00 { "name": "laravel/sail", "description": "Docker files for running a basic Laravel application.", "keywords": ["laravel", "docker"], "license": "MIT", "support": { "issues": "https://github.com/laravel/sail/issues", "source": "https://github.com/laravel/sail" }, "authors": [ { "name": "Taylor Otwell", "email": "taylor@laravel.com" } ], "require": { "php": "^7.3|^8.0", "illuminate/contracts": "^8.0|^9.0", "illuminate/console": "^8.0|^9.0", "illuminate/support": "^8.0|^9.0" }, "bin": [ "bin/sail" ], "autoload": { "psr-4": { "Laravel\\Sail\\": "src/" } }, "extra": { "branch-alias": { "dev-master": "1.x-dev" }, "laravel": { "providers": [ "Laravel\\Sail\\SailServiceProvider" ] } }, "config": { "sort-packages": true }, "minimum-stability": "dev", "prefer-stable": true } src/SailServiceProvider.php 0000604 00000003020 15225276652 0011773 0 ustar 00 <?php namespace Laravel\Sail; use Illuminate\Contracts\Support\DeferrableProvider; use Illuminate\Support\ServiceProvider; use Laravel\Sail\Console\InstallCommand; use Laravel\Sail\Console\PublishCommand; class SailServiceProvider extends ServiceProvider implements DeferrableProvider { /** * Bootstrap any application services. * * @return void */ public function boot() { $this->registerCommands(); $this->configurePublishing(); } /** * Register the console commands for the package. * * @return void */ protected function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ InstallCommand::class, PublishCommand::class, ]); } } /** * Configure publishing for the package. * * @return void */ protected function configurePublishing() { if ($this->app->runningInConsole()) { $this->publishes([ __DIR__ . '/../runtimes' => $this->app->basePath('docker'), ], ['sail', 'sail-docker']); $this->publishes([ __DIR__ . '/../bin/sail' => $this->app->basePath('sail'), ], ['sail', 'sail-bin']); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return [ InstallCommand::class, PublishCommand::class, ]; } } src/Console/InstallCommand.php 0000604 00000013427 15225276652 0012372 0 ustar 00 <?php namespace Laravel\Sail\Console; use Illuminate\Console\Command; class InstallCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'sail:install {--with= : The services that should be included in the installation} {--devcontainer : Create a .devcontainer configuration directory}'; /** * The console command description. * * @var string */ protected $description = 'Install Laravel Sail\'s default Docker Compose file'; /** * Execute the console command. * * @return void */ public function handle() { if ($this->option('with')) { $services = $this->option('with') == 'none' ? [] : explode(',', $this->option('with')); } elseif ($this->option('no-interaction')) { $services = ['mysql', 'redis', 'selenium', 'mailhog']; } else { $services = $this->gatherServicesWithSymfonyMenu(); } $this->buildDockerCompose($services); $this->replaceEnvVariables($services); if ($this->option('devcontainer')) { $this->installDevContainer(); } $this->info('Sail scaffolding installed successfully.'); } /** * Gather the desired Sail services using a Symfony menu. * * @return array */ protected function gatherServicesWithSymfonyMenu() { return $this->choice('Which services would you like to install?', [ 'mysql', 'pgsql', 'mariadb', 'redis', 'memcached', 'meilisearch', 'minio', 'mailhog', 'selenium', ], 0, null, true); } /** * Build the Docker Compose file. * * @param array $services * @return void */ protected function buildDockerCompose(array $services) { $depends = collect($services) ->filter(function ($service) { return in_array($service, ['mysql', 'pgsql', 'mariadb', 'redis', 'meilisearch', 'minio', 'selenium']); })->map(function ($service) { return " - {$service}"; })->whenNotEmpty(function ($collection) { return $collection->prepend('depends_on:'); })->implode("\n"); $stubs = rtrim(collect($services)->map(function ($service) { return file_get_contents(__DIR__ . "/../../stubs/{$service}.stub"); })->implode('')); $volumes = collect($services) ->filter(function ($service) { return in_array($service, ['mysql', 'pgsql', 'mariadb', 'redis', 'meilisearch', 'minio']); })->map(function ($service) { return " sail{$service}:\n driver: local"; })->whenNotEmpty(function ($collection) { return $collection->prepend('volumes:'); })->implode("\n"); $dockerCompose = file_get_contents(__DIR__ . '/../../stubs/docker-compose.stub'); $dockerCompose = str_replace('{{depends}}', empty($depends) ? '' : ' '.$depends, $dockerCompose); $dockerCompose = str_replace('{{services}}', $stubs, $dockerCompose); $dockerCompose = str_replace('{{volumes}}', $volumes, $dockerCompose); // Remove empty lines... $dockerCompose = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $dockerCompose); file_put_contents($this->laravel->basePath('docker-compose.yml'), $dockerCompose); } /** * Replace the Host environment variables in the app's .env file. * * @param array $services * @return void */ protected function replaceEnvVariables(array $services) { $environment = file_get_contents($this->laravel->basePath('.env')); if (in_array('pgsql', $services)) { $environment = str_replace('DB_CONNECTION=mysql', "DB_CONNECTION=pgsql", $environment); $environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=pgsql", $environment); $environment = str_replace('DB_PORT=3306', "DB_PORT=5432", $environment); } elseif (in_array('mariadb', $services)) { $environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=mariadb", $environment); } else { $environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=mysql", $environment); } $environment = str_replace('DB_USERNAME=root', "DB_USERNAME=sail", $environment); $environment = preg_replace("/DB_PASSWORD=(.*)/", "DB_PASSWORD=password", $environment); $environment = str_replace('MEMCACHED_HOST=127.0.0.1', 'MEMCACHED_HOST=memcached', $environment); $environment = str_replace('REDIS_HOST=127.0.0.1', 'REDIS_HOST=redis', $environment); if (in_array('meilisearch', $services)) { $environment .= "\nSCOUT_DRIVER=meilisearch"; $environment .= "\nMEILISEARCH_HOST=http://meilisearch:7700\n"; } file_put_contents($this->laravel->basePath('.env'), $environment); } /** * Install the devcontainer.json configuration file. * * @return void */ protected function installDevContainer() { if (! is_dir($this->laravel->basePath('.devcontainer'))) { mkdir($this->laravel->basePath('.devcontainer'), 0755, true); } file_put_contents( $this->laravel->basePath('.devcontainer/devcontainer.json'), file_get_contents(__DIR__.'/../../stubs/devcontainer.stub') ); $environment = file_get_contents($this->laravel->basePath('.env')); $environment .= "\nWWWGROUP=1000"; $environment .= "\nWWWUSER=1000\n"; file_put_contents($this->laravel->basePath('.env'), $environment); } } src/Console/PublishCommand.php 0000604 00000002066 15225276652 0012367 0 ustar 00 <?php namespace Laravel\Sail\Console; use Illuminate\Console\Command; class PublishCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'sail:publish'; /** * The console command description. * * @var string */ protected $description = 'Publish the Laravel Sail Docker files'; /** * Execute the console command. * * @return void */ public function handle() { $this->call('vendor:publish', ['--tag' => 'sail-docker']); file_put_contents( $this->laravel->basePath('docker-compose.yml'), str_replace( [ './vendor/laravel/sail/runtimes/8.0', './vendor/laravel/sail/runtimes/7.4', ], [ './docker/8.0', './docker/7.4', ], file_get_contents($this->laravel->basePath('docker-compose.yml')) ) ); } } bin/sail 0000604 00000022476 15225276652 0006212 0 ustar 00 #!/usr/bin/env bash UNAMEOUT="$(uname -s)" WHITE='\033[1;37m' NC='\033[0m' # Verify operating system is supported... case "${UNAMEOUT}" in Linux*) MACHINE=linux;; Darwin*) MACHINE=mac;; *) MACHINE="UNKNOWN" esac if [ "$MACHINE" == "UNKNOWN" ]; then echo "Unsupported operating system [$(uname -s)]. Laravel Sail supports macOS, Linux, and Windows (WSL2)." >&2 exit 1 fi # Source the ".env" file so Laravel's environment variables are available... if [ -f ./.env ]; then source ./.env fi # Define environment variables... export APP_PORT=${APP_PORT:-80} export APP_SERVICE=${APP_SERVICE:-"laravel.test"} export DB_PORT=${DB_PORT:-3306} export WWWUSER=${WWWUSER:-$UID} export WWWGROUP=${WWWGROUP:-$(id -g)} 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} # Function that outputs Sail is not running... function sail_is_not_running { echo -e "${WHITE}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 exit 1 } 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 exit 1 fi # Determine if Sail is currently up... PSRESULT="$(docker-compose ps -q)" if docker-compose ps | grep $APP_SERVICE | grep 'Exit'; then echo -e "${WHITE}Shutting down old Sail processes...${NC}" >&2 docker-compose down > /dev/null 2>&1 EXEC="no" elif [ -n "$PSRESULT" ]; then EXEC="yes" else 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 exec \ -u sail \ "$APP_SERVICE" \ php "$@" else sail_is_not_running fi # Proxy vendor binary commands on the application container... elif [ "$1" == "bin" ]; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose exec \ -u sail \ "$APP_SERVICE" \ ./vendor/bin/"$@" else sail_is_not_running fi # Proxy Composer commands to the "composer" binary on the application container... elif [ "$1" == "composer" ]; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose exec \ -u sail \ "$APP_SERVICE" \ composer "$@" 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 if [ "$EXEC" == "yes" ]; then docker-compose exec \ -u sail \ "$APP_SERVICE" \ php artisan "$@" 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 if [ "$EXEC" == "yes" ]; then docker-compose exec \ -u sail \ -e XDEBUG_SESSION=1 \ "$APP_SERVICE" \ php artisan "$@" else sail_is_not_running fi # Proxy the "test" command to the "php artisan test" Artisan command... elif [ "$1" == "test" ]; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose exec \ -u sail \ "$APP_SERVICE" \ php artisan test "$@" 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 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 "dusk:fails" command to the "php artisan dusk:fails" Artisan command... elif [ "$1" == "dusk:fails" ]; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose 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 # Initiate a Laravel Tinker session within the application container... elif [ "$1" == "tinker" ] ; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose exec \ -u sail \ "$APP_SERVICE" \ php artisan tinker else sail_is_not_running fi # Proxy Node commands to the "node" binary on the application container... elif [ "$1" == "node" ]; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose exec \ -u sail \ "$APP_SERVICE" \ node "$@" else sail_is_not_running fi # Proxy NPM commands to the "npm" binary on the application container... elif [ "$1" == "npm" ]; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose exec \ -u sail \ "$APP_SERVICE" \ npm "$@" else sail_is_not_running fi # Proxy NPX commands to the "npx" binary on the application container... elif [ "$1" == "npx" ]; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose exec \ -u sail \ "$APP_SERVICE" \ npx "$@" else sail_is_not_running fi # Proxy YARN commands to the "yarn" binary on the application container... elif [ "$1" == "yarn" ]; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose exec \ -u sail \ "$APP_SERVICE" \ yarn "$@" else sail_is_not_running fi # Initiate a MySQL CLI terminal session within the "mysql" container... elif [ "$1" == "mysql" ]; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose exec \ mysql \ bash -c 'MYSQL_PWD=${MYSQL_PASSWORD} mysql -u ${MYSQL_USER} ${MYSQL_DATABASE}' else sail_is_not_running fi # Initiate a MySQL CLI terminal session within the "mariadb" container... elif [ "$1" == "mariadb" ]; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose exec \ mariadb \ bash -c '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 if [ "$EXEC" == "yes" ]; then docker-compose exec \ pgsql \ bash -c 'PGPASSWORD=${PGPASSWORD} psql -U ${POSTGRES_USER} ${POSTGRES_DB}' else sail_is_not_running fi # Initiate a Bash shell within the application container... elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose exec \ -u sail \ "$APP_SERVICE" \ bash "$@" else sail_is_not_running fi # Initiate a root user Bash shell within the application container... elif [ "$1" == "root-shell" ] ; then shift 1 if [ "$EXEC" == "yes" ]; then docker-compose exec \ "$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 docker-compose exec \ 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="" \ "$@" else sail_is_not_running fi # Pass unknown commands to the "docker-compose" binary... else docker-compose "$@" fi else docker-compose ps fi