Configuration

mstrap uses a few HCL-based configuration files to define how mstrap works.

  • ~/.mstrap/config.hcl defines a few properties about who you are, any managed profiles, and other settings about how mstrap should operate.
  • ~/.mstrap/profile.hcl defines the default profile to be setup by mstrap. Here you can define projects and packages that will be automatically installed and setup by mstrap.

config.hcl

This file is automatically created by mstrap. A basic one will just contain the details about the user:

e.g.

version = "1.0"

user {
  name = "Max Fierke"
  email = "max@example.com"
  github = "maxfierke"
}

Using “managed” profiles

By default, mstrap just reads the default local profile configuration defined by ~/.mstrap/profile.hcl.

In addition to this, you can configure mstrap to use so-called managed profiles, which can be pulled in from local or remote sources.

At runtime, these profiles are merged together, with later-defined profiles overwriting any conflicts (e.g. projects with the same cname). The default local profile will be merged in last.

e.g.

# ~/.mstrap/config.hcl
version = "1.0"

user {
  name = "Max Fierke"
  email = "max@example.com"
  github = "maxfierke"
}

# Might contain a limited profile of things I want to share between my personal
# machine and my work machine
profile "baseline" {
  url = "ssh://git@github.com/maxfierke/mstrap-profile-baseline.git"
}

# Might contain some stuff I'm playing around with for the time being or while
# developing a new managed profile
profile "testing" {
  # Resolved relative to ~/.mstrap
  url = "file://../testing_stuff"
}

# Might be managed by my company, and contains all the projects I need for my work
profile "work" {
  url = "ssh://git@workgit.biz/PlaceOfBizness/mstrap-profile-vry-impt-bizness.git"
  revision = "SOME_COMMIT_SHA"
}

# Might be a third party who's profile I've vetted, and I'm locking into a specific checksum
# If it changes, I'll need to re-vet and update the checksum to use it.
profile "third-party" {
  url = "https://some-yahoos-website.com/profile.hcl"
  revision = "sha256:c81cde435453558cb6da7ce4b14f4690636cf76f234364df9265453ccb2002e1"
}

~/.mstrap/profile.hcl will always be loaded by mstrap and should not be included in the profiles configuration. If you use managed profiles heavily, you might consider ~/.mstrap/profile.hcl just for local machine use and keep few things in it.

When I run mstrap, I’ll get the packages, projects, and Docker-managed services of all profiles.

If you change a profile’s revision (or do not include one), you can run mstrap update-profiles to fetch the new version. Then, you may run mstrap to apply those updates.

Security Note: Only use managed profiles that you trust. Managed profiles have the potential to execute programs via project bootstrapping or packages installed by the profile. When possible, add revision fields to avoid surprises.