# tetcore-analytics # deployment.template.yml # # use: # envsubst < deployment.template.yml | kubectl apply -f - # # the following variables have to be set: # # TETCORE_ANALYTICS_DB_URL postgres://username:password@localhost/save # WS_PORT can be 1024 # REPLICAS # TETCORE_ANALYTICS_DOCKER_IMAGE # # Optional variables: # # HEARTBEAT_INTERVAL # CLIENT_TIMEOUT_S # PURGE_INTERVAL_S # LOG_EXPIRY_H # MAX_PENDING_CONNECTIONS # WS_MAX_PAYLOAD # DB_POOL_SIZE # DB_BATCH_SIZE # DB_SAVE_LATENCY_MS # CACHE_UPDATE_TIMEOUT_S # CACHE_UPDATE_INTERVAL_MS # CACHE_EXPIRY_S # --- apiVersion: apps/v1 kind: Deployment metadata: name: tetcore-analytics namespace: $NAMESPACE spec: selector: matchLabels: app: tetcore-analytics replicas: $REPLICAS revisionHistoryLimit: 2 minReadySeconds: 3 strategy: rollingUpdate: maxUnavailable: 0 maxSurge: 1 template: metadata: labels: app: tetcore-analytics spec: containers: - name: tetcore-analytics image: $TETCORE_ANALYTICS_DOCKER_IMAGE imagePullPolicy: Always ports: - containerPort: $WS_PORT env: - name: DATABASE_URL value: "$TETCORE_ANALYTICS_DB_URL" envFrom: - configMapRef: name: tetcore-analytics readinessProbe: tcpSocket: port: $WS_PORT initialDelaySeconds: 5 periodSeconds: 10 livenessProbe: tcpSocket: port: $WS_PORT initialDelaySeconds: 15 periodSeconds: 20 --- apiVersion: v1 kind: ConfigMap metadata: name: tetcore-analytics namespace: $NAMESPACE data: PORT: "$WS_PORT" HEARTBEAT_INTERVAL: "$HEARTBEAT_INTERVAL" CLIENT_TIMEOUT_S: "$CLIENT_TIMEOUT_S" PURGE_INTERVAL_S: "$PURGE_INTERVAL_S" MAX_PENDING_CONNECTIONS: "$MAX_PENDING_CONNECTIONS" LOG_EXPIRY_H: "$ANALYTICS_LOG_EXPIRY_H" RUST_LOG: "$ANALYTICS_RUST_LOG" WS_MAX_PAYLOAD: "$WS_MAX_PAYLOAD" DB_POOL_SIZE: "$DB_POOL_SIZE" DB_BATCH_SIZE: "$DB_BATCH_SIZE" DB_SAVE_LATENCY_MS: "$DB_SAVE_LATENCY_MS" CACHE_UPDATE_TIMEOUT_S: "$CACHE_UPDATE_TIMEOUT_S" CACHE_UPDATE_INTERVAL_MS: "$CACHE_UPDATE_INTERVAL_MS" CACHE_EXPIRY_S: "$CACHE_EXPIRY_S" ASSETS_PATH: "$ASSETS_PATH" --- apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: tetcore-analytics namespace: $NAMESPACE spec: selector: matchLabels: app: tetcore-analytics endpoints: - port: ws interval: 30s --- apiVersion: v1 kind: Service metadata: name: tetcore-analytics namespace: $NAMESPACE spec: selector: app: tetcore-analytics ports: - name: ws port: $WS_PORT targetPort: $WS_PORT protocol: TCP sessionAffinity: None type: LoadBalancer loadBalancerSourceRanges: - 35.198.174.150/32 # test-machine - 212.227.252.235/32 # vpn-server - 35.246.224.91/32 # tetcore20-0 - 35.246.210.11/32 # tetcore20-1 - 35.198.110.45/32 # tetcore20-2 - 35.198.114.154/32 # tetcore20-3 - 51.77.66.187/32 # kusama-bootnode-0 - 51.79.17.206/32 # kusama-bootnode-1 - 104.155.57.65/32 # matt-node1 (custom build/metrics) - 35.242.161.55/32 # matt-node2 - 148.0.0.0/8