Skip to content

Commit 57e9cdf

Browse files
94nonialexandre-daubois
authored andcommitted
feat: add local data for testing
1 parent dacc0d3 commit 57e9cdf

File tree

5 files changed

+52
-0
lines changed

5 files changed

+52
-0
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,16 @@ internal/
3737
model/ State management, derived metrics, percentiles
3838
ui/ Bubble Tea TUI components (dashboard, tables, graphs)
3939
exporter/ Prometheus metrics export
40+
local/ Local data for testing
4041
```
4142

43+
> [!NOTE]
44+
> You can start a local FrankenPHP instance for fast testing:
45+
>
46+
> ```bash
47+
> cd local && make local
48+
> ```
49+
4250
## Running Tests
4351
4452
```bash

local/Caddyfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
auto_https off
3+
admin 0.0.0.0:2019
4+
metrics
5+
frankenphp
6+
}
7+
8+
:8080 {
9+
root * /app/public
10+
rewrite * /index.php
11+
php
12+
}

local/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.DEFAULT_GOAL := help
2+
3+
.PHONY: local clean help
4+
5+
local: ## Start docker compose via build & up in the local folder
6+
@command -v docker >/dev/null 2>&1 || { echo >&2 "Docker is not installed. Please install it."; exit 1; }
7+
docker compose build && docker compose up -d
8+
9+
clean: ## Clean docker compose in the local folder
10+
@command -v docker >/dev/null 2>&1 || { echo >&2 "Docker is not installed. Please install it."; exit 1; }
11+
docker compose down
12+
13+
help: ## Show this help
14+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'

local/compose.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
frankenphp:
3+
image: dunglas/frankenphp:latest
4+
ports:
5+
- "8080:8080"
6+
- "2019:2019"
7+
volumes:
8+
- ./public:/app/public
9+
- ./Caddyfile:/etc/frankenphp/Caddyfile

local/public/index.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
$ms = \random_int(10, 350);
4+
\usleep($ms * 1000);
5+
\header('Content-Type: application/json');
6+
echo \json_encode([
7+
'ms' => $ms,
8+
'uniqid' => \uniqid(),
9+
]);

0 commit comments

Comments
 (0)