mirror of
https://github.com/coollabsio/coolify.git
synced 2026-10-09 07:26:09 -04:00
Caddy 2.7.6, shipped in the caddy-docker-proxy 2.8 image, rejects the whole Caddyfile when it contains log_append. Add Server::caddySupportsLogAppend(), which reads the image from the applied proxy configuration. Traffic analytics labels now add log_append only when the server runs 2.9 or newer and has no pending proxy change. - Change the default Caddy proxy image from 2.8-alpine to 2.13-alpine - ProxyPortParser now validates Docker Compose port ranges and random host ports. It returns only fixed host ports for the availability check and has a clearer validation message - After mkdir, chown only root-owned files and remove other-user access from the top directory only. Files owned by container users and the modes of mounted files no longer change - Add tests for log_append support and the new parser/sudo behaviour - Note in the lessons file that tests must flush the Server identity map between dataset cases
34 lines
2.1 KiB
PHP
34 lines
2.1 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, supports_log_append: 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('keeps the JSON access log but omits log_append when caddy does not support it', function () {
|
|
// caddy-docker-proxy 2.8 runs Caddy 2.7.6, which rejects the whole Caddyfile for log_append.
|
|
$labels = fqdnLabelsForCaddy('coolify', 'app-uuid', collect(['https://example.com']), is_traffic_analytics_enabled: true);
|
|
expect($labels->filter(fn ($l) => str_contains($l, 'log_append'))->isEmpty())->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();
|
|
});
|