tutorial

How to Monitor Flox Developer Environments with Vigilmon

Flox brings Nix's reproducible package management to everyday developer workflows — you define your environment in a manifest, share it with your team, and e...

Flox brings Nix's reproducible package management to everyday developer workflows — you define your environment in a manifest, share it with your team, and everyone gets identical tooling regardless of OS or existing system configuration. But when those environments power long-running services, shared development URLs, or automated build pipelines, you need external visibility into whether those services are actually reachable.

In this tutorial you'll set up uptime monitoring for services running inside Flox environments using Vigilmon — free tier, no credit card required.


Why Flox services need external monitoring

Flox manages the software environment, not the runtime health of the services running inside it. The gap matters when:

  • Activation scripts have side effects — a Flox environment that activates a background process (database, API server, proxy) may fail to start that process on a fresh machine without any obvious error
  • Services bind to specific network interfaces — Nix-pinned versions of tools like Nginx or Caddy may behave differently than expected when $FLOX_ENV changes the library path, causing silent bind failures
  • Shared developer environments — when your whole team activates the same Flox environment, a broken shared service (mock API, local registry, test database) affects everyone at once
  • CI and automation — Flox environments increasingly run in CI pipelines where service startup failures produce cryptic exit codes rather than clear error messages
  • Preview environments on cloud VMs — teams that use Flox to provision consistent cloud dev boxes need to know when the services on those boxes go offline

Vigilmon monitors your services from external geographic vantage points, independent of Flox's environment activation layer. Whether a service fails because of a dependency mismatch, a startup race condition, or a plain application crash, Vigilmon tells you within a minute.


