Conventions

mstrap makes decisions while trying to adhere to a series of conventions.

The following is a rough outline of those conventions and when they can be deviated from during the course of an mstrap run:

  1. init
    1. Creates runtime configuration directory
    2. Installs/updates cURL CA bundle
    3. Downloads/updates copy of strap or strap-linux
    4. If it doesn’t exist, creates a Brewfile for the default profile.
      • Many of the dependencies in the Brewfile are required for the operation of other mstrap steps.
  2. dependencies
    1. Install mise, if mise is enabled as the default runtime manager.
    2. Run strap or strap-linux. This will:
      1. (macOS only) Set security defaults
      2. Install OS updates.
      3. Install necessary development tools
      4. Setup your Git user
      5. If you have a dotfiles repo for your GitHub user, it will clone it and run script/setup, if it exists.
      6. If you have a homebrew-Brewfile repo for your GitHub user, it will clone it and run brew bundle with it.
      7. If you have a .Brewfile in your home directory, it will run brew bundle with it.
      8. If it cloned your dotfiles repo and it has a script/strap-after-setup, it will be run.
    3. Reload profiles (in case dotfiles scripts installed/changed some)
    4. Run brew bundle for all loaded profiles and their Brewfile
  3. shell
    1. Injects a shell script loader (e.g. source ~/.mstrap/env.sh in Bash) into the current running shell’s configuration to load mstrap and various mstrap-related environment variables on load.
  4. services
    1. If any profiles (or mstrap internally) have any active services defined via a services.yml, the containers will be (re)created.
  5. projects
    1. If there are any web projects, an NGINX container will be created. This will attempt to install Docker if it’s not installed already.
    2. For each project:
      1. The project will be cloned or updated.
        • If it already exists and there are active changes, the changes will be autostashed and restored while it is updated and bootstrapped.
      2. The project will be bootstrapped.
      3. If the project has a script/bootstrap and/or script/setup, they will be run, unless this has been disabled at the project config level (run_scripts = false).
      4. Otherwise, mstrap will guess which runtimes it uses, and do standard operations like: installing the asdf or mise plugin for the language, installing the version of the language runtime (if specified by the project), and installing dependencies via the language runtime’s package manager.
      5. If the project is a web project, an NGINX configuration will be created for the project.
        • If mkcert is installed, it will setup TLS certs for the NGINX site as well.
  6. runtimes
    1. If there are configured runtimes, it sets the global version to the latest installed version.
    2. If there are any global packages specified, it installs them for all installed versions of the language runtime.