You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- The **question service** at http://localhost:8080
60
+
- The **matching service** at http://localhost:8081
61
+
- The **redis service** at http://localhost:6379
56
62
57
63
3. Stopping Services
58
64
@@ -66,20 +72,24 @@ This command will stop and remove the containers, networks, and volumes created
66
72
67
73
## Troubleshooting
68
74
69
-
**Common Issues**
75
+
### Common Issues
76
+
77
+
-**Port Conflicts**: If you encounter port conflicts, ensure the host ports specified in docker-compose.yml (e.g., 3000:3000) are not in use by other applications.
78
+
-**Environment Variables Not Loaded**: Ensure the `.env` files are in the correct directories as found in the `docker-compose.yml` file.
79
+
80
+
### Known Issues
70
81
71
-
- Port Conflicts: If you encounter port conflicts, ensure the host ports specified in docker-compose.yml (e.g., 3000:3000) are not in use by other applications.
72
-
- Environment Variables Not Loaded: Ensure the `.env` files are in the correct directories as found in the `docker-compose.yml` file.
82
+
-**Mongo DB Connection Failing**: The user service fails to connect to the Mongo DB server on NUS Wi-Fi. To resolve this we have to use another network.
73
83
74
-
**Logs**
84
+
### Logs
75
85
76
86
You can view the logs for each service using the following command:
Copy file name to clipboardExpand all lines: apps/matching-service/README.md
+25-3Lines changed: 25 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ go mod tidy
27
27
-`PORT`: Specifies the port for the WebSocket server. Default is `8081`.
28
28
-`JWT_SECRET`: The secret key used to verify JWT tokens.
29
29
-`MATCH_TIMEOUT`: The time in seconds to wait for a match before timing out.
30
-
-`REDIS_URL`: The URL for the Redis server. Default is `localhost:6379`.
30
+
-`REDIS_URL`: The URL for the Redis server. Default is `localhost:6379`. If you are using docker, use `redis-container:6379`
31
31
32
32
4. Start a local Redis server:
33
33
@@ -121,6 +121,28 @@ Make sure to open the HTML file in a web browser while the WebSocket server is r
121
121
122
122
You can open one instance of the HTML file in multiple tabs to simulate multiple clients connecting to the server. (In the future: ensure that only one connection is allowed per user)
123
123
124
-
## Docker Support
124
+
## Running the Application via Docker
125
125
126
-
TODO: Add section for Docker setup and usage instructions.
126
+
Before running the following commands, ensure that the URL for the Redis server in `.env` file has been changed to `REDIS_URL=redis-container:6379`
127
+
128
+
To run the application via Docker, run the following command:
129
+
130
+
1. Set up the Go Docker container for the matching service
131
+
```bash
132
+
docker build -f Dockerfile -t match-go-app .
133
+
```
134
+
135
+
2. Create the Docker network for Redis and Go
136
+
```bash
137
+
docker network create redis-go-network
138
+
```
139
+
140
+
3. Start a new Redis container in detached mode using the Redis image from Docker Hub
141
+
```bash
142
+
docker run -d --name redis-container --network redis-go-network redis
143
+
```
144
+
145
+
4. Run the Go Docker container for the matching-service
146
+
```bash
147
+
docker run -d -p 8081:8081 --name go-app-container --network redis-go-network match-go-app
0 commit comments