jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
7.94k stars 191 forks source link

Mariadb service not starting on macOS #2023

Open JoyceBabu opened 2 months ago

JoyceBabu commented 2 months ago

What happened?

mariadb service fails to start on macOS. The following command is not working

mysqld --log-error=$MYSQL_HOME/mysql.log & MYSQL_PID=$! && echo 'Starting mysqld... check mariadb_logs for details'

It works if I remove the & MYSQL_PID=$! assignment

Steps to reproduce

1. 2. 3.

Command

services

devbox.json

{
  "packages": [
    "path:devbox.d/php#php",
    "path:devbox.d/php#php.packages.composer",
    "apacheHttpd@latest",
    "mariadb@latest",
    "nodejs-18_x@latest",
    "yarn@latest",
    "jq@latest",
    "redis@latest",
    "podman@4"
  ],
  "env": {
    "DEVBOX_COREPACK_ENABLED": "true",
    "DOCUMENT_ROOT": "$PWD/public_html",
    "HTTPD_PID_FILE": "$PWD/.devbox/virtenv/apacheHttpd/apache2.pid",
    "HTTPD_PORT": "8080",
    "HTTPD_SECURE_PORT": "8443",
    "HTTPD_SSLDIR": "$PWD/.devbox/virtenv/apacheHttpd/ssl",
    // Redis fails to starts without this
    "LANG": "",
    // "MYSQL_HOME": "$PWD/devbox.d/mysql",
    // "MYSQL_PID_FILE": "$PWD/.devbox/virtenv/mariadb/run/mysql.pid",
    // "MYSQL_UNIX_PORT": "$PWD/.devbox/virtenv/mariadb/run/mysql.sock",
    "PHP_CONFDIR": "$PWD/conf/php",
    "PHPFPM_ERROR_LOG_FILE": "$PWD/logs/php-fpm.log",
    "PHPFPM_PORT": "9001",
    "PROJECT_DIR": "$PWD"
  },
  "shell": {
    "init_hook": [
      // "source conf/set-env.sh"
    ]
  },
  "nixpkgs": {
    "commit": "f80ac848e3d6f0c12c52758c0f25c10c97ca3b62"
  },
  "include": [
    "plugin:php",
    "path:devbox.d/podman/plugin.json"
  ]
}

Devbox version

0.10.5

Nix version

nix (Nix) 2.22.0

What system does this bug occur on?

macOS (Intel)

Debug logs

No response

JoyceBabu commented 2 months ago

Interestingly, the command works when directly executed in terminal.

Usually MYSQL_PID is immediately defined, when you need to wait on the process, or to call killall $MYSQL_PID after calling mysqlshutdown. Since devbox is using neither of them, is it required?