Skip to content

Commit 9bc252d

Browse files
authored
Use mysql command for MariaDB 10.3.x and below (#53)
1 parent ccdde74 commit 9bc252d

File tree

7 files changed

+79
-8
lines changed

7 files changed

+79
-8
lines changed

.github/workflows/pr-symfony-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
- examples/symfony-import
2121
- examples/symfony-init
2222
- examples/symfony-mariadb
23+
- examples/symfony-mariadb-mysql
2324
- examples/symfony-mysql8
2425
- examples/symfony-nginx
2526
lando-version:

CHANGELOG.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})
22

3-
* Updated mariadb plugin [#51](https://github.com/lando/mariadb/issues/51)
4-
* Cleaned up test comments
3+
* Use mysql command for MariaDB 10.3.x and below [#52](https://github.com/lando/symfony/issues/52)
54

65
## v1.5.0 - [March 8, 2024](https://github.com/lando/symfony/releases/tag/v1.5.0)
76

builders/symfony.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,19 @@ const toolingDefaults = {
133133
*/
134134
const getDbTooling = database => {
135135
// Make sure we strip out any version number
136-
database = database.split(':')[0];
136+
const db = database.split(':')[0];
137+
const ver = database.split(':')[1];
137138
// Choose wisely
138-
if (database === 'mysql') {
139+
if (db === 'mysql') {
139140
return {mysql: mysqlCli};
140-
} else if (database === 'mariadb') {
141+
} else if (db === 'mariadb' && ver < 10.4) {
142+
// mariadb command not available in 10.3.x and below
143+
return {mysql: mysqlCli};
144+
} else if (db === 'mariadb') {
141145
return {mariadb: mariadbCli};
142-
} else if (database === 'postgres') {
146+
} else if (db === 'postgres') {
143147
return {psql: postgresCli};
144-
} else if (database === 'mongo') {
148+
} else if (db === 'mongo') {
145149
return {mongo: {
146150
service: 'database',
147151
description: 'Drop into the mongo shell',
@@ -225,7 +229,6 @@ const getConfigDefaults = options => {
225229
*/
226230
const getTooling = options => _.merge({}, toolingDefaults, getDbTooling(options.database));
227231

228-
229232
/*
230233
* Build Symfony
231234
*/
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: symfony-mariadb-mysql
2+
recipe: symfony
3+
config:
4+
webroot: web
5+
php: 8.3
6+
database: mariadb:10.3
7+
8+
# do not remove this
9+
plugins:
10+
"@lando/symfony": ../..
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Symfony MariaDB/MySQL Example
2+
3+
This example exists primarily to test the following documentation:
4+
5+
* [Symfony Recipe](https://docs.lando.dev/symfony/config.html)
6+
7+
Versions of MariaDB 10.3.x and lower do not have the mariadb command and must use the mysql executable.
8+
9+
Start up tests
10+
--------------
11+
12+
Run the following commands to get up and running with this example.
13+
14+
```bash
15+
# Should start up successfully
16+
lando poweroff
17+
lando start
18+
```
19+
20+
Verification commands
21+
---------------------
22+
23+
Run the following commands to validate things are rolling as they should.
24+
25+
```bash
26+
# Should serve from web folder
27+
lando ssh -s appserver -c "curl -L localhost" | grep "MySQL"
28+
29+
# Should be running apache 2.4 by default
30+
lando ssh -s appserver -c "apachectl -V | grep 2.4"
31+
lando ssh -s appserver -c "curl -IL localhost" | grep Server | grep 2.4
32+
33+
# Should use php 8.3 if specified by user
34+
lando php -v | grep "PHP 8.3."
35+
36+
# Should be running mariadb 10.3.x if specified by user
37+
lando mysql -V | grep "MariaDB" | grep "10.3."
38+
39+
# Should be able to connect to the database with the default creds
40+
lando mysql symfony -e quit
41+
42+
# Should use the default mariadb config file
43+
lando ssh -s database -c "cat /opt/bitnami/mariadb/conf/my_custom.cnf" | grep "innodb_lock_wait_timeout = 121"
44+
lando mysql -u root -e "show variables;" | grep innodb_lock_wait_timeout | grep 121
45+
```
46+
47+
Destroy tests
48+
-------------
49+
50+
Run the following commands to trash this app like nothing ever happened.
51+
52+
```bash
53+
# Should be destroyed with success
54+
lando destroy -y
55+
lando poweroff
56+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MySQL
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php phpinfo(); ?>

0 commit comments

Comments
 (0)