Skip to content

Recreate a dev stack

$ grim server:dev:reload shop

Someone changed a value in the project's .env on the box and the app behaves as if nothing happened. Containers read .env when they are created, and grim up does not recreate a container that is already running. grim server:dev:reload does, without you opening a session on the box first.

If you are already attached to the box, grim reload in the project directory is the same thing.

Usage

$ grim server:dev:reload shop        # recreate the stack of shop on its box
$ grim server:dev:reload shop -v     # the same, with the remote output as it comes

Run it from anywhere. The project must be in your ~/.grim/servers.json as a dev environment, which means you added it with grim server:dev:add-project from this machine.

Arguments and options

Recreate a dev project stack on its VPS to apply .env changes

Usage

grim server:dev:reload <project>

Arguments

Argument Description
project Project name (required)

What it actually does

  1. Finds the box and the path in servers.json and prints Reloading shop on 203.0.113.10….
  2. Runs grim reload on the box, as dev, in the project directory. It waits up to five minutes.
  3. The reload there renders docker-compose.yml again from the template, so a change to grim.json such as a new service or another theme lands as well.
  4. Recreates every container with docker compose up -d --force-recreate.
  5. Clears the config cache with php artisan config:clear in the app container.
  6. Prints what the box printed, step by step with timings. Without -v it arrives in one piece once the reload is over.

Pitfalls

Everyone on the project feels it

The stack is shared. Recreating it cuts every open page, hot-reload socket and running queue job for whoever is working on that project. The database and Redis data sit in volumes and survive. Say a word in the team channel first.

It does not pull code

Reload works with the files that are on the box. New commits arrive there by git pull in the project directory, and most code changes need no reload at all, since the source is mounted into the containers.

A colleague's machine does not know the project

No dev environment registered for project "shop". means this machine never added it. Attach to the box and run grim reload there instead.

After it finishes

The containers are new and read the current .env. Check them on the card.

$ grim server:dev:info shop

Recipes that use it