Skip to content

Commit

Permalink
Update mariadb plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
uberhacker committed May 21, 2024
1 parent f8c4ade commit 47df19a
Show file tree
Hide file tree
Showing 15 changed files with 504 additions and 295 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr-laravel-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- examples/laravel-export
- examples/laravel-import
- examples/laravel-init
- examples/laravel-mariadb
- examples/laravel-mysql8
- examples/laravel-nginx

Expand Down
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})

* Updated mariadb plugin [#51](https://github.com/lando/mariadb/issues/51)
* Cleaned up test comments

## v1.4.0 - [March 8, 2024](https://github.com/lando/laravel/releases/tag/v1.4.0)
* Updated to latest database services.

* Updated to latest database services.

## v1.3.1 - [February 29, 2024](https://github.com/lando/laravel/releases/tag/v1.3.1)

Expand Down Expand Up @@ -49,8 +54,9 @@
* Add compatibility for MySQL 8.x [lando/lando#1426](https://github.com/lando/lando/issues/1462)

## v0.7.0 - [December 12, 2022](https://github.com/lando/laravel/releases/tag/v0.7.0)
* Added bundle-dependencies to release process.
* Fixed bug in plugin dogfooding test.

* Added bundle-dependencies to release process.
* Fixed bug in plugin dogfooding test.

## v0.6.0 - [September 8, 2022](https://github.com/lando/laravel/releases/tag/v0.6.0)

Expand Down
20 changes: 18 additions & 2 deletions builders/laravel.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,20 @@ const toolingDefaults = {
},
};

// Default DB cli commands
// MariaDB cli commands
const mariadbCli = {
service: ':host',
description: 'Drops into a MariaDB shell on a database service',
cmd: 'mariadb -uroot',
options: {
host: {
description: 'The database service to use',
default: 'database',
alias: ['h'],
},
},
};
// MySQL cli commands
const mysqlCli = {
service: ':host',
description: 'Drops into a MySQL shell on a database service',
Expand All @@ -91,6 +104,7 @@ const mysqlCli = {
},
},
};
// Postgres cli commands
const postgresCli = {
service: ':host',
description: 'Drops into a psql shell on a database service',
Expand Down Expand Up @@ -173,8 +187,10 @@ const getDbTooling = database => {
// Make sure we strip out any version number
database = database.split(':')[0];
// Choose wisely
if (_.includes(['mysql', 'mariadb'], database)) {
if (database === 'mysql') {
return {mysql: mysqlCli};
} else if (database === 'mariadb') {
return {mariadb: mariadbCli};
} else if (database === 'postgres') {
return {psql: postgresCli};
} else if (database === 'mongo') {
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ function sidebar() {
],
},
];
};
};

4 changes: 2 additions & 2 deletions examples/7.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rm -rf laravel && mkdir -p laravel && cd laravel
cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.yml
lando init --source cwd --recipe laravel --webroot app/public --name lando-laravel --option cache=redis --option php='7.1' --option composer_version='1-latest'

# Should compose create-project a new laravel app
# Should composer create-project a new laravel app
cd laravel
lando composer create-project --prefer-dist laravel/laravel app

Expand All @@ -42,7 +42,7 @@ lando ssh -s appserver -c "curl -L localhost" | grep "Laravel"
cd laravel
lando ssh -s appserver -c 'cd /var/www/.composer && composer show laravel/installer' | grep 'v2.'

# Should use 7.4 as the default php version
# Should use 7.1 as the default php version
cd laravel
lando php -v | grep "PHP 7.1"

Expand Down
6 changes: 3 additions & 3 deletions examples/7.2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ lando poweroff

# Initialize an empty laravel recipe
rm -rf laravel && mkdir -p laravel && cd laravel
lando init --source cwd --recipe laravel --webroot app/public --name lando-laravel --option cache=redis --option php='7.2' --option composer_version='1-latest'
cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.yml
lando init --source cwd --recipe laravel --webroot app/public --name lando-laravel --option cache=redis --option php='7.2' --option composer_version='1-latest'

# Should compose create-project a new laravel app
# Should composer create-project a new laravel app
cd laravel
lando composer create-project --prefer-dist laravel/laravel app

Expand All @@ -42,7 +42,7 @@ lando ssh -s appserver -c "curl -L localhost" | grep "Laravel"
cd laravel
lando ssh -s appserver -c 'cd /var/www/.composer && composer show laravel/installer' | grep 'v3.'

# Should use 7.4 as the default php version
# Should use 7.2 as the default php version
cd laravel
lando php -v | grep "PHP 7.2"

Expand Down
2 changes: 1 addition & 1 deletion examples/laravel-downstreamer-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ lando mysql -V | grep 8.0
# Should use the default database connection info
lando mysql -ularavel -plaravel laravel -e quit

