DEV Community

Vigilmon
Vigilmon

Posted on

How to Monitor Your Railway Application with Vigilmon

How to Monitor Your Railway Application with Vigilmon

Railway is a developer-friendly platform for deploying apps, databases, and services. It handles deployments, scaling, and networking — but external uptime monitoring is your responsibility. Here's how to monitor your Railway application with Vigilmon.

What Railway Handles vs. What You Monitor

Railway provides:

  • Automatic deployments from GitHub
  • Health check restarts (if you configure them)
  • Built-in metrics (CPU, memory, network)
  • Automatic HTTPS via Let's Encrypt

Railway does NOT provide:

  • External uptime monitoring with team alerts
  • Response time tracking from end-user perspectives
  • SSL expiry warnings (auto-renew can fail)
  • Heartbeat monitoring for cron jobs
  • Incident history with timestamps for SLA reporting

Vigilmon fills these gaps.

Step 1: Add a Health Endpoint to Your App

Add a simple health route that Vigilmon can check:

Node.js/Express:

app.get('/health', (req, res) => {
  res.json({ status: 'ok', timestamp: Date.now() });
});
Enter fullscreen mode Exit fullscreen mode

Python/FastAPI:

@app.get("/health")
async def health():
    return {"status": "ok"}
Enter fullscreen mode Exit fullscreen mode

Go:

http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
    json.NewEncoder(w).Encode(map[string]string{"status": "ok"})
})
Enter fullscreen mode Exit fullscreen mode

Ruby on Rails:

# config/routes.rb
get '/health', to: proc { [200, {}, ['OK']] }
Enter fullscreen mode Exit fullscreen mode

Laravel (PHP):

// routes/web.php
Route::get('/health', fn() => response()->json(['status' => 'ok']));
Enter fullscreen mode Exit fullscreen mode

Step 2: Set Up Vigilmon

  1. Sign up at vigilmon.online
  2. Click New MonitorHTTP Monitor
  3. Enter your Railway app URL: https://your-app.up.railway.app/health
    • Or your custom domain if configured
  4. Check interval: 1 minute
  5. Expected status: 200
  6. Add alert channels (email, Slack, PagerDuty)
  7. Save

Vigilmon starts checking from multiple regions immediately.

Step 3: Configure Railway Health Checks

For Railway's own restart behavior, add health check configuration in your railway.toml:

[deploy]
healthcheckPath = "/health"
healthcheckTimeout = 100
Enter fullscreen mode Exit fullscreen mode

This tells Railway to wait for /health to return 200 before considering a deployment successful. Combined with Vigilmon, you get both automatic restarts and team alerting.

Step 4: SSL Certificate Monitoring

  1. New Monitor → SSL Certificate
  2. Domain: your-app.up.railway.app or your custom domain
  3. Alert threshold: 30 days before expiry

Railway uses Let's Encrypt (90-day certs). If auto-renewal fails, you need to know 30 days early, not on the day it expires.

Step 5: Monitor Railway Databases

If you're using Railway's managed PostgreSQL, MySQL, or Redis, add a database health check via your app:

Node.js database health endpoint:

app.get('/health', async (req, res) => {
  try {
    await db.query('SELECT 1'); // Quick connectivity check
    res.json({ status: 'ok', database: 'ok' });
  } catch (err) {
    res.status(500).json({ status: 'error', database: 'unreachable' });
  }
});
Enter fullscreen mode Exit fullscreen mode

This catches Railway database issues via your app's perspective.

Step 6: Heartbeat Monitors for Railway Cron Jobs

Railway supports cron jobs via the platform's scheduler. Add heartbeat monitoring:

  1. In Vigilmon, create a Heartbeat Monitor
  2. Copy the unique ping URL
  3. Add a curl command at the end of your cron job:

In your cron job script:

#!/bin/bash
# Your job logic
node scripts/daily-cleanup.js

# Ping Vigilmon on success
curl -s "https://vigilmon.online/ping/your-heartbeat-id" > /dev/null
Enter fullscreen mode Exit fullscreen mode

If your Railway cron job fails or stops, Vigilmon detects the missed heartbeat and alerts you.

Step 7: Monitor After Each Deployment

Railway deploys automatically from GitHub pushes. Add Vigilmon checks to your deployment workflow:

GitHub Actions post-deploy check:

- name: Verify deployment health
  run: |
    sleep 30  # Wait for Railway deployment
    curl -f https://your-app.up.railway.app/health || exit 1
Enter fullscreen mode Exit fullscreen mode

And check your Vigilmon dashboard after each deploy to confirm the app came back healthy.

Railway Failure Modes

Failure Vigilmon Detects?
Container crash / OOM Yes — HTTP check fails during restart
Railway platform incident Yes — external monitoring catches it
Database connection lost Yes — enhanced health endpoint returns 500
SSL renewal failure Yes — SSL monitor
Bad deploy (errors) Yes — immediate HTTP check failure
Cron job stopped Yes — heartbeat monitor
Memory limits exceeded Yes — slow responses → timeout alert

Railway vs. Vigilmon: Complementary Roles

Feature Railway Vigilmon
CPU/memory metrics Yes No
Deploy logs Yes No
Health check restarts Yes No
External uptime monitoring No Yes
Response time from user perspective No Yes
SSL expiry alerts No Yes
Team alerting (Slack/PagerDuty) No Yes
Incident history / SLA data No Yes
Heartbeat / cron monitoring No Yes

Use Railway's dashboard for infrastructure metrics and deploys. Use Vigilmon for what your users actually experience.

Summary

Monitoring your Railway application with Vigilmon:

  1. Add /health endpoint to your app
  2. Configure Railway's healthcheckPath in railway.toml
  3. Create HTTP uptime monitor in Vigilmon
  4. Add SSL certificate monitor
  5. Add heartbeat monitors for cron jobs
  6. Set up Slack + email + PagerDuty alerts

Railway's internal metrics tell you about infrastructure; Vigilmon tells you what your users are experiencing.


Monitor your Railway application with Vigilmon — free to start.

Top comments (0)