Pollito Dev
January 31, 2025

VPS 4: Deploying a real time stats dashboard

Posted on January 31, 2025  •  2 minutes  • 294 words  • Other languages:  Español

This is the fourth part of my VPS blog series .

Glances With Docker Compose

It’s time to deploy our first project: a real-time server stats dashboard. We’ll use Glances , a lightweight Python-based tool.

  1. Create a new project: Let’s call it vps-stats. By default, it will be in an Environment: Production. coolify-new-project

  2. Add resource: Choose Docker Compose. coolify-new-resource

  3. Paste the glances YAML : You need to adapt it a little bit for Coolify. Here’s the final working version:

    version: '3'
    services:
      monitoring:
        image: nicolargo/glances:latest
        restart: always
        pid: host
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
          - /etc/os-release:/etc/os-release:ro
        environment:
          - "GLANCES_OPT=-w"
    

    coolify-docker-compose

  4. Configure domain and deploy: stats.yourdomain.com:61208 coolify-domain-config

Once live, visit stats.yourdomain.com to see your dashboard stats

Secure With Caddy Basic Auth

Why?

Generate hashed password

Caddy has a built-in command caddy hash-password

caddy hash-password
	[-p, --plaintext <password>]
	[-a, --algorithm <name>]

If for any reason you have Caddy installed in your machine, you can run it there. I don’t have Caddy on mine, but the VPS has Docker installed on it, so we can:

Add to the service docker-compose.yml the caddy label

Now it should look something like this:

version: '3'
services:
  monitoring:
    image: 'nicolargo/glances:latest'
    restart: always
    pid: host
    volumes:
      - '/var/run/docker.sock:/var/run/docker.sock'
      - '/etc/os-release:/etc/os-release:ro'
    environment:
      - GLANCES_OPT=-w
    labels:
      - 'caddy_0.basicauth.0_YOURUSERHERE=YOURHASHEDPASSWORDHERE'

caddy-basicauth

Restart the service and visit stats.yourdomain.com. You should now see an auth prompt.

login-form

Next lecture

VPS 5: Deploying a Full-Stack App

Hey, check me out!

You can find me here