Skip to content

Lower the stack

$ grim down

The end of a working day, or the moment another project needs the memory. grim down stops the containers of the project you are standing in and removes them. Nothing you would miss goes with them: what a container needs to keep lives in a volume, and volumes are left alone.

It works on one project. The Traefik that routes every .test domain on the machine belongs to all of them, so it keeps running.

Usage

$ grim down               # stop this project, keep its volumes
$ grim down --volumes     # stop it and delete what the volumes held

Run it from the project directory. Anywhere else it has no grim.json to go by and says so.

Arguments and options

Stop Docker services

Usage

grim down [--volumes]

Options

Option Description
--volumes Remove volumes (docker compose down -v)

What it actually does

Three things, in this order.

  1. Stops Vite. The dev server grim up started runs on your machine, not in a container, so Docker would never stop it. Left alone it keeps its port and the next grim up finds it taken.
  2. Removes public/hot. That file tells the app to load assets from the dev server. With Vite gone it would point every page at nothing.
  3. Runs docker compose down. Containers and the project network are removed. With --volumes it is docker compose down -v.

What --volumes takes with it

That depends on where the project runs, because the database does not live in the same place everywhere.

Where In a volume --volumes costs you
Your machine Redis Cache, sessions and queued jobs. The database runs on the machine itself, outside the stack, and is not touched.
A shared dev box MySQL and Redis The project's whole database, for everyone who works on that box.

There is no prompt and no way back except a dump made earlier. On a dev box, ask before you run it. It is a way to a clean slate on purpose, not a fix for a container that will not start.

After it finishes

Nothing of the project is running and nothing is lost. grim up brings it back as it was. After --volumes the same grim up starts the stack with empty volumes.