Sockshopを動かすときのメモ
概要
2022/11/25の段階では全ての機能が正常に動作しない.
カート機能でエラーが発生して,カートへ商品を追加できない. カート追加ボタンを押してもカートに飛ばない.
対処
以下のIssueに従ってMongoDBのコンテナイメージにバージョン指定を追加すればよい.
https://github.com/microservices-demo/microservices-demo/issues/900
$ git diff complete-demo.yaml
diff --git a/deploy/kubernetes/complete-demo.yaml b/deploy/kubernetes/complete-demo.yaml
index 457f09f..b19e650 100644
--- a/deploy/kubernetes/complete-demo.yaml
+++ b/deploy/kubernetes/complete-demo.yaml
@@ -91,7 +91,7 @@ spec:
spec:
containers:
- name: carts-db
- image: mongo
+ image: mongo:5.0.11
ports:
- name: mongo
containerPort: 27017
@@ -405,7 +405,7 @@ spec:
spec:
containers:
- name: orders-db
- image: mongo
+ image: mongo:5.0.11
ports:
- name: mongo
containerPort: 27017
調査
以下のコマンドを実行してログを閲覧した.
kubectl logs carts-78d7c69cb8-cp9xd
その結果,ログの中に以下を見つけた.
2022-11-25 08:47:35.576 ERROR [carts,,,] 7 --- [p-nio-80-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.mongodb.UncategorizedMongoDbException: Query failed with error code 352 and error message 'Unsupported OP_QUERY command: find. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal' on server carts-db:27017; nested exception is com.mongodb.MongoQueryException: Query failed with error code 352 and error message 'Unsupported OP_QUERY command: find. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal' on server carts-db:27017] with root cause
特に以下の部分がヒントになる.
nested exception is com.mongodb.MongoQueryException: Query failed with error code 352 and error message 'Unsupported OP_QUERY command: find. The client driver may require an upgrade.