Skip to content

Look over a server

$ grim server:status vps1

Something on a server feels off and you want the first look before you open an SSH session. Is every container up, is the disk full, is Traefik alive. grim server:status answers those three in one screen. Without an argument it answers a simpler question: which servers do I have, and under which alias.

Usage

$ grim server:status          # the servers in your servers.json, no connection made
$ grim server:status vps1     # connect and look at one server
$ grim server:status shop     # the same, for the server the project shop lives on

Run it from anywhere. The argument is an alias, an address or the name of a registered project.

Arguments and options

Show server status — running projects, Traefik, disk usage

Usage

grim server:status [<host>]

Arguments

Argument Description
host Server host, alias, or project name (optional)

What it actually does

With no argument it reads ~/.grim/servers.json and prints each server with its alias. Nothing is contacted.

With an argument it connects as the server's service user, deploy on a production server, and prints four things.

  1. Running containers. Name, image, status and ports, straight from docker ps. The status column is where an unhealthy or Restarting container shows.
  2. Disk usage. One line for the root filesystem, such as Used: 31G / 75G (42%), then what Docker holds in images, containers, volumes and build cache, and how much of it could be reclaimed.
  3. Traefik. The status of the shared Traefik container, or not found.
  4. Projects. What your own servers.json records for that host.

Pitfalls

The project list is local, the container table is real

(none registered) under the projects heading does not mean the server is empty. That list comes from the servers.json on your machine, not from the server, so a project a colleague added is missing from it. The container table above it shows what is running, whoever put it there.

An unknown name is not looked up anywhere

Unknown server or project: vps9 means the argument is not an alias, not a project and does not look like an address. Run the command without an argument to see the names you do have.

After it finishes

A Traefik that keeps restarting, or is missing while every project answers with 502, is a job for grim server:upgrade-traefik. A single project's container that will not stay up is better read with grim logs --remote=production from the project directory.

Recipes that use it