diff --git a/.env.example b/.env.example index 74ff7f0a..dedd5f15 100644 --- a/.env.example +++ b/.env.example @@ -32,8 +32,8 @@ CONFIG_DB_SSL_MODE=DISABLED # Debug DB credentials (used when CONFIG_DB_TARGET=debug) # Any blank debug value falls back to the live value above. -CONFIG_DB_DEBUG_HOST= -CONFIG_DB_DEBUG_USER= -CONFIG_DB_DEBUG_PASSWORD= -CONFIG_DB_DEBUG_DATABASE= +CONFIG_DB_DEBUG_HOST=mysql-debug +CONFIG_DB_DEBUG_USER=root +CONFIG_DB_DEBUG_PASSWORD=debug_root_password +CONFIG_DB_DEBUG_DATABASE=nnks_db_debug CONFIG_DB_DEBUG_SSL_MODE=DISABLED diff --git a/README.md b/README.md index bb880691..6a4c4c9d 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ Backend API for Copenhagen Truck Wash services. - PHP 8.2 CLI (optional, for host-side testing) ### Local Development -To bring up the minimal development stack (Traefik, Redis, Caddy, and one PHP worker): +To bring up the minimal development stack (Traefik, Redis, MySQL debug DB, Caddy, and one PHP worker): ```powershell -docker compose up -d traefik redis php1 caddy +docker compose up -d traefik redis mysql-debug php1 caddy ``` The API is accessible at: @@ -80,6 +80,19 @@ Optional overrides: - Skip image build: `-SkipBuild` or `SKIP_BUILD=1` - Force image rebuild: `-ForceBuild` or `FORCE_BUILD=1` +### Clone Live DB Into `mysql-debug` Service +To refresh the docker-compose debug DB from live credentials in `.env`: + +PowerShell: +```powershell +powershell -ExecutionPolicy Bypass -File .\scripts\clone-live-to-debug-db.ps1 -Force +``` + +Bash: +```bash +FORCE=1 ./scripts/clone-live-to-debug-db.sh +``` + ### Test Layout - `tests/Unit/*`: isolated unit and route-level behavior tests. - `tests/Integration/*`: Redis/DB-backed tests intended for Docker/CI environments. diff --git a/scripts/run.ps1 b/scripts/run.ps1 index b2cb9c81..7a8f04ff 100644 --- a/scripts/run.ps1 +++ b/scripts/run.ps1 @@ -12,7 +12,7 @@ Set-Location $RootDir switch ($Action) { "start" { - docker compose up -d traefik redis php1 caddy + docker compose up -d traefik redis mysql-debug php1 caddy } "stop" { docker compose down diff --git a/scripts/run.sh b/scripts/run.sh index f10cc86f..79209ee7 100644 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -9,7 +9,7 @@ SERVICE="${2:-php1}" case "$ACTION" in start) - docker compose up -d traefik redis php1 caddy + docker compose up -d traefik redis mysql-debug php1 caddy ;; stop) docker compose down diff --git a/scripts/setup.ps1 b/scripts/setup.ps1 index ae3659c3..d3590d38 100644 --- a/scripts/setup.ps1 +++ b/scripts/setup.ps1 @@ -14,5 +14,5 @@ if (-not $docker) { throw "Docker is required but was not found in PATH." } -docker compose up -d --build traefik redis php1 caddy +docker compose up -d --build traefik redis mysql-debug php1 caddy Write-Host "API stack started: http://localhost" diff --git a/scripts/setup.sh b/scripts/setup.sh index 8eac9770..c39b3571 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -14,5 +14,5 @@ if ! command -v docker >/dev/null 2>&1; then exit 1 fi -docker compose up -d --build traefik redis php1 caddy +docker compose up -d --build traefik redis mysql-debug php1 caddy echo "API stack started: http://localhost"