diff --git a/.github/workflows/pr-phpmyadmin-tests.yml b/.github/workflows/pr-phpmyadmin-tests.yml index c68ed41..7ad0ee3 100644 --- a/.github/workflows/pr-phpmyadmin-tests.yml +++ b/.github/workflows/pr-phpmyadmin-tests.yml @@ -13,6 +13,7 @@ jobs: leia-test: - examples/4.x - examples/5.x + - examples/mysql lando-version: - 3-edge-slim os: diff --git a/.gitignore b/.gitignore index ff68704..6c52b01 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,4 @@ yarn.lock .stignore *.sync-conflict-* +phpmyadmin/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 226b340..3530b39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }}) +* Switched to official `phpmyadmin` Docker image for arm64/Apple Silicon support [#61](https://github.com/lando/phpmyadmin/issues/61) +* Modernized example tests with pinned database versions and added MySQL test coverage +* Updated `@lando/mariadb` test dependency to ^1.8.0 +* Updated `@lando/mysql` test dependency to ^1.6.0 * Updated `vite` from 5.4.20 to 5.4.21 * Updated `mdast-util-to-hast` from 13.2.0 to 13.2.1 * Updated `lodash-es` from 4.17.21 to 4.17.23 diff --git a/builders/phpmyadmin.js b/builders/phpmyadmin.js index 5a035f4..d63b27e 100644 --- a/builders/phpmyadmin.js +++ b/builders/phpmyadmin.js @@ -29,12 +29,21 @@ module.exports = { // Arrayify the hosts if needed if (!_.isArray(options.hosts)) options.hosts = [options.hosts]; + + // Determine if this is a legacy version (< 5.0.0) + const isLegacy = semver.lt(`${options.version}.0`, '5.0.0'); + // Switch to legacy command if needed - if (semver.lt(`${options.version}.0`, '5.0.0')) options.command = '/run.sh phpmyadmin'; + if (isLegacy) options.command = '/run.sh phpmyadmin'; + + // Use official image for 5.x+, legacy image for 4.x + const image = isLegacy + ? `phpmyadmin/phpmyadmin:${options.version}` + : `phpmyadmin:${options.version}`; // Assemble the service config const pmaService = { - image: `phpmyadmin/phpmyadmin:${options.version}`, + image, environment: { MYSQL_ROOT_PASSWORD: '', PMA_HOSTS: options.hosts.join(','), diff --git a/docs/config.md b/docs/config.md index 92b5737..1ec5c8a 100644 --- a/docs/config.md +++ b/docs/config.md @@ -70,7 +70,7 @@ services: ## Advanced -There are also [several various envvars](https://hub.docker.com/r/phpmyadmin/phpmyadmin/) exposed by the underlying image we use that you can set to further customize how your PhpMyAdmin works. **These are not officially supported** so we *highly recommend* you do not alter them unless you know what you are doing. Even then, YMMV. +There are also [several various envvars](https://hub.docker.com/_/phpmyadmin) exposed by the underlying image we use that you can set to further customize how your PhpMyAdmin works. **These are not officially supported** so we *highly recommend* you do not alter them unless you know what you are doing. Even then, YMMV. That said, you will need to use a [service override](https://docs.lando.dev/services/lando-3.html#overrides) to take advantage of them as shown below: diff --git a/docs/index.md b/docs/index.md index 50877fe..d4b884f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -18,17 +18,17 @@ services: ## Supported versions -* [5.2](https://hub.docker.com/r/phpmyadmin/phpmyadmin/) -* [5.1](https://hub.docker.com/r/phpmyadmin/phpmyadmin/) -* [5.0](https://hub.docker.com/r/phpmyadmin/phpmyadmin/) +* [5.2](https://hub.docker.com/_/phpmyadmin) +* [5.1](https://hub.docker.com/_/phpmyadmin) +* [5.0](https://hub.docker.com/_/phpmyadmin) * [custom](https://docs.lando.dev/services/lando-3.html#overrides) ## Legacy versions -* [4.9](https://hub.docker.com/r/phpmyadmin/phpmyadmin/) -* [4.8](https://hub.docker.com/r/phpmyadmin/phpmyadmin/) -* [4.7](https://hub.docker.com/r/phpmyadmin/phpmyadmin/) -* [4.6](https://hub.docker.com/r/phpmyadmin/phpmyadmin/) +* [4.9](https://hub.docker.com/r/phpmyadmin/phpmyadmin) +* [4.8](https://hub.docker.com/r/phpmyadmin/phpmyadmin) +* [4.7](https://hub.docker.com/r/phpmyadmin/phpmyadmin) +* [4.6](https://hub.docker.com/r/phpmyadmin/phpmyadmin) ## Patch versions diff --git a/examples/4.x/.lando.yml b/examples/4.x/.lando.yml index f5ae5f8..a7e3bd4 100644 --- a/examples/4.x/.lando.yml +++ b/examples/4.x/.lando.yml @@ -12,9 +12,9 @@ services: - chmod +x /app/.lando/pma-theme.sh - /app/.lando/pma-theme.sh database: - type: mariadb + type: mariadb:10.6 database2: - type: mariadb + type: mariadb:10.11 # This is important because it lets lando know to test against the plugin in this repo # DO NOT REMOVE THIS! diff --git a/examples/4.x/README.md b/examples/4.x/README.md index dd9d0e6..cca9350 100644 --- a/examples/4.x/README.md +++ b/examples/4.x/README.md @@ -28,17 +28,17 @@ Run the following commands to validate things are rolling as they should. ```bash # Should return 200 for the pma admin site -lando ssh -s pma -c "curl -I localhost | grep 200 | grep OK" +lando exec pma -- curl -I localhost | grep 200 | grep OK # Should have databases that work correctly -lando ssh -s database -c "mysql -umariadb -pmariadb database -e quit" -lando ssh -s database2 -c "mysql -umariadb -pmariadb database -e quit" +lando exec database -- mysql -umariadb -pmariadb database -e quit +lando exec database2 -- mysql -umariadb -pmariadb database -e quit # Should have our databases hooked up to PMA -lando ssh -s pma -c "env | grep PMA_HOSTS=database,database2" +lando exec pma -- env | grep PMA_HOSTS=database,database2 # Should have set a custom config file if specified -lando ssh -s pma -c "cat /etc/phpmyadmin/config.user.inc.php" | grep ThemeDefault | grep pmaterial +lando exec pma -- cat /etc/phpmyadmin/config.user.inc.php | grep ThemeDefault | grep pmaterial ``` Destroy tests diff --git a/examples/4.x/package.json b/examples/4.x/package.json index 8b4ca62..4ade3b0 100644 --- a/examples/4.x/package.json +++ b/examples/4.x/package.json @@ -9,6 +9,6 @@ "author": "", "license": "ISC", "dependencies": { - "@lando/mariadb": "^1.0.0" + "@lando/mariadb": "^1.8.0" } } diff --git a/examples/5.x/.lando.yml b/examples/5.x/.lando.yml index 125d232..f89a961 100644 --- a/examples/5.x/.lando.yml +++ b/examples/5.x/.lando.yml @@ -24,12 +24,13 @@ services: - chmod +x /app/.lando/pma-theme.sh - /app/.lando/pma-theme.sh database: - type: mariadb + type: mariadb:11.4 database2: - type: mariadb + type: mysql:8.0 # This is important because it lets lando know to test against the plugin in this repo # DO NOT REMOVE THIS! plugins: "@lando/phpmyadmin": ./../../ "@lando/mariadb": ./node_modules/@lando/mariadb + "@lando/mysql": ./node_modules/@lando/mysql diff --git a/examples/5.x/README.md b/examples/5.x/README.md index 68a9201..dd335a0 100644 --- a/examples/5.x/README.md +++ b/examples/5.x/README.md @@ -32,15 +32,21 @@ lando exec defaults -- curl -I localhost | grep 200 | grep OK lando exec pma -- curl -I localhost | grep 200 | grep OK lando exec pma_theme -- curl -I localhost | grep 200 | grep OK -# Should have databases that work correctly +# Should have mariadb database that works correctly lando exec database -- mysql -umariadb -pmariadb database -e quit -lando exec database2 -- mysql -umariadb -pmariadb database -e quit + +# Should have mysql database that works correctly +lando exec database2 -- mysql -umysql -pmysql database -e quit # Should have our databases hooked up to PMA lando exec defaults -- env | grep PMA_HOSTS=database,database2 lando exec pma -- env | grep PMA_HOSTS=database,database2 lando exec pma_theme -- env | grep PMA_HOSTS=database,database2 +# Should be able to connect to both database hosts from PMA +lando exec pma -- curl -s localhost | grep -q "database" +lando exec pma -- curl -s localhost | grep -q "database2" + # Should be version 5.1.x lando exec defaults -- curl -s localhost | grep -oP '\K[^<]+' | tee >(cat 1>&2) | grep -q '5.1.' diff --git a/examples/5.x/package.json b/examples/5.x/package.json index 333a31e..e4c398d 100644 --- a/examples/5.x/package.json +++ b/examples/5.x/package.json @@ -9,6 +9,7 @@ "author": "", "license": "ISC", "dependencies": { - "@lando/mariadb": "^1.6.3" + "@lando/mariadb": "^1.8.0", + "@lando/mysql": "^1.6.0" } } diff --git a/examples/mysql/.gitignore b/examples/mysql/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/examples/mysql/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/examples/mysql/.lando.yml b/examples/mysql/.lando.yml new file mode 100644 index 0000000..4e4d39f --- /dev/null +++ b/examples/mysql/.lando.yml @@ -0,0 +1,14 @@ +name: lando-pma-mysql +services: + pma: + type: phpmyadmin:5.2 + hosts: + - database + database: + type: mysql:8.4 + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/phpmyadmin": ./../../ + "@lando/mysql": ./node_modules/@lando/mysql diff --git a/examples/mysql/README.md b/examples/mysql/README.md new file mode 100644 index 0000000..5515233 --- /dev/null +++ b/examples/mysql/README.md @@ -0,0 +1,52 @@ +PhpMyAdmin MySQL Example +======================== + +This example exists primarily to test phpMyAdmin with MySQL specifically: + +* [PhpMyAdmin Service](https://docs.devwithlando.io/tutorials/phpmyadmin.html) + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should install Lando plugin dependency. +npm ci +``` + +```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 return 200 for the pma admin site +lando exec pma -- curl -I localhost | grep 200 | grep OK + +# Should have mysql database that works correctly +lando exec database -- mysql -umysql -pmysql database -e quit + +# Should have our database hooked up to PMA +lando exec pma -- env | grep PMA_HOSTS=database + +# Should be version 5.2.x +lando exec pma -- curl -s localhost | grep -oP '\K[^<]+' | tee >(cat 1>&2) | grep -q '5.2.' +``` + +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 +``` diff --git a/examples/mysql/package.json b/examples/mysql/package.json new file mode 100644 index 0000000..877448a --- /dev/null +++ b/examples/mysql/package.json @@ -0,0 +1,14 @@ +{ + "name": "mysql", + "version": "1.0.0", + "description": "PhpMyAdmin MySQL Example", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "@lando/mysql": "^1.6.0" + } +} diff --git a/netlify.toml b/netlify.toml index 89ec7db..d45a379 100644 --- a/netlify.toml +++ b/netlify.toml @@ -10,7 +10,7 @@ [[context.deploy-preview.plugins]] package = "netlify-plugin-checklinks" [context.deploy-preview.plugins.inputs] - todoPatterns = [ "load", "CHANGELOG.html", "x.com", "twitter.com", "/v/" ] + todoPatterns = [ "load", "CHANGELOG.html", "x.com", "twitter.com", "/v/", "hub.docker.com" ] skipPatterns = [ ".rss", ".gif", ".jpg" ] checkExternal = true