diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/deployment.yaml index 628cda58d..60d903e42 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/deployment.yaml @@ -55,9 +55,11 @@ spec: value: '{{ $val }}' {{- end}} ports: - - name: http - containerPort: {{ .Values.service.port }} + {{- range $key, $val := .Values.service.ports }} + - name: {{ $key }} + containerPort: {{ $val }} protocol: TCP + {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/service.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/service.yaml index c9afad7d5..9ec9f18cf 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/service.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/service.yaml @@ -7,9 +7,11 @@ metadata: spec: type: {{ .Values.service.type }} ports: - - port: {{ .Values.service.port }} - targetPort: http + {{- range $key, $val := .Values.service.ports }} + - port: {{ $val }} + targetPort: {{ $key }} protocol: TCP - name: http + name: {{ $key }} + {{- end}} selector: {{- include "utilities.selectorLabels" . | nindent 4 }} diff --git a/scripts/helmcharts/openreplay/charts/utilities/values.yaml b/scripts/helmcharts/openreplay/charts/utilities/values.yaml index 9894c6aca..36759f6cb 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/values.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/values.yaml @@ -36,11 +36,15 @@ securityContext: {} # runAsNonRoot: true # runAsUser: 1000 +#service: +# type: ClusterIP +# port: 9000 + service: type: ClusterIP ports: - - port: 9000 - - port: 9001 + peerjs: 9000 + socketio: 9001 ingress: enabled: false diff --git a/utilities/server.js b/utilities/server.js index 7e0460dd2..89d67d5a3 100644 --- a/utilities/server.js +++ b/utilities/server.js @@ -9,16 +9,18 @@ const PORT = 9000; var app = express(); var wsapp = express(); -const request_logger = (req, res, next) => { - console.log(new Date().toTimeString(), 'REQUEST', req.method, req.originalUrl); - res.on('finish', function () { - console.log(new Date().toTimeString(), 'RESPONSE', req.method, req.originalUrl, this.statusCode); - }) +const request_logger = (identity) => { + return (req, res, next) => { + console.log(identity,new Date().toTimeString(), 'REQUEST', req.method, req.originalUrl); + res.on('finish', function () { + console.log(new Date().toTimeString(), 'RESPONSE', req.method, req.originalUrl, this.statusCode); + }) - next(); + next(); + } }; -app.use(request_logger); -wsapp.use(request_logger); +app.use(request_logger("[app]")); +wsapp.use(request_logger("[wsapp]")); app.use('/sourcemaps', sourcemapsReaderServer); app.use('/assist', peerRouter); @@ -28,7 +30,7 @@ const server = app.listen(PORT, HOST, () => { console.log(`App listening on http://${HOST}:${PORT}`); console.log('Press Ctrl+C to quit.'); }); -const wsserver = app.listen(PORT + 1, HOST, () => { +const wsserver = wsapp.listen(PORT + 1, HOST, () => { console.log(`WS App listening on http://${HOST}:${PORT + 1}`); console.log('Press Ctrl+C to quit.'); }); diff --git a/utilities/servers/websocket.js b/utilities/servers/websocket.js index ffe28efaa..5057d5d9f 100644 --- a/utilities/servers/websocket.js +++ b/utilities/servers/websocket.js @@ -39,7 +39,7 @@ module.exports = { origin: "*", methods: ["GET", "POST", "PUT"] }, - // path: '/socket' + path: '/socket' }); io.on('connection', (socket) => {