tutorial

How to Monitor Moonrepo with Vigilmon

Moonrepo is a high-performance build system and monorepo management tool written in Rust. It brings strict task orchestration, dependency hashing, and remote...

Moonrepo is a high-performance build system and monorepo management tool written in Rust. It brings strict task orchestration, dependency hashing, and remote caching to large polyglot codebases. But when the services Moonrepo builds and deploys go down, Moonrepo itself won't tell you.

In this tutorial you'll add external uptime monitoring to services managed by Moonrepo using Vigilmon — free tier, no credit card required.


Why monitor Moonrepo managed services?

Moonrepo is designed for monorepos where dozens of projects share build pipelines, shared toolchains, and interconnected deployment targets. Once those services are running, the standard failure modes apply:

  • Build cache invalidation side effects — a stale remote cache entry causes a service to ship an incorrect binary without any local error
  • Task graph misconfigurations — a misconfigured moon.yml skips a critical build step, deploying an incomplete artifact
  • Service crashes after deploy — Moonrepo's CI task completes successfully while the deployed process dies seconds later
  • Environment variable drift — workspace-level env vars differ between environments, causing silent behavioral differences in production

Vigilmon monitors from outside your infrastructure, giving you an objective signal that is independent of what Moonrepo's task runner or CI system reports.


What you'll need

  • A service in a Moonrepo workspace that exposes an HTTP or TCP endpoint
  • A free Vigilmon account

Step 1: Add a health endpoint to your service

Give Vigilmon something reliable to check. Add a /health route to the application Moonrepo builds and deploys.

For a Node.js service in a Moonrepo workspace:

app.get('/health', (req, res) => {
  res.json({
    status: 'ok',
    project: process.env.MOON_PROJECT_ID || 'unknown',
    uptime: process.uptime()
  });
});

For a Go service in a Moonrepo workspace:

http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-Type", "application/json")
    fmt.Fprintf(w, `{"status":"ok","uptime":%d}`, int(time.Since(startTime).Seconds()))
})

Including the MOON_PROJECT_ID environment variable in the response makes it easy to confirm exactly which Moonrepo project is serving traffic — useful when multiple projects share a domain behind a proxy.


Step 2: Add a health check task to moon.yml

Define a Moonrepo task that verifies the deployed service is healthy before CI marks the deployment successful:

# apps/api/moon.yml
tasks:
  health-check:
    command: curl
    args:
      - --fail
      - --silent
      - --max-time
      - "10"
      - https://api.example.com/health
    deps:
      - deploy
    options:
      runInCI: true

This ensures that moon run api:health-check only passes if the deployed HTTP endpoint returns a 200 response.


Step 3: Set up HTTP monitoring in Vigilmon

Once your service is running at a publicly reachable URL, point Vigilmon at the health endpoint:

  1. Log in to vigilmon.online and go to Monitors → New Monitor
  2. Choose HTTP / HTTPS
  3. Set the URL to your health endpoint, e.g. https://api.example.com/health
  4. Set the check interval to 1 minute
  5. Under Expected response, set:
    • Status code: 200
    • (Optional) Response body contains: "status":"ok"
  6. Save the monitor

Vigilmon checks from multiple regions every minute. A timeout or non-200 response opens an incident immediately.


Step 4: Add TCP port monitoring for internal services

Moonrepo monorepos often include non-HTTP services — background workers, gRPC servers, database proxies. Add a TCP monitor for any port your Moonrepo-deployed process binds:

  1. Go to Monitors → New Monitor
  2. Choose TCP Port
  3. Enter your server hostname and port, e.g. worker.example.com / 9000
  4. Save

If the process crashes or the port binding drops, Vigilmon fires an alert within a minute — regardless of what the process supervisor or Moonrepo task status reports.


Step 5: Track key metrics

| Metric | What it catches | |---|---| | HTTP response code | Application crash, bad deploy, missing build artifact | | HTTP response time | Performance regression from build output change | | TCP port reachability | Process exit, failed service start after deploy | | Response body project field | Wrong project deployed behind proxy |

Vigilmon stores response time history automatically. Set a threshold alert (e.g. alert if response time > 2 s) to detect performance regressions after a Moonrepo rebuild.


Step 6: Add a heartbeat monitor to Moonrepo CI runs

Moonrepo's task runner handles large build graphs. When a remote cache outage or toolchain failure causes CI to hang or skip tasks, the deployment never happens — and you want to know. Add a Vigilmon heartbeat to your CI pipeline:

  1. In Vigilmon, go to New Monitor → Heartbeat
  2. Name it Moonrepo CI — main
  3. Set the expected interval to your CI frequency (e.g. 1 hour for continuous CI)
  4. Copy the ping URL

In your GitHub Actions workflow:

- name: Run Moonrepo build and deploy
  run: moon run :build :deploy

- name: Ping Vigilmon — CI run succeeded
  if: success()
  run: |
    curl -fsS -X POST "${{ secrets.VIGILMON_MOON_HEARTBEAT_URL }}" \
      --max-time 10 --retry 3

If Moonrepo's task graph fails or hangs, no ping is sent and Vigilmon alerts after the grace period expires.


Step 7: Configure alert channels

  1. Go to Alert Channels → Add Channel
  2. Choose Email or Webhook (Slack, Discord, PagerDuty)
  3. Assign the channel to your HTTP and TCP monitors
  4. Set the alert trigger to 1 failed check for immediate notification

When a service goes down:

🔴 DOWN: api.example.com/health
Duration: 3 minutes
Last response: timeout

When it recovers:

✅ RECOVERED: api.example.com/health
Downtime: 3 minutes

Step 8: Create a status page for your monorepo services

Moonrepo monorepos often deploy several services simultaneously. A status page surfaces all of them in one view:

  1. Go to Status Pages → New Status Page
  2. Name it (e.g. "Monorepo Services Status")
  3. Add all HTTP and TCP monitors for each project in the monorepo
  4. Publish and share the URL with your team

Team members can check which project is down before filing a bug, and on-call engineers get a single dashboard view across the entire monorepo.


Conclusion

Moonrepo brings speed and correctness to monorepo builds. Vigilmon ensures the services those builds produce are actually serving healthy traffic. Together they close both the "bad build" and "service is down" gaps. Set up a /health endpoint, create a one-minute Vigilmon HTTP monitor, and add heartbeat monitoring to your Moonrepo CI pipeline — you'll have full coverage in under ten minutes.

Get started free at vigilmon.online.

Monitor your app with Vigilmon

Free plan — 5 monitors, no credit card required. Up and running in 60 seconds.

Start free →