Debug Production

Quick workflows for debugging a running production app without SSHing by hand. All commands assume you're in the project directory (with gon.json) and the project is registered in ~/.gon/servers.json.

Tail the Laravel log

gon remote:exec tail -f storage/logs/laravel.log

Press Ctrl+C to stop following. For a one-shot dump of the last 200 lines:

gon remote:exec tail -200 storage/logs/laravel.log

Check container health

gon remote:exec docker compose ps
gon remote:exec docker compose logs --tail=100 app
gon remote:exec docker compose logs --tail=100 horizon

Clear caches after a config change

gon remote:artisan config:clear
gon remote:artisan cache:clear
gon remote:artisan route:clear
gon remote:artisan view:clear

Or re-cache in one go:

gon remote:artisan optimize

Run a quick database query via tinker

gon remote:artisan tinker --execute="echo \Modules\Users\Models\User::count();"
gon remote:artisan tinker --execute="dd(\Modules\Orders\Models\Order::latest()->first()->toArray());"

Or open an interactive tinker session:

gon remote:artisan tinker

Restart queue workers after deploy

gon remote:artisan queue:restart
gon remote:exec docker compose restart horizon

Inspect Horizon state

gon remote:artisan horizon:status
gon remote:exec docker compose logs --tail=50 horizon

Re-run a failed job

gon remote:artisan queue:failed
gon remote:artisan queue:retry all

Open a shell inside the app container

When you need to poke around manually (e.g. checking file permissions, running ad-hoc PHP), a shell is the fastest way:

gon remote:shell

You're dropped into bash at /var/www/html. Type exit to leave. You can also target other services:

gon remote:shell mysql # MySQL client container
gon remote:shell horizon # Horizon queue worker

Inspect disk usage

gon remote:exec df -h
gon remote:exec du -sh storage/app storage/logs
gon remote:exec docker system df

Pull the production .env for local comparison

gon env:pull production
diff .env .env.production

See gon env for more on environment management.

Safety notes

  • These commands run as the deploy user over SSH — whatever permissions that user has on the server, you have
  • No undo, no sandbox, no audit log beyond the shell history on the server itself
  • Test destructive artisan commands locally first (gon artisan migrate:rollback), then replay on production (gon remote:artisan migrate:rollback)
  • For changes that mutate data, snapshot the database first via gon remote:exec docker compose exec -T mysql mysqldump ... or your backup routine