What you'll need

  • Flox installed (curl -fsSL https://flox.dev/install | bash)
  • A service running inside a Flox environment with a network-accessible endpoint
  • A free Vigilmon account (sign up takes 30 seconds)

Step 1: Define and activate your Flox environment

Start with a reproducible Flox environment that includes your service and any tooling you need to operate it. Here's an example for a Python FastAPI service:

# .flox/env/manifest.toml
[install]
python311 = { pkg-path = "python311" }
python311Packages.fastapi = { pkg-path = "python311Packages.fastapi" }
python311Packages.uvicorn = { pkg-path = "python311Packages.uvicorn" }
curl = { pkg-path = "curl" }

[hook]
on-activate = """
  echo "Flox environment activated"
  echo "Python: $(python --version)"
"""

[profile]
bash = """
  export APP_PORT=8000
  export APP_ENV=development
"""

Activate the environment and start the service:

flox activate
uvicorn main:app --host 0.0.0.0 --port 8000 &

Add a health endpoint to your application so Vigilmon has a clean signal to probe:

# main.py
from fastapi import FastAPI
import time

app = FastAPI()

@app.get("/health")
def health():
    return {"status": "ok", "env": "flox", "ts": time.time()}

Verify it responds:

curl http://localhost:8000/health
# {"status":"ok","env":"flox","ts":1705315380.0}

If you're exposing this service externally (via a tunneling tool like Cloudflare Tunnel or ngrok, or on a cloud VM), confirm the public URL responds before adding it to Vigilmon.


Step 2: Set up HTTP monitoring in Vigilmon

With your service URL verified, add it to Vigilmon:

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

Vigilmon immediately begins probing your endpoint from multiple geographic regions. It cross-checks failures across regions before alerting — you won't get paged for a single-region network blip.

Monitoring multiple Flox environments

Teams often maintain multiple environments (one per project, one per developer, or one per branch). Monitor each separately:

| Environment | URL | Monitor name | |-------------|-----|--------------| | Shared dev API | https://dev-api.yourteam.example.com/health | flox/dev-api | | Integration tests | https://integration.yourteam.example.com/health | flox/integration | | Staging | https://staging.yourteam.example.com/health | flox/staging |


Step 3: Heartbeat monitoring for Flox-activated jobs

Flox environments often run scheduled scripts, build jobs, or background workers — not just HTTP services. For these, Vigilmon's heartbeat monitors are more appropriate than HTTP uptime checks.

A heartbeat monitor expects a ping at regular intervals. If your job stops reporting in, Vigilmon alerts you.

Create a heartbeat monitor:

  1. In Vigilmon, go to Monitors → New Monitor
  2. Choose Heartbeat
  3. Set the expected interval (e.g., every 5 minutes for a build job)
  4. Copy the unique heartbeat URL Vigilmon provides

Ping Vigilmon from your Flox job:

#!/usr/bin/env bash
# build-and-ping.sh — runs inside Flox environment

set -e

echo "Running build job at $(date)"
make build
make test

# Signal success to Vigilmon
curl -fsS --retry 3 "https://hb.vigilmon.online/your-heartbeat-id" > /dev/null
echo "Heartbeat sent to Vigilmon"

Wire this into your Flox environment's activation hook or call it from your CI pipeline. If the job crashes before sending the heartbeat, Vigilmon alerts you within one missed interval.


Step 4: TCP port monitoring

HTTP monitoring catches application-level failures. TCP monitoring catches lower-level issues — the service failing to bind its port, a firewall rule change blocking traffic, or a process crash that leaves the port unreachable.

Add a TCP monitor for each critical port:

  1. In Vigilmon, go to Monitors → New Monitor
  2. Choose TCP Port
  3. Enter the host and port (e.g., dev.yourteam.example.com and 8000)
  4. Save the monitor

This is especially useful for non-HTTP services that Flox environments commonly run: PostgreSQL on 5432, Redis on 6379, or gRPC services on custom ports.


Step 5: Configure alert channels

When a Flox service goes down, your team needs immediate notification — not a "hey is the dev environment broken?" message three hours later.

Email alerts

  1. In Vigilmon, go to Alert Channels → Add Channel → Email
  2. Add your team distribution list
  3. Assign the channel to your Flox monitors

Webhook alerts for Slack

  1. Go to Alert Channels → Add Channel → Webhook
  2. Enter your Slack incoming webhook URL
  3. Assign the channel to your Flox monitors

Vigilmon sends a structured payload when a monitor goes down:

{
  "monitor_name": "flox/dev-api /health",
  "status": "down",
  "url": "https://dev-api.yourteam.example.com/health",
  "started_at": "2024-01-15T10:23:00Z",
  "duration_seconds": 120
}

You can use this to trigger automated recovery — for example, a webhook handler that SSH-es into the dev box and re-activates the Flox environment:

# Recovery script triggered by Vigilmon webhook
ssh dev-box "cd /project && flox activate -- uvicorn main:app --host 0.0.0.0 --port 8000 &"

Diagnosing Flox service failures

When Vigilmon alerts you, use this diagnostic sequence:

# Check if the process is running
pgrep -a uvicorn

# Check Flox environment activation
flox activate -- python -c "import uvicorn; print('uvicorn ok')"

# Test the service from inside the Flox environment
flox activate -- curl http://localhost:8000/health

# Check network binding
ss -tlnp | grep 8000

# Check system logs for crashes
journalctl -u your-service -n 50 --no-pager

If the service responds locally but Vigilmon shows it as down, the issue is in the network path — firewall rules, tunnel configuration, or reverse proxy setup.


Step 6: SSL certificate monitoring

If your Flox service is exposed over HTTPS, Vigilmon monitors your TLS certificate automatically when you set up an HTTPS check. You'll receive alerts:

  • 30 days before expiry — time to renew before users are affected
  • 7 days before expiry — urgent warning
  • On expiry — the monitor reports the endpoint as down

Certificate expiry is a common failure mode for self-hosted development infrastructure that uses Let's Encrypt or self-signed certs. Vigilmon's automatic expiry checks catch this before your team hits browser security warnings.


Step 7: Create a status page for your team

If developers on your team rely on shared Flox-powered services (shared databases, mock APIs, artifact registries), give them a single place to check service health instead of asking in Slack.

  1. In Vigilmon, go to Status Pages → New Status Page
  2. Name it: "Dev Infrastructure"
  3. Add your monitors organized by category:
    • APIs: dev-api, integration endpoint
    • Data: Postgres, Redis
    • Tools: artifact registry, mock server
  4. Publish the page

You get a public URL your whole team can bookmark.


Putting it all together

Here's a complete monitoring setup for a Flox-powered development environment:

| Monitor | Type | What it catches | |---------|------|-----------------| | https://dev-api.yourteam.example.com/health | HTTP | App crashes, routing failures | | dev-api.yourteam.example.com:8000 | TCP | Port binding failures | | Build job heartbeat | Heartbeat | Scheduled job failures | | https://dev-api.yourteam.example.com | SSL | Certificate expiry |


What's next

  • Environment-per-PR monitoring — if your team creates a Flox environment for each pull request, automate monitor creation via the Vigilmon API when a PR opens and cleanup when it merges
  • Dependency health checks — add monitors for upstream services your Flox environment depends on (package registries, container registries) so you can distinguish "my service is broken" from "a dependency is broken"
  • Incident history — Vigilmon logs all downtime events so you can correlate outages with Flox environment changes or dependency updates

Get started free at vigilmon.online — no credit card, monitors start running in under a minute.

Monitor your app with Vigilmon

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

Start free →