File tree Expand file tree Collapse file tree 10 files changed +51
-22
lines changed Expand file tree Collapse file tree 10 files changed +51
-22
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,12 @@ services:
62
62
ports :
63
63
- " 9100:5672"
64
64
- " 9101:15672"
65
+ healthcheck :
66
+ test : rabbitmq-diagnostics -q ping
67
+ interval : 30s
68
+ timeout : 10s
69
+ retries : 5
70
+ start_period : 10s
65
71
66
72
matching-service :
67
73
build : matching-service
@@ -74,9 +80,10 @@ services:
74
80
- action : rebuild
75
81
path : matching-service
76
82
target : matching-service/app
83
+ # TODO for some reason healthcheck doesnt really work, still ahve to manually start them
77
84
depends_on :
78
- - rabbitmq
79
- - redis
85
+ rabbitmq :
86
+ condition : service_healthy
80
87
81
88
matching-service-api :
82
89
build : matching-service-api
@@ -92,7 +99,8 @@ services:
92
99
path : matching-service
93
100
target : matching-service/app
94
101
depends_on :
95
- - rabbitmq
102
+ rabbitmq :
103
+ condition : service_healthy
96
104
97
105
storage-blob-api :
98
106
build : storage-blob-api
Original file line number Diff line number Diff line change 1
1
RABBIT_URI = " amqp://grp14:grp14@localhost:9100/"
2
2
3
3
REDIS_URI = " localhost:9190"
4
+
5
+ # dockerised
6
+
7
+ RABBIT_URI = " amqp://grp14:grp14@rabbitmq/"
8
+
9
+ REDIS_URI = " redis:9190"
Original file line number Diff line number Diff line change 1
- FROM golang:1.23
1
+ FROM golang:1.20
2
2
3
3
WORKDIR /matching-service
4
4
Original file line number Diff line number Diff line change 1
- NEXT_PUBLIC_QUESTION_SERVICE =
2
- NEXT_PUBLIC_USER_SERVICE =
3
- NEXT_PUBLIC_MATCHING_SERVICE =
4
- NEXT_PUBLIC_STORAGE_BLOB =
1
+ NEXT_PUBLIC_BASE_URL = http://host.docker.internal:80
2
+ NEXT_PUBLIC_QUESTION_SERVICE = http://backend:9090
3
+ NEXT_PUBLIC_USER_SERVICE = http://user-service:3001
5
4
# note NGINX will currently point to itself.
6
- NEXT_PUBLIC_NGINX =
7
- DEV_ENV =
5
+ NEXT_PUBLIC_NGINX = http://localhost:3000
6
+ DEV_ENV = not
7
+ NEXT_PUBLIC_MATCHING_SERVICE = http://matching-service-api:9200
8
+ NEXT_PUBLIC_STORAGE_BLOB = http://storage-blob-api:9300
Original file line number Diff line number Diff line change @@ -54,15 +54,25 @@ const Matchmaking = () => {
54
54
const { userid } = useUserInfo ( ) ;
55
55
const timeout = useRef < NodeJS . Timeout > ( ) ;
56
56
57
+ const stopTimer = ( ) => {
58
+ // if user manually stopped it clear timeout
59
+ if ( timeout . current ) {
60
+ console . debug ( "Match request timeout stopped" ) ;
61
+ clearTimeout ( timeout . current ) ;
62
+ }
63
+ } ;
64
+
57
65
const handleMatch = async ( ) => {
58
66
if ( ! isMatching ) {
67
+ setIsMatching ( true ) ;
68
+
59
69
// start 30s timeout
60
70
timeout . current = setTimeout ( ( ) => {
61
71
setIsMatching ( false ) ;
62
72
console . log ( "Match request timed out after 30s" ) ;
63
73
} , TIMEOUT_MILLISECONDS ) ;
64
74
65
- setIsMatching ( true ) ;
75
+ // assemble the match request
66
76
const matchRequest : MatchRequest = {
67
77
userId : userid ,
68
78
difficulty : difficulty ,
@@ -72,19 +82,17 @@ const Matchmaking = () => {
72
82
console . log ( "Match attempted" ) ;
73
83
console . debug ( matchRequest ) ;
74
84
85
+ // send match request
75
86
const status = await findMatch ( matchRequest ) ;
76
87
if ( status . error ) {
88
+ stopTimer ( ) ;
77
89
console . log ( "Failed to find match. Cancel matching." ) ;
78
90
setIsMatching ( false ) ;
79
91
return ;
80
92
}
81
93
console . log ( `Started finding match.` ) ;
82
94
} else {
83
- // if user manually stopped it clear timeout
84
- if ( timeout . current ) {
85
- clearTimeout ( timeout . current ) ;
86
- }
87
-
95
+ stopTimer ( ) ;
88
96
setIsMatching ( false ) ;
89
97
console . log ( "User stopped matching" ) ;
90
98
}
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ const QuestionList: React.FC = () => {
34
34
new Set ( data . flatMap ( ( question ) => question . topicTags ) )
35
35
) . sort ( ) ;
36
36
setTopicsList ( [ "all" , ...uniqueTopics ] ) ;
37
+ setTopics ( [ "all" , ...uniqueTopics ] ) ;
37
38
} ;
38
39
39
40
fetchQuestions ( ) ;
Original file line number Diff line number Diff line change @@ -15,10 +15,10 @@ function isSession(request: NextRequest): boolean {
15
15
}
16
16
17
17
export function middleware ( request : NextRequest ) {
18
- // TODO DELETE THIS LATER
19
- if ( process . env . NEXT_BYPASS_LOGIN === "yesplease" ) {
20
- return NextResponse . next ( ) ;
21
- }
18
+ // // UNCOMMENT AND ADD TO ENV IF JUST TESTING FRONTEND STUFF
19
+ // if (process.env.NEXT_BYPASS_LOGIN === "yesplease") {
20
+ // return NextResponse.next();
21
+ // }
22
22
23
23
if ( isNoSession ( request ) ) {
24
24
return NextResponse . redirect ( new URL ( "/questions" , request . url ) ) ;
Original file line number Diff line number Diff line change 1
1
PORT = :9300
2
2
REDIS_URI = " localhost:9190"
3
+
4
+ # dockerised
5
+ PORT = :9300
6
+ REDIS_URI = " redis:6379"
Original file line number Diff line number Diff line change 1
- FROM golang:1.23
1
+ FROM golang:1.2
2
2
3
3
WORKDIR /storage-blob-api
4
4
Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ WORKDIR /user-service
4
4
# TODO: don't include the .env file in the COPY
5
5
# TODO: multistage build
6
6
COPY package*.json ./
7
- RUN npm install --verbose
7
+ # why did it only work with --force
8
+ RUN npm install --force --verbose
8
9
RUN npm rebuild bcrypt --build-from-source
9
10
COPY . .
10
11
EXPOSE 3001
You can’t perform that action at this time.
0 commit comments