Skip to main content

Examples

Copy-pasteable snippets for the most common real-world mac workflows.

Onboard a New Agent

~$ mac env set MASTER_IP=10.1.5.7
~$ mac pull agent
~$ mac start agent

Check the Whole Cluster's Health

~$ mac test # on the master, or anywhere with MASTER_IP set
~$ echo $? # 0 = all passed, 1 = failures, 2 = master unreachable

One command checks every MAC service on the node — on an all-in-one deployment that is the master and agent services together — plus the core cluster API. No login required — ideal for cron jobs and CI gates. Start the stack first with mac start; mac test only inspects a running deployment.

Run a Local Development Build

~$ export MAC_CONFIG_DIR=$PWD/deploy # from a source checkout
~$ mac build master # build images from ./services
~$ mac start master --local # run exactly what was built

Switch to a Private Mirror

~$ mac env set MAC_REGISTRY=registry.internal.example.com/mac
~$ mac pull all
~$ mac restart all

Configure Switch SSH Credentials (Mixed Fleet)

~$ mac env set SWITCH_USER=admin SWITCH_PASSWD_LIST=admin,123455,YourThirdPassword
~$ mac restart master

Back Up Prometheus Before mac clean

~$ docker run --rm \
-v mac-prometheus-data:/data \
-v $(pwd):/backup \
alpine tar czf /backup/prometheus-backup-$(date +%Y%m%d).tgz /data
~$ mac clean

Restore Prometheus

~$ docker volume create mac-prometheus-data
~$ docker run --rm \
-v mac-prometheus-data:/data \
-v $(pwd):/backup \
alpine tar xzf /backup/prometheus-backup-20260128.tgz -C /
~$ mac start master

Pre-Set the Initial Admin Password

~$ mac env set MAC_ADMIN_PASSWORD='S3curity!'
~$ mac start master # picks up the value on first run only

Reset the Admin Password Later

~$ mac stop master
~$ docker volume rm mac-api-data # deletes users.json and JWT secret
~$ mac env set MAC_ADMIN_PASSWORD='New-S3cur1ty!'
~$ mac start master

Reload Agent After a Driver Upgrade

~$ sudo apt install -y --only-upgrade nvidia-driver-590
~$ mac restart agent

The metrics-bridge on the master automatically picks the agent back up; no master-side restart needed.