homebrew-malt

Malt Configuration Customization Guide

While Malt sets up your development environment based on malt.json, you can flexibly adapt it to project-specific requirements by customizing the generated configuration files. This guide explains how to customize settings, important notes, and provides specific examples.

Basic Customization Steps

  1. Run malt create: First, execute the malt create command to generate the malt/ directory in your project root, along with conf, logs, tmp, var subdirectories, and configuration files for various services.
    • About the public/ directory:
      • If a public/ directory does not exist in your project, malt create will create it and copy Malt’s basic dashboard files (index.html, index.php, etc.) into it. These files are for initial verification; feel free to edit or delete them and replace them with your project’s content.
      • If a public/ directory already exists in your project, malt create will not make any changes to this directory. Your existing files will be preserved and used as the web server’s document root.
  2. Edit Configuration Files: To customize the behavior of services like web servers (Nginx, Apache), PHP, or MySQL, directly edit the configuration files generated within the malt/conf/ directory (e.g., nginx_80.conf, php.ini, my_3306.cnf).
  3. Run malt start: After editing, run malt start to launch the services with your customized settings.

Important Notes:

Steps for Updating Environment After malt.json Changes

If you modify dependencies or ports in malt.json (e.g., removing Apache and adding Nginx), follow these steps to update your environment:

  1. Update Dependencies: Run malt install to install any new dependencies. (You might need to manually run brew uninstall for dependencies that are no longer needed).
  2. Remove Existing Configuration: Manually delete (or rename) the entire malt/ directory.
  3. Regenerate Configuration Files: Run malt create to generate new configuration files in malt/conf/ based on the updated malt.json.
  4. Re-apply Customizations (If Necessary): If you had previous customizations, re-apply them to the newly generated configuration files. (Version control can help you see the differences and re-apply changes).
  5. Start Services: Run malt start.

Template Variables in Configuration Files

The configuration files generated by malt create in malt/conf/ utilize the following template variables, which are automatically expanded when services start. You can also use these variables in your customizations.

Specific Customization Examples

Here are some common customization examples. Edit the corresponding files within malt/conf/.

Nginx

Target files: malt/conf/nginx_*.conf, malt/conf/nginx_main.conf

PHP

Target files: malt/conf/php.ini, malt/conf/php-fpm_*.conf

MySQL

Target file: malt/conf/my_*.cnf

(Examples for other services like Apache, Redis, etc., will be added later)

Language-Specific Guides

Malt primarily manages dependencies for background services (web servers, databases, caches) and development tools (wget, composer, etc.) via Homebrew. Version management for specific programming languages (e.g., switching between multiple Ruby versions) is typically handled by dedicated tools like rbenv, pyenv, nvm, volta, etc.

However, you can add language runtimes available via Homebrew (e.g., ruby@3.2, go, node) to Malt’s dependencies to install a specific version as a project dependency.

Here are examples of using Malt with different languages:

Ruby

Go

Node.js

Summary:

Malt is language-agnostic and helps define and manage dependencies for services and tools available via Homebrew on a per-project basis. While you can install language runtimes using Malt, combining it with dedicated language version managers is often effective.