# Should use the defauly mysql8 config file
# Should use the default mysql8 config file
lando ssh -s database -c "cat /opt/bitnami/mysql/conf/my_custom.cnf" | grep "LANDOLARAVELMYSQL8CNF"
lando mysql -u root -e "show variables;" | grep innodb_lock_wait_timeout | grep 127
```
Expand Down
2 changes: 1 addition & 1 deletion examples/laravel-downstreamer-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ lando mysql -V | grep 8.0
# Should use the default database connection info
lando mysql -ularavel -plaravel laravel -e quit

# Should use the defauly mysql8 config file
# Should use the default mysql8 config file
lando ssh -s database -c "cat /opt/bitnami/mysql/conf/my_custom.cnf" | grep "LANDOLARAVELMYSQL8CNF"
lando mysql -u root -e "show variables;" | grep innodb_lock_wait_timeout | grep 127
```
Expand Down
2 changes: 1 addition & 1 deletion examples/laravel-init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rm -rf laravel && mkdir -p laravel && cd laravel
lando init --source cwd --recipe laravel --webroot app/public --name lando-laravel --option cache=redis
cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.yml

# Should compose create-project a new laravel app
# Should composer create-project a new laravel app
cd laravel
lando composer create-project --prefer-dist laravel/laravel app

Expand Down
1 change: 1 addition & 0 deletions examples/laravel-mariadb/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mariadb
90 changes: 90 additions & 0 deletions examples/laravel-mariadb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Laravel MariaDB Example
=======================

This example exists primarily to test the following documentation:

* [Laravel Recipe](https://docs.devwithlando.io/tutorials/laravel.html)

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

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

```bash
# Should poweroff
lando poweroff

# Initialize an empty laravel recipe
rm -rf mariadb && mkdir -p mariadb && cd mariadb
lando init --source cwd --recipe laravel --webroot app/public --name lando-laravel-mariadb --option cache=redis --option php='8.3' --option database=mariadb:11.3
cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.yml

# Should composer create-project a new laravel app
cd mariadb
lando composer create-project --prefer-dist laravel/laravel app

# Should start up successfully
cd mariadb
lando start
```

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

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

```bash
# Should return the laravel default page
cd mariadb
lando ssh -s appserver -c "curl -L localhost" | grep "Laravel"

# Should install 4.x version of laravel/installer
cd mariadb
lando ssh -s appserver -c 'cd /var/www/.composer && composer show laravel/installer' | grep 'v4.'

# Should use 8.3 as the default php version
cd mariadb
lando php -v | grep "PHP 8.3"

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

# Should be running mariadb 11.3.x by default
cd mariadb
lando mariadb -V | grep 11.3.

# Should not enable xdebug by default
cd mariadb
lando php -m | grep xdebug || echo $? | grep 1

# Should have redis running
cd mariadb
lando ssh -s cache -c "redis-cli CONFIG GET databases"

# Should use the default database connection info
cd mariadb
lando mariadb -ularavel -plaravel laravel -e quit

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

# Should have artisan available
cd mariadb
lando artisan env
```

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

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

```bash
# Should be destroyed with success
cd mariadb
lando destroy -y
lando poweroff
```
10 changes: 5 additions & 5 deletions examples/laravel-mysql8/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Laravel PHP 8.1 Example
===============
Laravel MySQL 8 Example
=======================

This example exists primarily to test the following documentation:

Expand All @@ -19,7 +19,7 @@ rm -rf mysql8 && mkdir -p mysql8 && cd mysql8
lando init --source cwd --recipe laravel --webroot app/public --name lando-laravel-mysql8 --option cache=redis --option php='8.1' --option database=mysql:8.0.22
cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.yml

# Should compose create-project a new laravel app
# Should composer create-project a new laravel app
cd mysql8
lando composer create-project --prefer-dist laravel/laravel app

Expand All @@ -42,7 +42,7 @@ lando ssh -s appserver -c "curl -L localhost" | grep "Laravel"
cd mysql8
lando ssh -s appserver -c 'cd /var/www/.composer && composer show laravel/installer' | grep 'v4.'

# Should use 7.4 as the default php version
# Should use 8.1 as the default php version
cd mysql8
lando php -v | grep "PHP 8.1"

Expand All @@ -67,7 +67,7 @@ lando ssh -s cache -c "redis-cli CONFIG GET databases"
cd mysql8
lando mysql -ularavel -plaravel laravel -e quit

# Should use the defauly mysql8 config file
# Should use the default mysql8 config file
cd mysql8
lando ssh -s database -c "cat /opt/bitnami/mysql/conf/my_custom.cnf" | grep "LANDOLARAVELMYSQL8CNF"
lando mysql -u root -e "show variables;" | grep innodb_lock_wait_timeout | grep 127
Expand Down
2 changes: 1 addition & 1 deletion examples/laravel-nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ lando ssh -s appserver -c "curl -L appserver_nginx" | grep "NGINX"
# Should run using nginx if specified
lando ssh -s appserver -c "curl -IL appserver_nginx" | grep Server | grep nginx

# Should use nginx 1.25 by defualt
# Should use nginx 1.25 by default
lando nginx -v 2>&1 | grep "nginx version" | grep "nginx/1.25"

# Should use the php version specified by the user eg 7.4
Expand Down
Loading

0 comments on commit 47df19a

Please sign in to comment.