|
4 | 4 |
|
5 | 5 | ## Prerequisites |
6 | 6 |
|
7 | | -- Docker & Docker Compose v2+ |
| 7 | +- Docker & **Docker Compose v2.22+** (the Makefile uses `pull --ignore-buildable`) |
8 | 8 | - A GitHub (scopeless) token for Composer private packages |
9 | 9 | - [Laravel Sail](https://laravel.com/docs/12.x/sail) (included as a dev dependency) |
10 | 10 |
|
@@ -55,35 +55,106 @@ dormant and consumes no resources. |
55 | 55 |
|
56 | 56 | ## Make Targets |
57 | 57 |
|
58 | | -Run `make` or `make help` to see all targets: |
| 58 | +Run `make` or `make help` to see all targets, grouped by section. |
| 59 | + |
| 60 | +### Lifecycle |
| 61 | + |
| 62 | +| Target | Description | |
| 63 | +|-------------------|-----------------------------------------------------------------| |
| 64 | +| `make up` | Start all services (detached) | |
| 65 | +| `make down` | Stop all services | |
| 66 | +| `make restart` | Restart all services | |
| 67 | +| `make recreate` | Force-recreate containers without rebuilding | |
| 68 | +| `make build` | Build the app image (cached) | |
| 69 | +| `make rebuild` | Pull fresh base images + `--no-cache` build + force-recreate | |
| 70 | +| `make pull` | Pull latest enabled-profile base images (skips buildable ones) | |
| 71 | +| `make update` | Infra-only: pull + `--pull` build + restart | |
| 72 | +| `make upgrade` | App upgrade: `update` + composer + npm + migrate + caches | |
| 73 | +| `make fresh` | **Destroy volumes**, pull, rebuild, recreate (DATA LOSS) | |
| 74 | + |
| 75 | +### Development |
59 | 76 |
|
60 | 77 | | Target | Description | |
61 | 78 | |---------------------|-------------------------------------------------------| |
62 | | -| `make up` | Start all services (detached) | |
63 | | -| `make down` | Stop all services | |
64 | | -| `make restart` | Restart all services | |
65 | | -| `make build` | Build the app image | |
66 | | -| `make rebuild` | Build from scratch (no cache) | |
67 | | -| `make pull` | Pull latest base images | |
68 | | -| `make update` | Pull + rebuild + restart | |
69 | | -| `make fresh` | **Destroy volumes**, rebuild, start clean (DATA LOSS) | |
70 | 79 | | `make shell` | Bash shell in the app container | |
71 | 80 | | `make root-shell` | Root bash shell in the app container | |
| 81 | +| `make tinker` | Laravel Tinker REPL | |
72 | 82 | | `make artisan cmd=` | Run any artisan command | |
| 83 | +| `make migrate` | Run pending migrations | |
| 84 | +| `make migrate-fresh`| Drop all tables and re-migrate (DATA LOSS) | |
| 85 | +| `make seed` | Run database seeders | |
| 86 | +| `make cache-clear` | Clear config / route / view / app caches | |
| 87 | +| `make optimize` | Cache config / routes / views + spatie/laravel-data | |
| 88 | +| `make queue-work` | Foreground queue worker | |
| 89 | +| `make queue-restart`| Signal queue workers to restart | |
73 | 90 | | `make tmux-start` | Start the NNTmux tmux processing engine | |
74 | 91 | | `make tmux-stop` | Stop the tmux processing engine | |
75 | 92 | | `make tmux-attach` | Attach to the running tmux session | |
76 | 93 | | `make horizon` | Show Horizon queue status | |
77 | | -| `make test` | Run PHPUnit tests (`filter=Name` optional) | |
78 | | -| `make pint` | Pint formatter on dirty files | |
79 | | -| `make npm-build` | `npm install` + `npm run build` | |
80 | | -| `make npm-dev` | Start Vite dev server | |
81 | | -| `make db` | MariaDB CLI session | |
82 | | -| `make redis-cli` | Redis CLI session | |
83 | | -| `make logs` | Tail all container logs | |
84 | | -| `make status` | Show container status | |
85 | | -| `make clean` | Prune stopped containers / dangling images | |
86 | | -| `make nuke` | **Remove ALL** project containers, images, volumes | |
| 94 | + |
| 95 | +### Testing & Quality |
| 96 | + |
| 97 | +| Target | Description | |
| 98 | +|------------------|------------------------------------------------------| |
| 99 | +| `make test` | PHPUnit tests (`filter=Name` optional) | |
| 100 | +| `make pint` | Pint formatter on dirty files | |
| 101 | +| `make pint-all` | Pint formatter on all files | |
| 102 | +| `make phpstan` | PHPStan static analysis (2G memory limit) | |
| 103 | +| `make rector` | Rector dry-run (no changes) | |
| 104 | +| `make rector-fix`| Apply Rector refactorings | |
| 105 | + |
| 106 | +### Frontend & Types |
| 107 | + |
| 108 | +| Target | Description | |
| 109 | +|-----------------------|--------------------------------------| |
| 110 | +| `make npm-build` | `npm install` + `npm run build` | |
| 111 | +| `make npm-dev` | Start Vite dev server | |
| 112 | +| `make ts-types` | Regenerate TypeScript types | |
| 113 | +| `make ts-types-check` | CI: fail if generated types drift | |
| 114 | +| `make data-cache` | Cache spatie/laravel-data structures | |
| 115 | + |
| 116 | +### Logs & Status |
| 117 | + |
| 118 | +| Target | Description | |
| 119 | +|---------------------|------------------------------------------------------------------| |
| 120 | +| `make logs` | Tail all container logs (or `SERVICE=name` for one) | |
| 121 | +| `make tail-laravel` | Tail `storage/logs/laravel.log` inside the app container | |
| 122 | +| `make status` / `ps`| Show running containers | |
| 123 | +| `make top` | Show processes inside each container | |
| 124 | +| `make images` | Show images used by each service | |
| 125 | +| `make health` | Healthcheck status per service | |
| 126 | + |
| 127 | +### Cleanup |
| 128 | + |
| 129 | +| Target | Description | |
| 130 | +|---------------|---------------------------------------------------------------| |
| 131 | +| `make clean` | Prune stopped containers / dangling images | |
| 132 | +| `make nuke` | **Remove ALL** project containers, images, volumes (DATA LOSS)| |
| 133 | + |
| 134 | +### Flags |
| 135 | + |
| 136 | +These can be combined with the targets above: |
| 137 | + |
| 138 | +| Flag | Effect | |
| 139 | +|----------------|-----------------------------------------------------------------------| |
| 140 | +| `FORCE=1` | Skip confirmation prompts on `fresh`, `nuke`, `migrate-fresh` (CI use)| |
| 141 | +| `MAINTENANCE=1`| Wrap `upgrade` migrations in `artisan down` / `artisan up` | |
| 142 | +| `SERVICE=name` | Restrict `logs` to a specific compose service | |
| 143 | +| `CMD="…"` | Free-form command for `artisan` (alternative to `cmd=`) | |
| 144 | +| `filter=Name` | Pass `--filter=Name` to `make test` | |
| 145 | + |
| 146 | +Examples: |
| 147 | + |
| 148 | +```bash |
| 149 | +make fresh FORCE=1 # non-interactive teardown + rebuild |
| 150 | +make upgrade MAINTENANCE=1 # zero-downtime-ish upgrade with maint mode |
| 151 | +make logs SERVICE=mariadb # tail only mariadb |
| 152 | +make test filter=ReleaseSearchTest # run a single test |
| 153 | +``` |
| 154 | + |
| 155 | +> **Note:** `make pull` / `update` / `rebuild` use `docker compose pull --ignore-buildable`, |
| 156 | +> which only pulls images for services in the active `COMPOSE_PROFILES` and skips images |
| 157 | +> that are built locally (e.g. `sail-8.5/app`). Requires Docker Compose v2.22+. |
87 | 158 |
|
88 | 159 | You can also use `./sail` directly for anything not covered above — |
89 | 160 | unknown commands are passed through to `docker compose`. |
@@ -167,7 +238,8 @@ docker compose up -d |
167 | 238 | | Permission errors on storage/ | `make root-shell` then `chown -R sail:sail storage bootstrap/cache` | |
168 | 239 | | Port already in use | Change `APP_PORT`, `FORWARD_DB_PORT`, etc. in `.env` | |
169 | 240 | | Containers won't start | `make logs` to inspect, or `make rebuild` to start fresh | |
170 | | -| Stale images after upgrade | `make update` (pulls + rebuilds + restarts) | |
171 | | -| Need a completely clean slate | `make fresh` (destroys all volumes!) | |
| 241 | +| Stale images after upgrade | `make update` (pulls base images + rebuild + restart) | |
| 242 | +| Need a completely clean slate | `make fresh` (destroys all volumes; add `FORCE=1` for non-interactive)| |
| 243 | +| CI / scripted teardown | `make fresh FORCE=1` or `make nuke FORCE=1` to skip prompts | |
172 | 244 | | supervisorctl not connecting | `make root-shell` then `supervisorctl status` to verify socket path | |
173 | 245 |
|
0 commit comments