Sign inSign up

sujoy2000/watchdawg

By sujoy2000

•Updated 5 months ago

Image
0

568

sujoy2000/watchdawg repository overview

⁠watchdawg — Server Monitor

A self-hosted server uptime monitoring tool. Track servers across projects and environments, get email alerts on downtime, run automated security audits on your EC2 instances, and manage incidents — all from a clean dashboard.

Full documentation: github.com/SujoyGhosh-scott/watchdawg⁠


⁠Quick Start

⁠1. Supabase setup

Create a free Supabase⁠ project, open the SQL Editor, and paste + run the contents of supabase/setup.sql⁠ from the repo. That one file creates the full schema.

⁠2. Run the container
docker run -d \
  --name watchdawg \
  --restart unless-stopped \
  -p 4000:4000 \
  -e SUPABASE_URL=https://xxxxx.supabase.co \
  -e SUPABASE_SERVICE_ROLE_KEY=eyJ... \
  -e JWT_SECRET=<64-char random string> \
  -e BREVO_API_KEY=xkeysib-... \
  -e [email protected] \
  -e FRONTEND_URL=https://your-domain.com \
  sujoy2000/watchdawg:latest

Open http://your-host:4000 and go to /setup to create your admin account.

Generate a JWT secret:

node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"

Add resource limits and proxy through nginx:

docker run -d \
  --name watchdawg \
  --restart unless-stopped \
  -p 127.0.0.1:4000:4000 \
  --memory="512m" --memory-swap="512m" --cpus="0.5" \
  --env-file /home/ubuntu/.env.watchdawg \
  sujoy2000/watchdawg:latest

Sample nginx site config (place in /etc/nginx/sites-available/):

server {
    listen 80;
    server_name your-domain.com;

    limit_req  zone=watchdawg_req burst=40 nodelay;
    limit_conn watchdawg_conn 5;

    add_header X-Frame-Options       DENY;
    add_header X-Content-Type-Options nosniff;

    location / {
        proxy_pass         http://127.0.0.1:4000;
        proxy_http_version 1.1;
        proxy_set_header   Host              $host;
        proxy_set_header   X-Real-IP         $remote_addr;
        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   Upgrade           $http_upgrade;
        proxy_set_header   Connection        "upgrade";
    }
}

Add the rate-limit zone definitions to the http {} block in /etc/nginx/nginx.conf:

limit_req_zone  $binary_remote_addr zone=watchdawg_req:1m  rate=20r/s;
limit_conn_zone $binary_remote_addr zone=watchdawg_conn:1m;

⁠Environment Variables

VariableRequiredDescription
SUPABASE_URLYesYour Supabase project URL
SUPABASE_SERVICE_ROLE_KEYYesService role key (server-side only)
JWT_SECRETYesMinimum 32 characters
BREVO_API_KEYYesBrevo transactional email API key
EMAIL_FROM_ADDRESSYesVerified sender address
EMAIL_FROM_NAMENoDisplay name for emails (default: ServerMonitor)
FRONTEND_URLNoPublic URL — used in email links (default: http://localhost)
API_PORTNoPort the API listens on (default: 4000)
GITHUB_OIDC_ALLOWED_REPOSNoComma-separated org/repo slugs allowed to post audit results

⁠Instance Health Monitoring (optional)

Run automated security audits on your AWS EC2 instances via GitHub Actions — no stored SSH keys, no stored API keys.

Each audit checks ~20 things: disk/memory usage, open ports vs expected ports, suspicious processes, failed systemd services, SSL certificate expiry, recent SSH logins, .env file permissions, and more.

Setup:

  1. In the dashboard go to a project → Instance Health → Add Instance. Copy the Monitor ID.
  2. In your GitHub repo, add:
    • Secrets: AWS_DEPLOY_ROLE_ARN, AWS_REGION, API_URL
    • Variable: INSTANCES_JSON_PRODUCTION / INSTANCES_JSON_STAGING
      [
        {
          "name": "My Server",
          "instance_monitor_id": "<Monitor ID from dashboard>",
          "ec2_instance_id": "i-0abc123",
          "ec2_host": "1.2.3.4",
          "app_dirs": ["/home/ubuntu/myapp"]
        }
      ]
      
  3. Copy the workflow files from .github/workflows/⁠ into your repo.
  4. Set GITHUB_OIDC_ALLOWED_REPOS=your-org/your-repo in the container's environment.

⁠Tags

latest tracks the main branch. Versioned tags (e.g. 0.3.0) are pinned releases.

Tag summary

Content type

Image

Digest

sha256:16d58a9c6…

Size

108.8 MB

Last updated

5 months ago

docker pull sujoy2000/watchdawg