Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions chat-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ FROM node:18-alpine as main
# Bundle the app's source code inside the Docker image.
COPY --from=build /app /

# Expose port 8003 so it can be mapped by Docker daemon.
EXPOSE 8003
# Expose port 5003 so it can be mapped by Docker daemon.
EXPOSE 5003

# Define the command to run your app using CMD which defines your runtime.
CMD [ "node", "index.js" ]
23 changes: 14 additions & 9 deletions chat-service/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
require('dotenv').config();
const express = require('express');
const cors = require("cors");
const cors = require('cors');
const app = express();
const http = require('http');

const allowedOrigins = [
'http://localhost:3000',
'http://localhost:8000',
'http://localhost:8001',
'http://localhost:8002',
'http://localhost:8006',
'http://localhost:5000',
'http://localhost:5001',
'http://localhost:5002',
'http://localhost:5003',
'http://localhost:5004',
'http://localhost:5005',
'http://localhost:5006',
'http://localhost:5007',
// node ip
'http://34.123.40.181:30800',
'http://34.123.40.181:30700',
Expand All @@ -29,11 +33,12 @@ const corsOptions = {
origin: function (origin, callback) {
if (!origin) return callback(null, true);
if (allowedOrigins.indexOf(origin) === -1) {
const msg = 'The CORS policy for this site does not allow access from the specified Origin.';
const msg =
'The CORS policy for this site does not allow access from the specified Origin.';
return callback(new Error(msg), false);
}
return callback(null, true);
}
},
};

app.use(cors(corsOptions));
Expand All @@ -44,8 +49,8 @@ const firebaseConfigRoute = require('./routes/firebaseConfig-route');
app.use('/', firebaseConfigRoute);

const server = http.createServer(app); // Create an HTTP server
const port = process.env.PORT || 8003;
const port = process.env.PORT || 5003;

server.listen(port, () => {
console.log(`web socket server is running on port ${port}`);
});
});
4 changes: 2 additions & 2 deletions chat-service/k8/chat-service-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ secrets:

service:
type: NodePort
port: 8003
targetPort: 8003
port: 5003
targetPort: 5003
nodePort: 30000
2 changes: 1 addition & 1 deletion chat-service/k8/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
# image: imrajsingh/chat-service-image
ports:
- containerPort: 8003
- containerPort: 5003
env:
- name: FIREBASE_API_KEY
value: "{{ .Values.secrets.firebase_keys.firebaseApiKey }}"
Expand Down
4 changes: 2 additions & 2 deletions chat-service/k8/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ metadata:
spec:
type: NodePort
ports:
- port: 8003
targetPort: 8003
- port: 5003
targetPort: 5003
nodePort: 30000
selector:
app: chat-service
5 changes: 3 additions & 2 deletions chat-service/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "chat-service",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand All @@ -16,5 +15,7 @@
"firebase": "^10.4.0",
"jsonwebtoken": "^9.0.2",
"nodemon": "^3.0.1"
}
},
"keywords": [],
"description": ""
}
4 changes: 2 additions & 2 deletions collaboration-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ FROM node:18-alpine as main
# Bundle the app's source code inside the Docker image.
COPY --from=build /app /

# Expose port 8004 so it can be mapped by Docker daemon.
EXPOSE 8004
# Expose port 5004 so it can be mapped by Docker daemon.
EXPOSE 5004

# Define the command to run your app using CMD which defines your runtime.
CMD [ "npm", "start" ]
Loading