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

Use mysql command for MariaDB 10.3.x and below #40

Merged
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
2 changes: 2 additions & 0 deletions .github/workflows/pr-joomla-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
- examples/joomla-export
- examples/joomla-import
- examples/joomla-init
- examples/joomla-mariadb
- examples/joomla-mariadb-mysql
- examples/joomla-mysql8
- examples/joomla-nginx

Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})

* Use mysql command for MariaDB 10.3.x and below [#39](https://github.com/lando/joomla/issues/39)

## v1.4.0 - [May 15, 2024](https://github.com/lando/joomla/releases/tag/v1.4.0)

* Updated mariadb plugin. [#51](https://github.com/lando/mariadb/issues/51)
Expand All @@ -12,7 +14,7 @@

### Fixes

* Improved `database` selection for purposes of `config` loading, fixes some `database` bootup issues when the `database` type is overriden downstream
* Improved `database` selection for purposes of `config` loading, fixes some `database` bootup issues when the `database` type is overridden downstream

## v1.2.0 - [February 26, 2024](https://github.com/lando/joomla/releases/tag/v1.2.0)

Expand Down
14 changes: 9 additions & 5 deletions builders/joomla.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,19 @@ const getServices = options => ({
*/
const getDbTooling = database => {
// Make sure we strip out any version number
database = database.split(':')[0];
const db = database.split(':')[0];
const ver = database.split(':')[1];
// Choose wisely
if (database === 'mysql') {
if (db === 'mysql') {
return {mysql: mysqlCli};
} else if (database === 'mariadb') {
} else if (db === 'mariadb' && ver < 10.4) {
// Use mysql command for MariaDB 10.3.x and below
return {mysql: mysqlCli};
} else if (db === 'mariadb') {
return {mariadb: mariadbCli};
} else if (database === 'postgres') {
} else if (db === 'postgres') {
return {psql: postgresCli};
} else if (database === 'mongo') {
} else if (db === 'mongo') {
return {mongo: {
service: 'database',
description: 'Drop into the mongo shell',
Expand Down
10 changes: 10 additions & 0 deletions examples/joomla-mariadb-mysql/.lando.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: joomla-mariadb-mysql
recipe: joomla
config:
webroot: web
php: 8.3
database: mariadb:10.3

# do not remove this
plugins:
"@lando/joomla": ../..
56 changes: 56 additions & 0 deletions examples/joomla-mariadb-mysql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Joomla MariaDB/MySQL Example

This example exists primarily to test the following documentation:

* [Joomla Recipe](https://docs.lando.dev/joomla/config.html)

Versions of MariaDB 10.3.x and lower do not have the mariadb command and must use the mysql executable.

Start up tests
--------------

Run the following commands to get up and running with this example.

```bash
# Should start up successfully
lando poweroff
lando start
```

Verification commands
---------------------

Run the following commands to validate things are rolling as they should.

```bash
# Should serve from web folder
lando ssh -s appserver -c "curl -L localhost" | grep "MariaDB"

# Should be running apache 2.4 by default
lando ssh -s appserver -c "apachectl -V | grep 2.4"
lando ssh -s appserver -c "curl -IL localhost" | grep Server | grep 2.4

# Should use php 8.3 if specified by user
lando php -v | grep "PHP 8.3"

# Should be running mariadb 10.3.x if specified by user
lando mysql -V | grep "MariaDB" | grep "10.3."

# Should be able to connect to the database with the default creds
lando mysql joomla -e quit

# Should use the default mariadb config file
lando ssh -s database -c "cat /opt/bitnami/mariadb/conf/my_custom.cnf" | grep "innodb_lock_wait_timeout = 121"
lando mysql -u root -e "show variables;" | grep innodb_lock_wait_timeout | grep 121
```

Destroy tests
-------------

Run the following commands to trash this app like nothing ever happened.

```bash
# Should be destroyed with success
lando destroy -y
lando poweroff
```
1 change: 1 addition & 0 deletions examples/joomla-mariadb-mysql/web/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MariaDB
1 change: 1 addition & 0 deletions examples/joomla-mariadb-mysql/web/info.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php phpinfo(); ?>
Loading