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 onRun 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.
- Running containers. Name, image, status and ports, straight from
docker ps. The status column is where anunhealthyorRestartingcontainer shows. - 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. - Traefik. The status of the shared Traefik container, or
not found. - Projects. What your own
servers.jsonrecords 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.
Related spells
grim server:upgrade-traefik
Renew a server's Traefik
Re-render the shared Traefik compose file of a production server from the current template and recreate the container.
grim server:add-project
Give a project a home
Prepare one environment of a project on a production server, with its database, nginx vhost, certificate, compose stack and .env.
grim server:keys
Grant or revoke deploy access
List, add and remove the SSH keys that may log in as a server's deploy user, each under a label you choose.
grim logs
Read the logs
Show what the containers have been printing, for one service or all of them, on your machine or on a deployed server.