Files
o11y-foundry/internal/casting/railwaytemplatecasting/templates/Dockerfile.clickhousekeeper.telemetrykeeper.v2556.gotmpl
NageshbansalandGitHub cf97bf1d0c feat(casting): adds railwaytemplate casting (#70)
#### Features

- adds railwaytemplate casting
- fix merge spec and status
- allows to override moldings configuration

Related: https://github.com/SigNoz/platform-pod/issues/1777
2026-03-18 01:38:05 +05:30

30 lines
984 B
Go Template

FROM {{ $.Spec.TelemetryKeeper.Spec.Image }}
# Copy all keeper config files
COPY keeper.d/ /etc/clickhouse-keeper/
{{- range $key, $value := $.Spec.TelemetryKeeper.Spec.Env }}
ENV {{ $key }}={{ $value }}
{{- end }}
# Create entrypoint script to dynamically select config based on replica index
RUN cat > /entrypoint.sh <<'EOF'
#!/bin/bash
set -euo pipefail
# Extract replica index from service name, default to 0
REPLICA_INDEX=$(echo "${RAILWAY_SERVICE_NAME:-}" | grep -oE "[0-9]+$" || echo "0")
CONFIG_FILE="/etc/clickhouse-keeper/keeper-${REPLICA_INDEX}.yaml"
# Fallback to keeper-0.yaml if replica-specific config doesn't exist
if [ ! -f "$CONFIG_FILE" ]; then
echo "Config $CONFIG_FILE not found, falling back to keeper-0.yaml"
CONFIG_FILE="/etc/clickhouse-keeper/keeper-0.yaml"
fi
echo "Starting ClickHouse Keeper with config: $CONFIG_FILE"
exec /usr/bin/clickhouse-keeper --config-file="$CONFIG_FILE" "$@"
EOF
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]