Skip to content

Commit b87bac3

Browse files
committed
Merge branch 'persist-matches' into n1-comms
2 parents 22a497a + ba9de29 commit b87bac3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+617
-83
lines changed

collab/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
FROM golang:1.20
22

3-
WORKDIR /collab-service
3+
WORKDIR /collab
44

55
COPY go.mod go.sum ./
66
RUN go mod download
77

88
COPY . .
99

1010
# Build
11-
RUN CGO_ENABLED=0 GOOS=linux go build -o /collab-service/app
11+
RUN CGO_ENABLED=0 GOOS=linux go build -o /collab/app
12+
13+
EXPOSE 4000
1214

1315
# Run
14-
CMD ["/collab-service/app"]
16+
CMD ["/collab/app"]

collab/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ func serveWs(
146146
roomMappings *verify.RoomMappings,
147147
persistMappings *verify.PersistMappings,
148148
) {
149+
log.Println("handler called!")
149150
roomID := c.Query("roomID")
150151
if roomID == "" {
151152
http.Error(c.Writer, "roomID required", http.StatusBadRequest)
@@ -272,7 +273,7 @@ func statusHandler(hub *Hub) gin.HandlerFunc {
272273
for client := range hub.clients {
273274
roomID := client.roomID
274275
currentStatus, ok := status[roomID]
275-
if !ok {
276+
if (!ok) {
276277
// Initialize status for a new roomID
277278
status[roomID] = map[string]interface{}{
278279
"clients": 1,

compose.yaml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
peerprep:
33
build: peerprep
4-
image: modembcc/peerprep
4+
image: distractedcat/peerprep
55
env_file:
66
- peerprep/.env
77
ports:
@@ -17,7 +17,7 @@ services:
1717

1818
user-service:
1919
build: user-service
20-
image: modembcc/user-service
20+
image: distractedcat/user-service
2121
volumes:
2222
- /user-service/node_modules
2323
env_file:
@@ -34,7 +34,7 @@ services:
3434

3535
backend:
3636
build: backend
37-
image: modembcc/backend
37+
image: distractedcat/backend
3838
env_file:
3939
- backend/.env
4040
ports:
@@ -73,7 +73,7 @@ services:
7373

7474
matching-service:
7575
build: matching-service
76-
image: modembcc/matching-service
76+
image: distractedcat/matching-service
7777
env_file:
7878
- matching-service/.env
7979
extra_hosts:
@@ -89,7 +89,7 @@ services:
8989

9090
matching-service-api:
9191
build: matching-service-api
92-
image: modembcc/matching-service-api
92+
image: distractedcat/matching-service-api
9393
env_file:
9494
- matching-service-api/.env
9595
extra_hosts:
@@ -107,7 +107,7 @@ services:
107107

108108
storage-blob-api:
109109
build: storage-blob-api
110-
image: modembcc/storage-blob-api
110+
image: distractedcat/storage-blob-api
111111
env_file:
112112
- storage-blob-api/.env
113113
extra_hosts:
@@ -124,7 +124,7 @@ services:
124124

125125
collab:
126126
build: collab
127-
image: modembcc/collab
127+
image: distractedcat/collab
128128
env_file:
129129
- collab/.env
130130
ports:
@@ -134,6 +134,20 @@ services:
134134
- action: rebuild
135135
path: collab
136136
target: collab/app
137+
138+
nginx:
139+
build: nginx
140+
image: distractedcat/nginx
141+
ports:
142+
- "80:80"
143+
volumes:
144+
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
145+
depends_on:
146+
- peerprep
147+
- backend
148+
- user-service
149+
- storage-blob-api
150+
- matching-service-api
137151
# mongo:
138152
# image: "mongo:latest"
139153
# ports:

kubernetes/backend-deployment.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: backend
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: backend
9+
template:
10+
metadata:
11+
labels:
12+
app: backend
13+
spec:
14+
containers:
15+
- name: backend
16+
image: distractedcat/backend:1.0.0
17+
imagePullPolicy: IfNotPresent
18+
env:
19+
- name: MONGODB_URI
20+
value: mongodb+srv://nxtms3:[email protected]/?retryWrites=true&w=majority&appName=questions
21+
- name: PORT
22+
value: :9090
23+
- name: CORS_ORIGIN
24+
value: http://peerprep:3000
25+
ports:
26+
- containerPort: 9090
27+
name: backend

kubernetes/backend-service.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: backend
5+
spec:
6+
selector:
7+
app: backend
8+
ports:
9+
- protocol: TCP
10+
port: 9090
11+
targetPort: 9090
12+
type: ClusterIP
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: collab
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: collab
9+
template:
10+
metadata:
11+
labels:
12+
app: collab
13+
spec:
14+
containers:
15+
- name: collab
16+
image: distractedcat/collab:1.0.0
17+
imagePullPolicy: Always
18+
env:
19+
- name: PORT
20+
value: :4000
21+
- name: REDIS_URI
22+
value: redis:6379
23+
- name: USER_SERVICE_URI
24+
value: http://user-service:3001
25+
ports:
26+
- containerPort: 4000
27+
name: collab
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: collab
5+
spec:
6+
selector:
7+
app: collab
8+
ports:
9+
- protocol: TCP
10+
port: 4000
11+
targetPort: 4000
12+
#nodePort: 31000
13+
type: ClusterIP
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: matching-service-api
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: matching-service-api
9+
template:
10+
metadata:
11+
labels:
12+
app: matching-service-api
13+
spec:
14+
containers:
15+
- name: matching-service-api
16+
image: distractedcat/matching-service-api:1.0.0
17+
imagePullPolicy: Always
18+
env:
19+
- name: PORT
20+
value: :9200
21+
- name: RABBIT_URI
22+
value: amqp://grp14:grp14@rabbitmq/
23+
- name: CORS_ORIGIN
24+
value: http://peerprep:3000
25+
ports:
26+
- containerPort: 9200
27+
name: matching-api
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: matching-service-api
5+
spec:
6+
selector:
7+
app: matching-service-api
8+
ports:
9+
- protocol: TCP
10+
port: 9200
11+
targetPort: 9200
12+
type: ClusterIP
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: matching-service
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: matching-service
9+
template:
10+
metadata:
11+
labels:
12+
app: matching-service
13+
spec:
14+
containers:
15+
- name: matching-service
16+
image: distractedcat/matching-service:1.0.0
17+
imagePullPolicy: Always
18+
env:
19+
- name: RABBIT_URI
20+
value: amqp://grp14:grp14@rabbitmq/
21+
- name: REDIS_URI
22+
value: redis:6379
23+
- name: BACKEND_MATCH_URI
24+
value: http://backend:9090/match

0 commit comments

Comments
 (0)