Skip to content

Commit 79c366d

Browse files
committed
Prepare files for deployment
1 parent b78f706 commit 79c366d

File tree

18 files changed

+331
-24
lines changed

18 files changed

+331
-24
lines changed

Backend/CollabService/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20
1+
FROM node:18-alpine
22

33
WORKDIR /app
44

Backend/CollabService/websocket/collabSocket.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function setUpYjsSocket() {
1919
});
2020

2121
server.listen(1234, () => {
22-
console.log('Websocket server is listening on ws://localhost:1234')
22+
console.log('Websocket server is listening on ws://external-ip:1234')
2323
})
2424
}
2525

Backend/HistoryService/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20
1+
FROM node:18-alpine
22

33
WORKDIR /app
44

Backend/MatchingService/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20
1+
FROM node:18-alpine
22

33
WORKDIR /app
44

Backend/MatchingService/rabbitmq/setup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const dead_letter_queue_name = "dead_letter_queue";
88
const difficulties = ["easy", "medium", "hard", "any"];
99
const axios = require('axios');
1010
// Matching Service code
11-
const questionServiceHost = process.env.QUESTION_SERVICE_HOST || 'localhost';
12-
const categoryAPIUrl = `http://${questionServiceHost}:3001/api/categories`;
11+
// const questionServiceHost = process.env.QUESTION_SERVICE_HOST || 'localhost';
12+
const categoryAPIUrl = `http://34.120.84.41/api/categories`;
1313

1414
let queueNamesPromise = axios.get(categoryAPIUrl)
1515
.then(response => {

Backend/MatchingService/rabbitmq/subscriber.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const { v4: uuidv4 } = require('uuid');
66
// matchingService/fetchQuestion.js
77
const axios = require('axios');
88
// Matching Service code
9-
const questionServiceHost = process.env.QUESTION_SERVICE_HOST || 'localhost';
10-
const questionAPIUrl = `http://${questionServiceHost}:3001/api/questions`;
9+
// const questionServiceHost = process.env.QUESTION_SERVICE_HOST || 'localhost';
10+
const questionAPIUrl = `http://34.120.84.41/api/questions`;
1111

1212

1313
// TODO: Subscribe and acknowledge messages with user info when timeout/user matched

Backend/QuestionService/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20
1+
FROM node:18-alpine
22

33
WORKDIR /app
44

Backend/user-service/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20
1+
FROM node:18-alpine
22

33
WORKDIR /app
44

@@ -7,5 +7,5 @@ RUN npm install
77

88
COPY . .
99

10-
EXPOSE 8080
10+
EXPOSE 3002
1111
CMD ["npm", "start"]

Backend/user-service/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ await connectToDB().then(() => {
1111
console.log("MongoDB Connected!");
1212

1313
server.listen(port);
14-
console.log("User service server listening on http://localhost:" + port);
14+
console.log("User service server listening on http://external-ip:" + port);
1515
}).catch((err) => {
1616
console.error("Failed to connect to DB");
1717
console.error(err);

Frontend/Dockerfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM node:20
1+
# Use an official Node.js image as a base image
2+
FROM node:20 AS build
23

34
WORKDIR /app
45

@@ -7,5 +8,13 @@ RUN npm install
78

89
COPY . .
910

10-
EXPOSE 3000
11-
CMD ["npm", "start"]
11+
# Build the React app
12+
RUN npm run build
13+
# Use a lightweight web server to serve static files
14+
FROM nginx:alpine
15+
# Copy build files to NGINX's default public folder
16+
COPY --from=build /app/build /usr/share/nginx/html
17+
# Expose port 8080 for Cloud Run
18+
EXPOSE 8080
19+
# Start NGINX server
20+
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)