Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] MariaDB support #111

Merged
merged 1 commit into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ protected function gatherServicesWithSymfonyMenu()
return $this->choice('Which services would you like to install?', [
'mysql',
'pgsql',
'mariadb',
'redis',
'memcached',
'meilisearch',
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down
16 changes: 16 additions & 0 deletions stubs/mariadb.stub
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion stubs/pgsql.stub
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pgsql:
image: postgres:13
image: 'postgres:13'
ports:
- '${FORWARD_DB_PORT:-5432}:5432'
environment:
Expand Down