mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Update makefile
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- Docker & Docker Compose v2+
|
- Docker & **Docker Compose v2.22+** (the Makefile uses `pull --ignore-buildable`)
|
||||||
- A GitHub (scopeless) token for Composer private packages
|
- A GitHub (scopeless) token for Composer private packages
|
||||||
- [Laravel Sail](https://laravel.com/docs/12.x/sail) (included as a dev dependency)
|
- [Laravel Sail](https://laravel.com/docs/12.x/sail) (included as a dev dependency)
|
||||||
|
|
||||||
@@ -55,35 +55,106 @@ dormant and consumes no resources.
|
|||||||
|
|
||||||
## Make Targets
|
## Make Targets
|
||||||
|
|
||||||
Run `make` or `make help` to see all targets:
|
Run `make` or `make help` to see all targets, grouped by section.
|
||||||
|
|
||||||
|
### Lifecycle
|
||||||
|
|
||||||
|
| Target | Description |
|
||||||
|
|-------------------|-----------------------------------------------------------------|
|
||||||
|
| `make up` | Start all services (detached) |
|
||||||
|
| `make down` | Stop all services |
|
||||||
|
| `make restart` | Restart all services |
|
||||||
|
| `make recreate` | Force-recreate containers without rebuilding |
|
||||||
|
| `make build` | Build the app image (cached) |
|
||||||
|
| `make rebuild` | Pull fresh base images + `--no-cache` build + force-recreate |
|
||||||
|
| `make pull` | Pull latest enabled-profile base images (skips buildable ones) |
|
||||||
|
| `make update` | Infra-only: pull + `--pull` build + restart |
|
||||||
|
| `make upgrade` | App upgrade: `update` + composer + npm + migrate + caches |
|
||||||
|
| `make fresh` | **Destroy volumes**, pull, rebuild, recreate (DATA LOSS) |
|
||||||
|
|
||||||
|
### Development
|
||||||
|
|
||||||
| Target | Description |
|
| Target | Description |
|
||||||
|---------------------|-------------------------------------------------------|
|
|---------------------|-------------------------------------------------------|
|
||||||
| `make up` | Start all services (detached) |
|
|
||||||
| `make down` | Stop all services |
|
|
||||||
| `make restart` | Restart all services |
|
|
||||||
| `make build` | Build the app image |
|
|
||||||
| `make rebuild` | Build from scratch (no cache) |
|
|
||||||
| `make pull` | Pull latest base images |
|
|
||||||
| `make update` | Pull + rebuild + restart |
|
|
||||||
| `make fresh` | **Destroy volumes**, rebuild, start clean (DATA LOSS) |
|
|
||||||
| `make shell` | Bash shell in the app container |
|
| `make shell` | Bash shell in the app container |
|
||||||
| `make root-shell` | Root bash shell in the app container |
|
| `make root-shell` | Root bash shell in the app container |
|
||||||
|
| `make tinker` | Laravel Tinker REPL |
|
||||||
| `make artisan cmd=` | Run any artisan command |
|
| `make artisan cmd=` | Run any artisan command |
|
||||||
|
| `make migrate` | Run pending migrations |
|
||||||
|
| `make migrate-fresh`| Drop all tables and re-migrate (DATA LOSS) |
|
||||||
|
| `make seed` | Run database seeders |
|
||||||
|
| `make cache-clear` | Clear config / route / view / app caches |
|
||||||
|
| `make optimize` | Cache config / routes / views + spatie/laravel-data |
|
||||||
|
| `make queue-work` | Foreground queue worker |
|
||||||
|
| `make queue-restart`| Signal queue workers to restart |
|
||||||
| `make tmux-start` | Start the NNTmux tmux processing engine |
|
| `make tmux-start` | Start the NNTmux tmux processing engine |
|
||||||
| `make tmux-stop` | Stop the tmux processing engine |
|
| `make tmux-stop` | Stop the tmux processing engine |
|
||||||
| `make tmux-attach` | Attach to the running tmux session |
|
| `make tmux-attach` | Attach to the running tmux session |
|
||||||
| `make horizon` | Show Horizon queue status |
|
| `make horizon` | Show Horizon queue status |
|
||||||
| `make test` | Run PHPUnit tests (`filter=Name` optional) |
|
|
||||||
| `make pint` | Pint formatter on dirty files |
|
### Testing & Quality
|
||||||
| `make npm-build` | `npm install` + `npm run build` |
|
|
||||||
| `make npm-dev` | Start Vite dev server |
|
| Target | Description |
|
||||||
| `make db` | MariaDB CLI session |
|
|------------------|------------------------------------------------------|
|
||||||
| `make redis-cli` | Redis CLI session |
|
| `make test` | PHPUnit tests (`filter=Name` optional) |
|
||||||
| `make logs` | Tail all container logs |
|
| `make pint` | Pint formatter on dirty files |
|
||||||
| `make status` | Show container status |
|
| `make pint-all` | Pint formatter on all files |
|
||||||
| `make clean` | Prune stopped containers / dangling images |
|
| `make phpstan` | PHPStan static analysis (2G memory limit) |
|
||||||
| `make nuke` | **Remove ALL** project containers, images, volumes |
|
| `make rector` | Rector dry-run (no changes) |
|
||||||
|
| `make rector-fix`| Apply Rector refactorings |
|
||||||
|
|
||||||
|
### Frontend & Types
|
||||||
|
|
||||||
|
| Target | Description |
|
||||||
|
|-----------------------|--------------------------------------|
|
||||||
|
| `make npm-build` | `npm install` + `npm run build` |
|
||||||
|
| `make npm-dev` | Start Vite dev server |
|
||||||
|
| `make ts-types` | Regenerate TypeScript types |
|
||||||
|
| `make ts-types-check` | CI: fail if generated types drift |
|
||||||
|
| `make data-cache` | Cache spatie/laravel-data structures |
|
||||||
|
|
||||||
|
### Logs & Status
|
||||||
|
|
||||||
|
| Target | Description |
|
||||||
|
|---------------------|------------------------------------------------------------------|
|
||||||
|
| `make logs` | Tail all container logs (or `SERVICE=name` for one) |
|
||||||
|
| `make tail-laravel` | Tail `storage/logs/laravel.log` inside the app container |
|
||||||
|
| `make status` / `ps`| Show running containers |
|
||||||
|
| `make top` | Show processes inside each container |
|
||||||
|
| `make images` | Show images used by each service |
|
||||||
|
| `make health` | Healthcheck status per service |
|
||||||
|
|
||||||
|
### Cleanup
|
||||||
|
|
||||||
|
| Target | Description |
|
||||||
|
|---------------|---------------------------------------------------------------|
|
||||||
|
| `make clean` | Prune stopped containers / dangling images |
|
||||||
|
| `make nuke` | **Remove ALL** project containers, images, volumes (DATA LOSS)|
|
||||||
|
|
||||||
|
### Flags
|
||||||
|
|
||||||
|
These can be combined with the targets above:
|
||||||
|
|
||||||
|
| Flag | Effect |
|
||||||
|
|----------------|-----------------------------------------------------------------------|
|
||||||
|
| `FORCE=1` | Skip confirmation prompts on `fresh`, `nuke`, `migrate-fresh` (CI use)|
|
||||||
|
| `MAINTENANCE=1`| Wrap `upgrade` migrations in `artisan down` / `artisan up` |
|
||||||
|
| `SERVICE=name` | Restrict `logs` to a specific compose service |
|
||||||
|
| `CMD="…"` | Free-form command for `artisan` (alternative to `cmd=`) |
|
||||||
|
| `filter=Name` | Pass `--filter=Name` to `make test` |
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make fresh FORCE=1 # non-interactive teardown + rebuild
|
||||||
|
make upgrade MAINTENANCE=1 # zero-downtime-ish upgrade with maint mode
|
||||||
|
make logs SERVICE=mariadb # tail only mariadb
|
||||||
|
make test filter=ReleaseSearchTest # run a single test
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note:** `make pull` / `update` / `rebuild` use `docker compose pull --ignore-buildable`,
|
||||||
|
> which only pulls images for services in the active `COMPOSE_PROFILES` and skips images
|
||||||
|
> that are built locally (e.g. `sail-8.5/app`). Requires Docker Compose v2.22+.
|
||||||
|
|
||||||
You can also use `./sail` directly for anything not covered above —
|
You can also use `./sail` directly for anything not covered above —
|
||||||
unknown commands are passed through to `docker compose`.
|
unknown commands are passed through to `docker compose`.
|
||||||
@@ -167,7 +238,8 @@ docker compose up -d
|
|||||||
| Permission errors on storage/ | `make root-shell` then `chown -R sail:sail storage bootstrap/cache` |
|
| Permission errors on storage/ | `make root-shell` then `chown -R sail:sail storage bootstrap/cache` |
|
||||||
| Port already in use | Change `APP_PORT`, `FORWARD_DB_PORT`, etc. in `.env` |
|
| Port already in use | Change `APP_PORT`, `FORWARD_DB_PORT`, etc. in `.env` |
|
||||||
| Containers won't start | `make logs` to inspect, or `make rebuild` to start fresh |
|
| Containers won't start | `make logs` to inspect, or `make rebuild` to start fresh |
|
||||||
| Stale images after upgrade | `make update` (pulls + rebuilds + restarts) |
|
| Stale images after upgrade | `make update` (pulls base images + rebuild + restart) |
|
||||||
| Need a completely clean slate | `make fresh` (destroys all volumes!) |
|
| Need a completely clean slate | `make fresh` (destroys all volumes; add `FORCE=1` for non-interactive)|
|
||||||
|
| CI / scripted teardown | `make fresh FORCE=1` or `make nuke FORCE=1` to skip prompts |
|
||||||
| supervisorctl not connecting | `make root-shell` then `supervisorctl status` to verify socket path |
|
| supervisorctl not connecting | `make root-shell` then `supervisorctl status` to verify socket path |
|
||||||
|
|
||||||
|
|||||||
@@ -4,193 +4,257 @@
|
|||||||
#
|
#
|
||||||
# Run `make` or `make help` to see all available targets.
|
# Run `make` or `make help` to see all available targets.
|
||||||
# See DOCKER.md for full documentation.
|
# See DOCKER.md for full documentation.
|
||||||
|
#
|
||||||
|
# Common flags:
|
||||||
|
# FORCE=1 Skip confirmation prompts on destructive targets
|
||||||
|
# MAINTENANCE=1 Wrap `upgrade` migrations in artisan down/up
|
||||||
|
# SERVICE=name Restrict a target (e.g. logs) to a single service
|
||||||
|
# CMD="…" Free-form command for `artisan`, `exec`, etc.
|
||||||
|
#
|
||||||
|
# Requires Docker Compose v2.22+ (uses `pull --ignore-buildable`).
|
||||||
# ──────────────────────────────────────────────────────────────
|
# ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
|
|
||||||
# Source SEARCH_DRIVER from .env and export as COMPOSE_PROFILES
|
# Source SEARCH_DRIVER from .env and export as COMPOSE_PROFILES
|
||||||
# so the correct search engine container starts automatically.
|
# so the correct search engine container starts automatically.
|
||||||
-include .env
|
-include .env
|
||||||
export COMPOSE_PROFILES ?= $(SEARCH_DRIVER)
|
export COMPOSE_PROFILES ?= $(SEARCH_DRIVER)
|
||||||
|
SAIL := ./sail
|
||||||
SAIL := ./sail
|
|
||||||
DOCKER_COMPOSE := docker compose
|
DOCKER_COMPOSE := docker compose
|
||||||
|
# Optional parameters with safe defaults
|
||||||
|
SERVICE ?=
|
||||||
|
CMD ?=
|
||||||
|
FORCE ?=
|
||||||
|
MAINTENANCE ?=
|
||||||
# Colors
|
# Colors
|
||||||
CYAN := \033[36m
|
CYAN := \033[36m
|
||||||
GREEN := \033[32m
|
GREEN := \033[32m
|
||||||
YELLOW := \033[33m
|
YELLOW := \033[33m
|
||||||
|
RED := \033[31m
|
||||||
|
BOLD := \033[1m
|
||||||
RESET := \033[0m
|
RESET := \033[0m
|
||||||
|
# ── Confirmation helper ──────────────────────────────────────
|
||||||
|
# Usage: $(call confirm,Are you sure?)
|
||||||
|
# Honours FORCE=1 for non-interactive / CI usage.
|
||||||
|
define confirm
|
||||||
|
@if [ "$(FORCE)" = "1" ]; then \
|
||||||
|
echo "$(YELLOW)⚠ FORCE=1 set — skipping confirmation.$(RESET)"; \
|
||||||
|
else \
|
||||||
|
printf "$(YELLOW)⚠ $(1) [y/N] $(RESET)"; \
|
||||||
|
read confirm; [ "$$confirm" = "y" ] || [ "$$confirm" = "Y" ] || (echo "Aborted." && exit 1); \
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
# ── Pre-flight ───────────────────────────────────────────────
|
||||||
|
.PHONY: check-env
|
||||||
|
check-env: ## Verify .env exists before running docker targets
|
||||||
|
@if [ ! -f .env ]; then \
|
||||||
|
echo "$(RED)✘ .env not found. Run: cp .env.example .env$(RESET)"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
# ── Lifecycle ────────────────────────────────────────────────
|
# ── Lifecycle ────────────────────────────────────────────────
|
||||||
|
|
||||||
.PHONY: up
|
.PHONY: up
|
||||||
up: ## Start all services in the background
|
up: check-env ## Start all services in the background
|
||||||
@$(SAIL) up -d
|
@$(SAIL) up -d
|
||||||
|
|
||||||
.PHONY: down
|
.PHONY: down
|
||||||
down: ## Stop all services
|
down: ## Stop all services
|
||||||
@$(SAIL) down
|
@$(SAIL) down
|
||||||
|
|
||||||
.PHONY: stop
|
.PHONY: stop
|
||||||
stop: down ## Alias for 'down'
|
stop: down ## Alias for 'down'
|
||||||
|
|
||||||
.PHONY: restart
|
.PHONY: restart
|
||||||
restart: ## Restart all services
|
restart: ## Restart all services
|
||||||
@$(SAIL) restart
|
@$(SAIL) restart
|
||||||
|
.PHONY: recreate
|
||||||
|
recreate: check-env ## Force-recreate containers without rebuilding
|
||||||
|
@$(SAIL) up -d --force-recreate --remove-orphans
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: ## Build the app image
|
build: check-env ## Build the app image (cached layers OK)
|
||||||
@$(SAIL) build
|
@$(SAIL) build
|
||||||
|
|
||||||
.PHONY: rebuild
|
.PHONY: rebuild
|
||||||
rebuild: ## Build the app image from scratch (no cache)
|
rebuild: check-env pull ## Rebuild from scratch with fresh base images and recreate
|
||||||
@$(SAIL) build --no-cache
|
@$(SAIL) build --no-cache --pull
|
||||||
|
@$(SAIL) up -d --force-recreate --remove-orphans
|
||||||
|
@echo "$(GREEN)✔ Rebuild complete.$(RESET)"
|
||||||
.PHONY: pull
|
.PHONY: pull
|
||||||
pull: ## Pull the latest versions of all base images
|
pull: check-env ## Pull latest enabled-profile base images (skips buildable)
|
||||||
@$(DOCKER_COMPOSE) pull
|
@$(DOCKER_COMPOSE) pull --ignore-buildable
|
||||||
|
|
||||||
.PHONY: update
|
.PHONY: update
|
||||||
update: pull rebuild ## Pull latest images, rebuild, and restart
|
update: check-env pull ## Infra-only: pull base images, rebuild with --pull, restart
|
||||||
@$(SAIL) up -d
|
@$(SAIL) build --pull
|
||||||
|
@$(SAIL) up -d --remove-orphans
|
||||||
|
@echo "$(GREEN)✔ Infra updated.$(RESET)"
|
||||||
|
.PHONY: upgrade
|
||||||
|
upgrade: update composer-install npm-build ## Full app upgrade: update + composer + npm + migrate + caches
|
||||||
|
@if [ "$(MAINTENANCE)" = "1" ]; then $(SAIL) artisan down; fi
|
||||||
|
@$(SAIL) artisan migrate --force
|
||||||
|
@if [ "$(MAINTENANCE)" = "1" ]; then $(SAIL) artisan up; fi
|
||||||
|
@$(MAKE) data-cache
|
||||||
|
@$(MAKE) optimize
|
||||||
|
@echo "$(GREEN)✔ Upgrade complete.$(RESET)"
|
||||||
.PHONY: fresh
|
.PHONY: fresh
|
||||||
fresh: ## Destroy ALL volumes, rebuild, and start clean (DATA LOSS!)
|
fresh: check-env ## Destroy ALL volumes, rebuild, and start clean (DATA LOSS!)
|
||||||
@echo "$(YELLOW)⚠ This will destroy all Docker volumes (database, redis, search index).$(RESET)"
|
$(call confirm,This will destroy all Docker volumes (database, redis, search index). Continue?)
|
||||||
@read -p "Are you sure? [y/N] " confirm && [ "$$confirm" = "y" ] || exit 1
|
|
||||||
@$(SAIL) down -v
|
@$(SAIL) down -v
|
||||||
@$(SAIL) build --no-cache
|
@$(DOCKER_COMPOSE) pull --ignore-buildable
|
||||||
@$(SAIL) up -d
|
@$(SAIL) build --no-cache --pull
|
||||||
|
@$(SAIL) up -d --force-recreate --remove-orphans
|
||||||
@echo "$(GREEN)✔ Fresh environment is up. Run 'make artisan cmd=nntmux:install' to initialise.$(RESET)"
|
@echo "$(GREEN)✔ Fresh environment is up. Run 'make artisan cmd=nntmux:install' to initialise.$(RESET)"
|
||||||
|
|
||||||
# ── Shell Access ─────────────────────────────────────────────
|
# ── Shell Access ─────────────────────────────────────────────
|
||||||
|
|
||||||
.PHONY: shell
|
.PHONY: shell
|
||||||
shell: ## Open a bash shell in the app container
|
shell: ## Open a bash shell in the app container
|
||||||
@$(SAIL) shell
|
@$(SAIL) shell
|
||||||
|
|
||||||
.PHONY: root-shell
|
.PHONY: root-shell
|
||||||
root-shell: ## Open a root bash shell in the app container
|
root-shell: ## Open a root bash shell in the app container
|
||||||
@$(SAIL) root-shell
|
@$(SAIL) root-shell
|
||||||
|
|
||||||
.PHONY: tinker
|
.PHONY: tinker
|
||||||
tinker: ## Open a Laravel Tinker session
|
tinker: ## Open a Laravel Tinker session
|
||||||
@$(SAIL) tinker
|
@$(SAIL) tinker
|
||||||
|
|
||||||
# ── Artisan / PHP ────────────────────────────────────────────
|
# ── Artisan / PHP ────────────────────────────────────────────
|
||||||
|
|
||||||
.PHONY: artisan
|
.PHONY: artisan
|
||||||
artisan: ## Run an artisan command (usage: make artisan cmd="migrate")
|
artisan: ## Run an artisan command (usage: make artisan cmd="migrate")
|
||||||
@$(SAIL) artisan $(cmd)
|
@$(SAIL) artisan $(cmd)$(CMD)
|
||||||
|
.PHONY: migrate
|
||||||
|
migrate: ## Run pending database migrations
|
||||||
|
@$(SAIL) artisan migrate --force
|
||||||
|
.PHONY: migrate-fresh
|
||||||
|
migrate-fresh: ## Drop all tables and re-run migrations (DATA LOSS!)
|
||||||
|
$(call confirm,This will DROP ALL TABLES and re-run every migration. Continue?)
|
||||||
|
@$(SAIL) artisan migrate:fresh --force
|
||||||
|
.PHONY: seed
|
||||||
|
seed: ## Run database seeders
|
||||||
|
@$(SAIL) artisan db:seed --force
|
||||||
|
.PHONY: cache-clear
|
||||||
|
cache-clear: ## Clear config / route / view / application caches
|
||||||
|
@$(SAIL) artisan config:clear
|
||||||
|
@$(SAIL) artisan route:clear
|
||||||
|
@$(SAIL) artisan view:clear
|
||||||
|
@$(SAIL) artisan cache:clear
|
||||||
|
@echo "$(GREEN)✔ Caches cleared.$(RESET)"
|
||||||
|
.PHONY: optimize
|
||||||
|
optimize: ## Cache config / routes / views and warm spatie/laravel-data
|
||||||
|
@$(SAIL) artisan config:cache
|
||||||
|
@$(SAIL) artisan route:cache
|
||||||
|
@$(SAIL) artisan view:cache
|
||||||
|
@$(SAIL) artisan data:cache-structures
|
||||||
|
@echo "$(GREEN)✔ Optimized.$(RESET)"
|
||||||
|
.PHONY: queue-work
|
||||||
|
queue-work: ## Run a foreground queue worker (Ctrl-C to stop)
|
||||||
|
@$(SAIL) artisan queue:work
|
||||||
|
.PHONY: queue-restart
|
||||||
|
queue-restart: ## Signal all queue workers to restart gracefully
|
||||||
|
@$(SAIL) artisan queue:restart
|
||||||
.PHONY: tmux-start
|
.PHONY: tmux-start
|
||||||
tmux-start: ## Start the NNTmux tmux processing engine
|
tmux-start: ## Start the NNTmux tmux processing engine
|
||||||
@$(SAIL) artisan tmux:start
|
@$(SAIL) artisan tmux:start
|
||||||
|
|
||||||
.PHONY: tmux-stop
|
.PHONY: tmux-stop
|
||||||
tmux-stop: ## Stop the NNTmux tmux processing engine
|
tmux-stop: ## Stop the NNTmux tmux processing engine
|
||||||
@$(SAIL) artisan tmux:stop
|
@$(SAIL) artisan tmux:stop
|
||||||
|
|
||||||
.PHONY: tmux-attach
|
.PHONY: tmux-attach
|
||||||
tmux-attach: ## Attach to the running tmux session
|
tmux-attach: ## Attach to the running tmux session
|
||||||
@$(SAIL) artisan tmux:attach
|
@$(SAIL) artisan tmux:attach
|
||||||
|
|
||||||
.PHONY: horizon
|
.PHONY: horizon
|
||||||
horizon: ## Show Horizon status
|
horizon: ## Show Horizon status
|
||||||
@$(SAIL) artisan horizon:status
|
@$(SAIL) artisan horizon:status
|
||||||
|
|
||||||
# ── Testing & Quality ────────────────────────────────────────
|
# ── Testing & Quality ────────────────────────────────────────
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: ## Run the PHPUnit test suite (usage: make test filter=TestName)
|
test: ## Run the PHPUnit test suite (usage: make test filter=TestName)
|
||||||
@$(SAIL) test $(if $(filter),--filter=$(filter),)
|
@$(SAIL) test $(if $(filter),--filter=$(filter),)
|
||||||
|
|
||||||
.PHONY: pint
|
.PHONY: pint
|
||||||
pint: ## Run Laravel Pint code formatter on dirty files
|
pint: ## Run Laravel Pint code formatter on dirty files
|
||||||
@$(SAIL) pint --dirty
|
@$(SAIL) pint --dirty
|
||||||
|
|
||||||
.PHONY: pint-all
|
.PHONY: pint-all
|
||||||
pint-all: ## Run Laravel Pint on all files
|
pint-all: ## Run Laravel Pint on all files
|
||||||
@$(SAIL) pint
|
@$(SAIL) pint
|
||||||
|
.PHONY: phpstan
|
||||||
|
phpstan: ## Run PHPStan static analysis
|
||||||
|
@$(SAIL) php vendor/bin/phpstan analyse --memory-limit=2G
|
||||||
|
.PHONY: rector
|
||||||
|
rector: ## Run Rector in dry-run mode (no changes written)
|
||||||
|
@$(SAIL) php vendor/bin/rector process --dry-run
|
||||||
|
.PHONY: rector-fix
|
||||||
|
rector-fix: ## Apply Rector refactorings
|
||||||
|
@$(SAIL) php vendor/bin/rector process
|
||||||
# ── Frontend ─────────────────────────────────────────────────
|
# ── Frontend ─────────────────────────────────────────────────
|
||||||
|
|
||||||
.PHONY: npm-build
|
.PHONY: npm-build
|
||||||
npm-build: ## Run npm install and build inside the container
|
npm-build: ## Run npm install and build inside the container
|
||||||
@$(SAIL) npm install
|
@$(SAIL) npm install
|
||||||
@$(SAIL) npm run build
|
@$(SAIL) npm run build
|
||||||
|
|
||||||
.PHONY: npm-dev
|
.PHONY: npm-dev
|
||||||
npm-dev: ## Start Vite dev server inside the container
|
npm-dev: ## Start Vite dev server inside the container
|
||||||
@$(SAIL) npm run dev
|
@$(SAIL) npm run dev
|
||||||
|
|
||||||
.PHONY: ts-types
|
.PHONY: ts-types
|
||||||
ts-types: ## Regenerate TypeScript types from PHP DTOs/Enums
|
ts-types: ## Regenerate TypeScript types from PHP DTOs/Enums
|
||||||
@$(SAIL) artisan typescript:transform
|
@$(SAIL) artisan typescript:transform
|
||||||
|
|
||||||
.PHONY: ts-types-check
|
.PHONY: ts-types-check
|
||||||
ts-types-check: ## CI: regenerate TS types and fail if working tree drifts
|
ts-types-check: ## CI: regenerate TS types and fail if working tree drifts
|
||||||
@$(SAIL) artisan typescript:transform --quiet
|
@$(SAIL) artisan typescript:transform --quiet
|
||||||
@git diff --exit-code resources/js/types/generated.d.ts \
|
@git diff --exit-code resources/js/types/generated.d.ts \
|
||||||
|| (echo "❌ resources/js/types/generated.d.ts is out of date — run 'make ts-types' and commit." && exit 1)
|
|| (echo "❌ resources/js/types/generated.d.ts is out of date — run 'make ts-types' and commit." && exit 1)
|
||||||
|
|
||||||
.PHONY: data-cache
|
.PHONY: data-cache
|
||||||
data-cache: ## Cache spatie/laravel-data structures (run on deploy)
|
data-cache: ## Cache spatie/laravel-data structures (run on deploy)
|
||||||
@$(SAIL) artisan data:cache-structures
|
@$(SAIL) artisan data:cache-structures
|
||||||
|
|
||||||
# ── Dependencies ─────────────────────────────────────────────
|
# ── Dependencies ─────────────────────────────────────────────
|
||||||
|
|
||||||
.PHONY: composer-install
|
.PHONY: composer-install
|
||||||
composer-install: ## Run composer install inside the container
|
composer-install: ## Run composer install inside the container
|
||||||
@$(SAIL) composer install
|
@$(SAIL) composer install
|
||||||
|
|
||||||
.PHONY: composer-update
|
.PHONY: composer-update
|
||||||
composer-update: ## Run composer update inside the container
|
composer-update: ## Run composer update inside the container
|
||||||
@$(SAIL) composer update
|
@$(SAIL) composer update
|
||||||
|
|
||||||
# ── Database / Services ──────────────────────────────────────
|
# ── Database / Services ──────────────────────────────────────
|
||||||
|
|
||||||
.PHONY: db
|
.PHONY: db
|
||||||
db: ## Open a MariaDB CLI session
|
db: ## Open a MariaDB CLI session
|
||||||
@$(SAIL) mariadb
|
@$(SAIL) mariadb
|
||||||
|
|
||||||
.PHONY: redis-cli
|
.PHONY: redis-cli
|
||||||
redis-cli: ## Open a Redis CLI session
|
redis-cli: ## Open a Redis CLI session
|
||||||
@$(SAIL) redis
|
@$(SAIL) redis
|
||||||
|
|
||||||
# ── Logs & Status ────────────────────────────────────────────
|
# ── Logs & Status ────────────────────────────────────────────
|
||||||
|
|
||||||
.PHONY: logs
|
.PHONY: logs
|
||||||
logs: ## Tail logs from all containers
|
logs: ## Tail logs (usage: make logs [SERVICE=mariadb])
|
||||||
@$(DOCKER_COMPOSE) logs -f --tail=100
|
@$(DOCKER_COMPOSE) logs -f --tail=100 $(SERVICE)
|
||||||
|
.PHONY: tail-laravel
|
||||||
|
tail-laravel: ## Tail storage/logs/laravel.log inside the app container
|
||||||
|
@$(SAIL) exec laravel.test tail -f storage/logs/laravel.log
|
||||||
.PHONY: status
|
.PHONY: status
|
||||||
status: ## Show running containers and their status
|
status: ## Show running containers and their status
|
||||||
@$(DOCKER_COMPOSE) ps
|
@$(DOCKER_COMPOSE) ps
|
||||||
|
.PHONY: ps
|
||||||
|
ps: status ## Alias for 'status'
|
||||||
|
.PHONY: top
|
||||||
|
top: ## Show running processes inside each container
|
||||||
|
@$(DOCKER_COMPOSE) top
|
||||||
|
.PHONY: images
|
||||||
|
images: ## Show images used by each service
|
||||||
|
@$(DOCKER_COMPOSE) images
|
||||||
|
.PHONY: health
|
||||||
|
health: ## Show healthcheck status for each service (Compose v2.20+)
|
||||||
|
@$(DOCKER_COMPOSE) ps --format json 2>/dev/null \
|
||||||
|
| awk -F'"' '/"Service"/ {svc=$$4} /"Health"/ {print svc": "$$4}' \
|
||||||
|
| sort -u \
|
||||||
|
|| $(DOCKER_COMPOSE) ps
|
||||||
# ── Cleanup ──────────────────────────────────────────────────
|
# ── Cleanup ──────────────────────────────────────────────────
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean: ## Remove stopped containers and dangling images
|
clean: ## Remove stopped containers and dangling images
|
||||||
@docker system prune -f
|
@docker system prune -f
|
||||||
@echo "$(GREEN)✔ Cleaned up dangling resources.$(RESET)"
|
@echo "$(GREEN)✔ Cleaned up dangling resources.$(RESET)"
|
||||||
|
|
||||||
.PHONY: nuke
|
.PHONY: nuke
|
||||||
nuke: ## Remove ALL project containers, images, and volumes (DATA LOSS!)
|
nuke: ## Remove ALL project containers, images, and volumes (DATA LOSS!)
|
||||||
@echo "$(YELLOW)⚠ This will remove ALL project containers, images, and volumes.$(RESET)"
|
$(call confirm,This will remove ALL project containers/images/volumes. Continue?)
|
||||||
@read -p "Are you sure? [y/N] " confirm && [ "$$confirm" = "y" ] || exit 1
|
|
||||||
@$(SAIL) down -v --rmi all
|
@$(SAIL) down -v --rmi all
|
||||||
@echo "$(GREEN)✔ All project Docker resources removed.$(RESET)"
|
@echo "$(GREEN)✔ All project Docker resources removed.$(RESET)"
|
||||||
|
|
||||||
# ── Help ─────────────────────────────────────────────────────
|
# ── Help ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help: ## Show this help message
|
help: ## Show this help message, grouped by section
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "$(CYAN)NNTmux Docker / Sail Commands$(RESET)"
|
@echo "$(CYAN)$(BOLD)NNTmux Docker / Sail Commands$(RESET)"
|
||||||
@echo "$(CYAN)─────────────────────────────$(RESET)"
|
@echo "$(CYAN)─────────────────────────────$(RESET)"
|
||||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
@awk ' \
|
||||||
awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-20s$(RESET) %s\n", $$1, $$2}'
|
/^# ── .* ──/ { \
|
||||||
|
line=$$0; sub(/^# ── /, "", line); sub(/ ──.*/, "", line); \
|
||||||
|
printf "\n\033[1;33m%s\033[0m\n", line; next \
|
||||||
|
} \
|
||||||
|
/^[a-zA-Z_-]+:.*?## / { \
|
||||||
|
split($$0, a, ":.*?## "); \
|
||||||
|
split(a[1], b, ":"); \
|
||||||
|
printf " \033[32m%-20s\033[0m %s\n", b[1], a[2] \
|
||||||
|
}' $(MAKEFILE_LIST)
|
||||||
|
@echo ""
|
||||||
|
@echo "$(CYAN)Flags:$(RESET) FORCE=1 MAINTENANCE=1 SERVICE=name CMD=\"…\""
|
||||||
@echo ""
|
@echo ""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user