Skip to content

Show a project's dev card

$ grim server:dev:info shop

Three weeks after a project went onto the box, somebody asks what the Mailpit address was, or what the database password is. The summary grim server:dev:add-project printed is long gone from the terminal. grim server:dev:info prints it again, and adds what the containers are doing right now.

Usage

$ grim server:dev:info shop     # the card for one project

Run it from anywhere. It reads the project's dev environment from your ~/.grim/servers.json, so it works on the machine that ran grim server:dev:add-project and nowhere else.

Arguments and options

Print URLs, SSH command, DB credentials and container status for a dev project

Usage

grim server:dev:info <project>

Arguments

Argument Description
project Project name (required)

What it actually does

  1. Reads the registration. Host, domains, path and database credentials come from servers.json, as they were saved when the project was added. Nothing is asked of the server for this part.
  2. Asks the box for container states. It connects as dev and runs docker compose ps in the project directory. When that fails for any reason, the card is printed without those rows and without an error.
  3. Prints the card. The app URL, the Vite and Mailpit hosts, the ssh and code --remote commands, the project path, an SSH tunnel command for the database with the name, user and password to use through it, and one row per service with its state.

Pitfalls

No container rows is a finding, not a glitch

The rows are dropped silently when the box cannot be reached as dev, when the project directory is gone, or when the stack was never started. If the card ends at the database password, check ssh dev@<host> first.

The card shows what was saved, not what is

The database values are a copy made when the project was added. Someone editing .env on the box does not change your card, and neither does a project name with a dash, which .env stores with an underscore. When the card and the app disagree, .env in the project directory on the box is right.

It only knows projects you added

No dev environment registered for project "shop". Run grim server:dev:add-project first. on a colleague's machine does not mean the project is missing from the box. The registration lives with whoever added it. Send them the card.

The card prints the database password in plain text. It is a dev database, but think before pasting the whole card into a public channel.

After it finishes

Nothing has changed anywhere. To act on what the card showed, grim server:dev:reload recreates a stack that is not picking up its .env, and grim server:dev:remove takes the project off the box.

Recipes that use it