Skip to content

Commit 02a8c15

Browse files
authored
fix: the trpc service is not ready (#18)
Co-authored-by: rick <LinuxSuRen@users.noreply.github.com>
1 parent 622512f commit 02a8c15

6 files changed

Lines changed: 30 additions & 4 deletions

File tree

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ test-e2e:
44
cd e2e && ./start.sh
55
run-demo:
66
cd e2e && docker compose up server
7-
7+
run:
8+
mvn package && java -jar target/demo-0.0.1-SNAPSHOT.jar
89
local-test:
910
atest run -p e2e/test-suite.yaml
1011

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ make build-image test-e2e
1010
## GraphQL
1111
You can visit it via: http://localhost:8080/graphiql?path=/graphql
1212

13+
## tRPC
14+
The [tRPC](https://github.com/trpc-group/trpc-java) endpoint is: `http://localhost:9090`
15+
1316
## OpenAPI
1417
You can visit the swagger UI with the following address:
1518

e2e/start.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ do
1717
code=-1
1818
docker-compose -f "$file" logs | grep server
1919
docker-compose -f "$file" logs | grep testing
20-
docker-compose ps -a | grep e2e-testing | grep "Exited (0)"
20+
docker-compose ps -a | grep testing | grep "Exited (0)"
2121
if [ $? -eq 0 ]
2222
then
2323
code=0
2424
echo "successed"
2525
fi
26+
docker-compose ps -a
2627

2728
docker-compose -f "$file" down
2829
set -e

src/main/java/io/github/devopsws/demo/DemoApplication.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package io.github.devopsws.demo;
22

3+
import com.tencent.trpc.spring.boot.starters.annotation.EnableTRpc;
34
import org.springframework.boot.SpringApplication;
45
import org.springframework.boot.autoconfigure.SpringBootApplication;
56

7+
@EnableTRpc
68
@SpringBootApplication
79
public class DemoApplication {
810

src/main/resources/application.properties

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/main/resources/application.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# https://spring.io/guides/gs/graphql-server/
2+
spring:
3+
graphql:
4+
graphiql:
5+
enabled: true
6+
7+
server:
8+
port: 8080
9+
10+
trpc:
11+
server:
12+
app: TestApp # App name
13+
server: TestServer # Server name
14+
local_ip: 0.0.0.0 # Local ip
15+
service: # Service list
16+
- name: trpc.TestApp.TestServer.Greeter1 # Service name
17+
impls: # Service implement classes
18+
- io.github.devopsws.demo.service.TRPCService
19+
ip: 0.0.0.0 # Listen ip
20+
port: 9090 # Listen port
21+
network: tcp # Network type, tcp or udp

0 commit comments

Comments
 (0)