Skip to content

Commit

Permalink
feat(preview-service): allow metrics port to be configured (#2421)
Browse files Browse the repository at this point in the history
* feat(preview-service): allow metrics port to be configured

* Allow configurable port
  • Loading branch information
iainsproat authored Jun 21, 2024
1 parent d019e32 commit 2e59d23
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/preview-service/bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function onError(error) {

function onListening() {
const addr = server.address()
const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port
const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr?.port
serverLogger.info('Listening on ' + bind)

startPreviewService()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:

ports:
- name: metrics
containerPort: 9094
containerPort: {{ .Values.preview_service.monitoring.metricsPort }}
protocol: TCP

livenessProbe:
Expand Down Expand Up @@ -62,6 +62,12 @@ spec:
{{- end }}

env:
- name: PORT
value: {{ .Values.preview_service.port | quote }}

- name: PROMETHEUS_METRICS_PORT
value: {{ .Values.preview_service.monitoring.metricsPort | quote }}

- name: PG_CONNECTION_STRING
valueFrom:
secretKeyRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ spec:
ports:
- protocol: TCP
name: web
port: 9094
port: {{ .Values.preview_service.monitoring.metricsPort }}
targetPort: metrics
15 changes: 15 additions & 0 deletions utils/helm/speckle-server/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,21 @@
"description": "The Docker image to be used for the Speckle Preview Service component. If blank, defaults to speckle/speckle-preview-service:{{ .Values.docker_image_tag }}. If provided, this value should be the full path including tag. The docker_image_tag value will be ignored.",
"default": ""
},
"port": {
"type": "string",
"description": "The port on which the Preview Service will run. This is not exposed, but used within its own local network within the pod.",
"default": "3001"
},
"monitoring": {
"type": "object",
"properties": {
"metricsPort": {
"type": "string",
"description": "The port on which the metrics server will be exposed.",
"default": "9094"
}
}
},
"requests": {
"type": "object",
"properties": {
Expand Down
7 changes: 7 additions & 0 deletions utils/helm/speckle-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,13 @@ preview_service:
##
image: ''

## @param preview_service.port The port on which the Preview Service will run. This is not exposed, but used within its own local network within the pod.
port: '3001'

monitoring:
## @param preview_service.monitoring.metricsPort The port on which the metrics server will be exposed.
metricsPort: '9094'

requests:
## @param preview_service.requests.cpu The CPU that should be available on a node when scheduling this pod.
## ref: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down

0 comments on commit 2e59d23

Please sign in to comment.