mirror of
https://github.com/coollabsio/coolify.git
synced 2026-10-06 14:07:37 -04:00
- Add live 24h polling toggle to server/application analytics views - Add geo visualization (world map, country flags/names) for traffic - Add dashboard nudge for servers eligible but not yet analytics-enabled - Add lazy-loaded TrafficOverview widget to application General page - Default-enable traffic analytics on new eligible server settings - Rotate Caddy access logs via lumberjack roll options - Add Traefik logrotate sidecar for copytruncate access-log rotation
26 lines
1.5 KiB
PHP
26 lines
1.5 KiB
PHP
<?php
|
|
|
|
it('adds no traffic labels to caddy sites when disabled', function () {
|
|
$labels = fqdnLabelsForCaddy('coolify', 'app-uuid', collect(['https://example.com']), is_traffic_analytics_enabled: false);
|
|
expect($labels->filter(fn ($l) => str_contains($l, 'log_append'))->isEmpty())->toBeTrue();
|
|
});
|
|
|
|
it('stamps coolify_app_id and JSON access log on each caddy site when enabled', function () {
|
|
$labels = fqdnLabelsForCaddy('coolify', 'app-uuid', collect(['https://example.com']), is_traffic_analytics_enabled: true);
|
|
expect($labels->contains('caddy_0.log_append=coolify_app_id app-uuid'))->toBeTrue();
|
|
expect($labels->contains('caddy_0.log.output=file /traffic/access.log'))->toBeTrue();
|
|
expect($labels->contains('caddy_0.log.format=json'))->toBeTrue();
|
|
});
|
|
|
|
it('emits lumberjack roll directives on each caddy site when enabled', function () {
|
|
$labels = fqdnLabelsForCaddy('coolify', 'app-uuid', collect(['https://example.com']), is_traffic_analytics_enabled: true);
|
|
expect($labels->contains('caddy_0.log.output.roll_size=20MiB'))->toBeTrue();
|
|
expect($labels->contains('caddy_0.log.output.roll_keep=5'))->toBeTrue();
|
|
expect($labels->contains('caddy_0.log.output.roll_keep_for=168h'))->toBeTrue();
|
|
});
|
|
|
|
it('omits lumberjack roll directives when disabled', function () {
|
|
$labels = fqdnLabelsForCaddy('coolify', 'app-uuid', collect(['https://example.com']), is_traffic_analytics_enabled: false);
|
|
expect($labels->filter(fn ($l) => str_contains($l, 'roll_'))->isEmpty())->toBeTrue();
|
|
});
|