feat(utilities): fixed socketio port

feat(utilities): set socketio path to /socket
feat(helm): expose an 2 ports for utilities
This commit is contained in:
Taha Yassine Kraiem 2022-01-20 18:22:28 +01:00
parent fc77eb8af9
commit 01a51515a9
5 changed files with 27 additions and 17 deletions

View file

@ -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 }}

View file

@ -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 }}

View file

@ -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

View file

@ -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.');
});

View file

@ -39,7 +39,7 @@ module.exports = {
origin: "*",
methods: ["GET", "POST", "PUT"]
},
// path: '/socket'
path: '/socket'
});
io.on('connection', (socket) => {