Skip to content

Conversation

@zakkg3
Copy link

@zakkg3 zakkg3 commented Sep 16, 2025

Problem

The chart currently uses hardcoded service names in the default database
URLs:

  • plausible-analytics-postgresql:5432
  • plausible-analytics-clickhouse:8123

This causes connection failures in multi-release deployments where the
actual service names include the release name (e.g.,
my-release-plausible-analytics-postgresql).

Solution

This PR introduces dynamic service name generation using Helm template
functions:

New helper templates:

  • plausible-analytics.postgresql.serviceName - Generates correct
    PostgreSQL service name
  • plausible-analytics.clickhouse.serviceName - Generates correct
    ClickHouse service name
  • plausible-analytics.postgresql.defaultURL - Auto-generates PostgreSQL
    connection URL
  • plausible-analytics.clickhouse.defaultURL - Auto-generates ClickHouse
    connection URL

Configuration changes:

  • Database URLs are now auto-generated when left empty in values.yaml
  • Added support for external database services via externalServiceName
    configuration
  • Maintains full backward compatibility with explicitly configured URLs

Example

Before (hardcoded):
postgres://postgres:postgres@plausible-analytics-postgresql:5432/plausible
_db

After (dynamic):
postgres://postgres:postgres@my-release-plausible-analytics-postgresql:543
2/plausible_db

Testing

  • Verified chart renders without errors via helm template
  • Confirmed generated URLs use correct release-specific service names
  • Validated backward compatibility with existing configurations

Breaking Changes

None - this change is fully backward compatible.


Files changed:

  • templates/_helpers.tpl - Added helper functions for service name
    generation
  • templates/secret.yaml - Updated to use helper functions when URLs not
    provided
  • values.yaml - Removed hardcoded URLs and added external service support

Fixes connection issues in multi-release environments and improves chart
flexibility for various deployment scenarios.

- replace hardcoded service names with dynamic Helm template functions
- add helper templates for PostgreSQL and ClickHouse service name generation
- support external database services via externalServiceName config
- automatically generate database URLs when not explicitly provided
- maintain backward compatibility with existing configurations

fixes issue where database URLs used static service names instead of
release-specific names, causing connection failures in multi-release deployments
@zakkg3
Copy link
Author

zakkg3 commented Sep 16, 2025

Fixes #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant