diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 1c190862..2ae722b1 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -51,6 +51,7 @@ protected function gatherServicesWithSymfonyMenu() return $this->choice('Which services would you like to install?', [ 'mysql', 'pgsql', + 'mariadb', 'redis', 'memcached', 'meilisearch', @@ -69,7 +70,7 @@ protected function buildDockerCompose(array $services) { $depends = collect($services) ->filter(function ($service) { - return in_array($service, ['mysql', 'pgsql', 'redis', 'selenium']); + return in_array($service, ['mysql', 'pgsql', 'mariadb', 'redis', 'selenium']); })->map(function ($service) { return " - {$service}"; })->whenNotEmpty(function ($collection) { @@ -82,7 +83,7 @@ protected function buildDockerCompose(array $services) $volumes = collect($services) ->filter(function ($service) { - return in_array($service, ['mysql', 'pgsql', 'redis', 'meilisearch']); + return in_array($service, ['mysql', 'pgsql', 'mariadb', 'redis', 'meilisearch']); })->map(function ($service) { return " sail{$service}:\n driver: local"; })->whenNotEmpty(function ($collection) { @@ -115,6 +116,8 @@ protected function replaceEnvVariables(array $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); } diff --git a/stubs/mariadb.stub b/stubs/mariadb.stub new file mode 100644 index 00000000..d98b9f37 --- /dev/null +++ b/stubs/mariadb.stub @@ -0,0 +1,16 @@ + 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"] diff --git a/stubs/pgsql.stub b/stubs/pgsql.stub index f7858589..f5ade8e0 100644 --- a/stubs/pgsql.stub +++ b/stubs/pgsql.stub @@ -1,5 +1,5 @@ pgsql: - image: postgres:13 + image: 'postgres:13' ports: - '${FORWARD_DB_PORT:-5432}:5432' environment: