Apply a changed .env
$ grim reload
You changed a value in .env, saved, refreshed the page, and the app behaves as if nothing happened. That is the moment for grim reload. A container reads its environment once, when it is created, and grim up never recreates one that is already running.
It matters most on a shared dev box, where you edit .env over VS Code Remote-SSH and the stack has been up for weeks.
Usage
$ grim reload # recreate the stack, clear the config cacheRun it from the project directory or anywhere below it. It takes no arguments and no options.
Arguments and options
Recreate the Docker stack to apply .env changes (force-recreate + config:clear)
Usage
grim reloadWhat it actually does
Under the heading Reloading stack, each step printed with its result.
- Writes
docker-compose.ymlagain, only on a shared dev box, wheredeployment.kindingrim.jsonisvps-dev. Changes to services, themes or the domain ingrim.jsonland in the same run. On your own machine the compose file is not touched. - Runs
docker compose up -d --force-recreate. Every service is stopped and created again from the current.envand compose file. Volumes are kept, so the data in them is too. - Runs
php artisan config:clearin the app container, so a cached configuration cannot keep serving the old values. A failure here does not fail the run.
The app is away for the seconds the containers take to come back. Horizon is recreated with the rest, and a job that was running at that moment is interrupted.
Pitfalls
Hand edits to the compose file do not survive on a dev box
Step 1 replaces docker-compose.yml from the template on every reload, and so does grim up there. Put the change into grim.json, where the template reads it.
Vite is not part of it locally
On your own machine Vite runs on the host and grim reload leaves it alone. A changed VITE_ variable needs grim up, which stops the old Vite and starts a new one. On a dev box Vite is a container and is recreated with the others.
After it finishes
Refresh the page. The new value is live. To check what the app now sees, ask it.
$ grim artisan tinkerFrom your laptop, for a project on a dev box, grim server:dev:reload runs this same command on the box over SSH.
Related spells
grim up
Raise the stack
Start the project's containers and its Vite dev server, with a trusted certificate and a working address, and say where to open it.
grim down
Lower the stack
Stop the project's containers and its Vite server. Volumes stay unless you say otherwise.
grim server:dev:reload
Recreate a dev stack
Recreate the containers of a project on a dev box from your own machine, so a changed .env or grim.json takes effect.
grim env:push
Send a .env back
Upload your edited .env.<environment> over the .env of a deployed environment, and optionally recreate the containers that read it.
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.