feat(utilities): 2 servers for peerjs and socketio
feat(nginx): new route for socketio feat(helm): expose an extra port for utilities
This commit is contained in:
parent
71da892d77
commit
fc77eb8af9
4 changed files with 27 additions and 8 deletions
|
|
@ -74,6 +74,15 @@ data:
|
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://utilities-openreplay.app.svc.cluster.local:9000;
|
||||
}
|
||||
location /ws-assist/ {
|
||||
rewrite ^/ws-assist/(.*) /$1 break;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://utilities-openreplay.app.svc.cluster.local:9001;
|
||||
}
|
||||
location /assets/ {
|
||||
rewrite ^/assets/(.*) /sessions-assets/$1 break;
|
||||
proxy_http_version 1.1;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ securityContext: {}
|
|||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 9000
|
||||
ports:
|
||||
- port: 9000
|
||||
- port: 9001
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
|
|
|
|||
|
|
@ -8,23 +8,30 @@ const HOST = '0.0.0.0';
|
|||
const PORT = 9000;
|
||||
|
||||
var app = express();
|
||||
app.use((req, res, next) => {
|
||||
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);
|
||||
})
|
||||
|
||||
next();
|
||||
});
|
||||
};
|
||||
app.use(request_logger);
|
||||
wsapp.use(request_logger);
|
||||
|
||||
app.use('/sourcemaps', sourcemapsReaderServer);
|
||||
// app.use('/assist', peerRouter);
|
||||
// app.use('/assist/', socket.wsRouter);
|
||||
app.use('/assist', peerRouter);
|
||||
wsapp.use('/assist', socket.wsRouter);
|
||||
|
||||
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, () => {
|
||||
console.log(`WS App listening on http://${HOST}:${PORT + 1}`);
|
||||
console.log('Press Ctrl+C to quit.');
|
||||
});
|
||||
const peerServer = ExpressPeerServer(server, {
|
||||
debug: true,
|
||||
path: '/',
|
||||
|
|
@ -36,5 +43,6 @@ peerServer.on('disconnect', peerDisconnect);
|
|||
peerServer.on('error', peerError);
|
||||
app.use('/', peerServer);
|
||||
app.enable('trust proxy');
|
||||
socket.start(server);
|
||||
module.exports = server;
|
||||
wsapp.enable('trust proxy');
|
||||
socket.start(wsserver);
|
||||
module.exports = {wsserver, server};
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ module.exports = {
|
|||
origin: "*",
|
||||
methods: ["GET", "POST", "PUT"]
|
||||
},
|
||||
path: '/socket'
|
||||
// path: '/socket'
|
||||
});
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue