This document provides comprehensive guidance for configuring the NTP Pool Project across all deployment environments and components.
The NTP Pool Project uses a multi-layered configuration system that combines:
- Environment variables for core application settings
- Kubernetes Helm charts for service deployment configuration
- HashiCorp Vault for secrets management
- Deployment-specific overrides for different environments (development, test, production)
The core configuration is managed by the Go config package (../go/ntp/common/config/) which loads settings from environment variables.
# Deployment environment (devel, test, prod)
deployment_mode=prod
# Web interface hostnames (comma-separated, first is primary)
web_hostname=www.ntppool.org,api.ntppool.org,www.pool.ntp.org
# Management interface hostname
manage_hostname=manage.ntppool.org
# TLS settings for web and management interfaces
web_tls=yes # Enable HTTPS for web (yes/no/true/false)
manage_tls=yes # Enable HTTPS for management (yes/no/true/false)# Database connection
db_dsn=dbi:mysql:database=ntppool;host=ntp-db-mysql-master.ntpdb;mysql_enable_utf8=1
db_user=ntppool
# Email configuration
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
# Pool domain and static assets
pool_domain=pool.ntp.org
static_base=/static/
www_cname=www-lb.ntppool.org.# Auth0 integration
auth0_client=kDlOYWYyIQlLMjgyzrKJhQmARaM8rOaM
auth0_domain=login.ntppool.org# HTTP server settings
httpd_maxclients=10
# Proxy/CDN configuration
proxyip_configmap=fastly-ipsThe system supports three deployment environments with automatic API endpoint resolution:
- API Host:
https://dev-api.ntppool.dev - Management URL:
https://manage.askdev.grundclock.com - Monitor Domain:
devel.mon.ntppool.dev - Monitor API:
https://api.devel.mon.ntppool.dev
- API Host:
https://beta-api.ntppool.dev - Management URL:
https://manage.beta.grundclock.com - Monitor Domain:
test.mon.ntppool.dev - Monitor API:
https://api.test.mon.ntppool.dev
- API Host:
https://api.ntppool.dev - Management URL:
https://manage.ntppool.org - Monitor Domain:
mon.ntppool.dev - Monitor API:
https://api.mon.ntppool.dev
# Override default API host for any environment
API_HOST=https://custom-api.example.comThe NTP Pool services are deployed using Helm charts with environment-specific value files.
- Main Chart:
ntppool-charts/pub/charts/ntppool/ - Values Files: Environment-specific configurations in
ntppool-k8s/prod/prod-values.yaml- Production configurationdevel/dev-values-*.yaml- Development configurationsbeta/beta-values.yaml- Beta/test configuration
config:
deployment_mode: "prod"
web_hostname: "www.ntppool.org,api.ntppool.org,www.pool.ntp.org"
manage_hostname: "manage.ntppool.org"
web_tls: "yes"
manage_tls: "yes"
db_dsn: "dbi:mysql:database=ntppool;host=ntp-db-mysql-master.ntpdb;mysql_enable_utf8=1"
db_user: "ntppool"
# ... additional config options
replicaCount: 12 # Production scale
resources:
limits:
cpu: 1
memory: 1500Mi
requests:
cpu: 200m
memory: 300MiGeoIP Service
geoip:
enabled: true
replicaCount: 2
# Vault integration for MaxMind license
annotations:
vault.hashicorp.com/agent-inject-secret-config: "kv/ntppool/geoip/config"SMTP Service
smtp:
replicaCount: 2
config:
RELAY_NETWORKS: ":10.2.0.0/16:10.3.0.0/16:10.42.0.0/16"
SMARTHOST_ADDRESS: "smtp.sparkpostmail.com"
SMARTHOST_PORT: "587"
SMARTHOST_USER: "SMTP_Injection"Screensnap Service
screensnap:
enabled: true
replicaCount: 2
upstream_base: https://www.ntppool.orgjobs:
combust-cleanup:
enabled: true
schedule: "12 * * * *"
db-cleanup:
enabled: true
schedule: "17 * * * *"
server-notifications:
enabled: true
schedule: "*/10 * * * *"
zone-stats:
enabled: true
schedule: "57 */4 * * *"ingress:
enabled: true
class: haproxy
types:
- web
- manage
- data-api
annotations:
haproxy-ingress.github.io/hsts-max-age: "63072000"
haproxy-ingress.github.io/hsts-include-subdomains: "true"
haproxy-ingress.github.io/maxconn-server: "1"The NTP Pool Project uses HashiCorp Vault for comprehensive secrets management with automatic secret injection into Kubernetes pods.
All production services use Vault Agent for automatic secret injection:
podAnnotations:
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/agent-inject-token: "true"
vault.hashicorp.com/agent-cache-enable: "true"
vault.hashicorp.com/role: "ntppool-prod"
vault.hashicorp.com/ca-cert: "/vault/tls/ca.crt"
vault.hashicorp.com/tls-secret: "vault-kube-ca"Production:
vault.hashicorp.com/agent-inject-secret-database: "/database/creds/ntpdb-prod"
vault.hashicorp.com/agent-inject-template-database: |
{{- with secret "database/creds/ntpdb-prod" -}}
{{ .Data | toUnescapedJSON }}
{{- end }}Development:
vault.hashicorp.com/agent-inject-secret-database: "/database/creds/ntp-askntp"- Path:
/database/creds/{environment-role} - Type: Dynamic credentials with automatic rotation
- Access: JSON file at
/vault/secrets/database.jsonin containers - Usage: Application reads from
db_auth_fileconfig pointing to Vault-injected file
secrets:
# Authentication tokens
auth0_secret: "Base64-encoded-auth0-secret"
account_id_key: "Random string for account IDs"
vendor_zone_id_key: "Random string for vendor zones"
# Database (legacy/fallback)
db_pass: "__file__" # Points to Vault-injected file
db_auth_file: "/vault/secrets/database.json"
# SMTP credentials
smtp_pass: "SMTP service password"GeoIP Configuration (MaxMind)
vault.hashicorp.com/agent-inject-secret-config: "kv/ntppool/geoip/config"
vault.hashicorp.com/agent-inject-template-config: |
{{ with secret "kv/ntppool/geoip/config" -}}
export GEOIPUPDATE_ACCOUNT_ID="{{ .Data.data.account_id }}"
export GEOIPUPDATE_LICENSE_KEY="{{ .Data.data.license_key }}"
{{- end }}SMTP Service Configuration
config:
SMARTHOST_PASSWORD: "145c21af7b4bd672de3c9119fc2ab08c88f99796" # SparkPost API keyvault.hashicorp.com/agent-inject-secret-vault-ca: "/pki_root/cert/ca"
vault.hashicorp.com/agent-inject-template-vault-ca: |
{{- with secret "pki_root/cert/ca" -}}
{{ .Data.certificate }}
{{- end }}- Production:
ntppool-prod - Development:
ntppool-dev - GeoIP Services:
ntppool-geoip
# Token settings
token_ttl=168h # 7 days
token_max_ttl=168h # Maximum 7 days
period=96h # Must check-in every 4 days
token_num_uses=200 # Token usage limit
# Secret ID settings
secret_id_ttl=26280h # 3 years
secret_id_num_uses=500 # Usage limit
# Policies
policies=monitor-{environment}The NTP Pool uses a custom AppRole-based authentication system for monitoring services:
- Vault API:
https://vault-active.ntpvault.svc:8200/v1 - Authentication: Token-based with TLS client certificates
- Role Management: Automatic creation/deletion of monitoring roles
- Secret Management: Key-value store for monitoring configuration
- Development:
devel.mon.ntppool.dev - Test:
test.mon.ntppool.dev - Production:
mon.ntppool.dev
# Development values (dev-values-ewr1.yaml)
config:
deployment_mode: devel
manage_hostname: manage.askdev.grundclock.com
web_hostname: web.askdev.grundclock.com
pool_domain: askdev.grundclock.com
db_dsn: dbi:mysql:database=askntp;host=ntpdb-haproxy.ntpdb.svc.cluster.local
db_user: askntp
# Resource allocation
replicaCount: 1
resources:
limits:
cpu: 2
memory: 1500Mi
requests:
cpu: 10m
memory: 400Mi
# External secret reference
secrets:
existingSecret: "ntppool-secrets"# Beta values (beta-values.yaml)
config:
deployment_mode: beta
manage_hostname: manage.ntp.test
web_hostname: web.ntp.test,graphs.ntp.test
pool_domain: beta.grundclock.com
manage_tls: "no" # Development uses HTTP
web_tls: "no"# Production values (prod-values.yaml)
config:
deployment_mode: prod
manage_hostname: manage.ntppool.org
web_hostname: www.ntppool.org,api.ntppool.org,www.pool.ntp.org
pool_domain: pool.ntp.org
manage_tls: "yes"
web_tls: "yes"
# High availability configuration
replicaCount: 12
resources:
limits:
cpu: 1
memory: 1500Mi
requests:
cpu: 200m
memory: 300Mi
# Full Vault integration
podAnnotations:
vault.hashicorp.com/role: "ntppool-prod"
instrumentation.opentelemetry.io/inject-sdk: "true"config:
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector:4318"
OTEL_BSP_MAX_EXPORT_BATCH_SIZE: "10"
OTEL_SERVICE_NAME: "ntppool-web"
OTEL_TRACES_EXPORTER: "otlp"
OTEL_ATTRIBUTE_COUNT_LIMIT: "256"
podAnnotations:
instrumentation.opentelemetry.io/inject-sdk: "true"- Never commit secrets to repositories - Use Vault for all sensitive data
- Rotate database credentials - Use Vault dynamic secrets for automatic rotation
- Limit secret access - Use environment-specific Vault roles and policies
- Monitor secret usage - Vault provides audit logs for all secret access
- Always use TLS in production - Set
web_tls=yesandmanage_tls=yes - HSTS headers - Configured in ingress annotations for enhanced security
- Certificate management - Automated via cert-manager and Let's Encrypt
- Ingress restrictions - Use HAProxy ingress with connection limits
- Internal service communication - Services communicate via cluster-internal DNS
- Firewall rules - Network policies restrict inter-pod communication
- OAuth2/OIDC - Auth0 integration for user authentication
- API tokens - Separate keys for different service integrations
- Service accounts - Kubernetes RBAC for pod-level permissions
# Environment variables for local development
export deployment_mode=devel
export web_hostname=localhost:8000
export manage_hostname=localhost:8001
export web_tls=no
export manage_tls=no
export db_dsn="dbi:mysql:database=ntpdev;host=localhost"
export db_user=ntpdev
export pool_domain=dev.pool.ntp.org# docker-compose.yml environment section
environment:
- deployment_mode=devel
- web_hostname=web.docker.local
- manage_hostname=manage.docker.local
- web_tls=no
- manage_tls=no
- db_dsn=dbi:mysql:database=ntppool;host=mysql
- db_user=ntppool
- pool_domain=docker.pool.ntp.org# Deploy production configuration
helm install ntppool ntppool-charts/pub/charts/ntppool/ \
-f ntppool-k8s/prod/prod-values.yaml \
--namespace ntppool-prod
# Verify Vault integration
kubectl logs -n ntppool-prod deployment/ntppool -c vault-agent
# Check configuration
kubectl get configmap -n ntppool-prod ntppool-config -o yaml# Check Vault agent logs
kubectl logs -n ntppool-prod deployment/ntppool -c vault-agent
# Verify TLS configuration
kubectl get secret -n ntppool-prod vault-kube-ca
# Test Vault connectivity
kubectl exec -it deployment/ntppool -- curl -k https://vault-active.ntpvault.svc:8200/v1/sys/health# Check database credentials
kubectl exec -it deployment/ntppool -- cat /vault/secrets/database.json
# Verify database connectivity
kubectl exec -it deployment/ntppool -- mysql -h ntp-db-mysql-master.ntpdb -u ntppool -p# Validate Helm chart values
helm lint ntppool-charts/pub/charts/ntppool/ -f prod-values.yaml
# Test configuration rendering
helm template ntppool ntppool-charts/pub/charts/ntppool/ -f prod-values.yaml
# Check running configuration
kubectl exec -it deployment/ntppool -- env | grep -E "(deployment_mode|hostname|tls)"# Perl code to debug configuration (in application)
use NP::IntAPI;
my $config = Combust::Config->new;
warn "Deployment mode: " . $config->site->{ntppool}->{deployment_mode};
warn "Web hostname: " . $config->site->{ntppool}->{web_hostname};-
deployment_mode- Set todevel,test, orprod -
web_hostname- Primary web interface hostname(s) -
manage_hostname- Management interface hostname -
web_tls/manage_tls- TLS configuration -
db_dsn- Database connection string -
db_user- Database username - Email settings (
email_*variables) -
pool_domain- NTP pool domain name
- Database credentials (
db_passor Vault dynamic secrets) - Auth0 secret (
auth0_secret) - Account ID key (
account_id_key) - Vendor zone ID key (
vendor_zone_id_key) - SMTP password (
smtp_pass)
- Vault integration configured with proper roles
- TLS enabled for all external interfaces
- Resource limits appropriate for load
- Monitoring and alerting configured
- Backup and disaster recovery tested
- Security scanning completed
- Performance testing validated
For additional support, contact [email protected] or refer to the project documentation at https://dev.ntppool.org/