{"id":20543557,"url":"https://github.com/bavix/greeter-gripmock","last_synced_at":"2026-05-29T06:31:07.168Z","repository":{"id":193653977,"uuid":"689210532","full_name":"bavix/greeter-gripmock","owner":"bavix","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-05T16:40:59.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-27T18:37:20.725Z","etag":null,"topics":["demo","go","greeter","gripmock"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bavix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-09-09T05:19:40.000Z","updated_at":"2025-09-05T16:40:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"33ec1f2b-9aa5-4d1f-bd81-4e5b6a1c4420","html_url":"https://github.com/bavix/greeter-gripmock","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.25,"last_synced_commit":"e9dc1f303de0e453aa745f306d446449dae7c700"},"previous_names":["bavix/greeter-gripmock"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bavix/greeter-gripmock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bavix%2Fgreeter-gripmock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bavix%2Fgreeter-gripmock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bavix%2Fgreeter-gripmock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bavix%2Fgreeter-gripmock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bavix","download_url":"https://codeload.github.com/bavix/greeter-gripmock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bavix%2Fgreeter-gripmock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33640627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["demo","go","greeter","gripmock"],"created_at":"2024-11-16T01:38:47.534Z","updated_at":"2026-05-29T06:31:07.151Z","avatar_url":"https://github.com/bavix.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Greeter \n\nGreeter service is a \"hello world\" service in the grpc world. The client and server source code can be found at: https://github.com/grpc/grpc-go\n\nThe assembled server in docker: https://github.com/bavix/greeter-server.\nLet's launch:\n```bash\ndocker run -p 4770:4770 bavix/greeter-server -port=4770\n```\n\nThe assembled client in docker: https://github.com/bavix/greeter-client.\nLet's launch:\n```bash\ndocker run --network=host bavix/greeter-client -addr=127.0.0.1:4770 -name=gripmock\n```\n\nYou should see the result of the client's work:\n```bash\n2023/09/09 06:00:11 Greeting: Hello gripmock\n```\n\nTerminate the service, let's run the same in docker-compose:\n```bash\ndocker compose up\n```\n\nYou should see stdout something like this:\n```bash\n ✔ Container greeter-gripmock-server-1   Created                                                                                                                             0.0s \n ✔ Container greeter-gripmock-greeter-1  Created                                                                                                                             0.0s \nAttaching to greeter-gripmock-greeter-1, greeter-gripmock-server-1\ngreeter-gripmock-server-1   | 2023/09/09 06:02:10 server listening at [::]:4770\ngreeter-gripmock-greeter-1  | 2023/09/09 06:02:10 Greeting: Hello gripmock\ngreeter-gripmock-server-1   | 2023/09/09 06:02:10 Received: gripmock\ngreeter-gripmock-greeter-1 exited with code 0\n```\n\nThe server started successfully, and the client started and sent a request to the server. Afterwards the client completed its work with code 0.\n\nDocker compose has the ability to interrupt the operation of containers if some service has stopped working. Typically, this mechanism is used in integration tests.\n```bash\ndocker compose up --abort-on-container-exit --exit-code-from greeter\n```\n\nNow the result is like this:\n```bash\n ✔ Container greeter-gripmock-server-1   Created                                                                                                                             0.0s \n ✔ Container greeter-gripmock-greeter-1  Created                                                                                                                             0.0s \nAttaching to greeter-gripmock-greeter-1, greeter-gripmock-server-1\ngreeter-gripmock-server-1   | 2023/09/09 06:05:53 server listening at [::]:4770\ngreeter-gripmock-server-1   | 2023/09/09 06:05:53 Received: gripmock\ngreeter-gripmock-greeter-1  | 2023/09/09 06:05:53 Greeting: Hello gripmock\ngreeter-gripmock-greeter-1 exited with code 0\nAborting on container exit...\n[+] Stopping 2/2\n ✔ Container greeter-gripmock-greeter-1  Stopped                                                                                                                             0.0s \n ✔ Container greeter-gripmock-server-1   Stopped     \n ```\n\nUsing the gripmock service, we simulate the operation of a greeter server.\n\nCreate a stub `stubs/greeter.yaml`:\n```yaml\n- service: Greeter\n  method: SayHello\n  input:\n    equals:\n      name: gripmock\n  output:\n    data:\n      message: Hello, GripMock\n```\n\nDownload the proto-file of the greeter service:\n```bash\ncurl https://raw.githubusercontent.com/grpc/grpc-go/master/examples/helloworld/helloworld/helloworld.proto \\\n  --create-dirs -o api/helloworld.proto\n```\n\nLet's run gripmock:\n```bash\ndocker run \\\n  -p 4770:4770 \\\n  -p 4771:4771 \\\n  -v ./api:/proto:ro \\\n  -v ./stubs:/stubs:ro \\\n  bavix/gripmock -stub=/stubs /proto/helloworld.proto\n```\n\nLet's launch the client:\n```bash\ndocker run --network=host bavix/greeter-client -addr=127.0.0.1:4770 -name=gripmock\n```\n\nYou should see the result of the client's work:\n```bash\n2023/09/09 06:16:10 Greeting: Hello, GripMock\n```\n\nIn the docker-compose file it will look like this:\n```yaml\nversion: '3.8'\n\nservices:\n  greeter:\n    image: bavix/greeter-client:1\n    depends_on:\n      gripmock:\n        condition: service_healthy\n    command:\n      - -addr=gripmock:4770\n      - -name=gripmock\n    networks:\n      - bx-greeter\n\n  gripmock:\n    image: bavix/gripmock:2\n    ports:\n      - 4770:4770\n      - 4771:4771\n    healthcheck:\n      test: \"curl --connect-timeout 1 --silent --show-error --fail http://gripmock:4771/api/health/readiness\"\n      timeout: 1s\n      interval: 1s\n      start_period: 1s\n      retries: 10\n    command:\n      - -stub=/stubs\n      - /proto/helloworld.proto\n    volumes:\n      - ./stubs:/stubs:ro\n      - ./api:/proto:ro\n    networks:\n      - bx-greeter\n\nnetworks:\n  bx-greeter:\n```\n\nRunning an integration test:\n```bash\ndocker compose -f docker-compose.test.yaml up --abort-on-container-exit --exit-code-from greeter\n```\n\nResult of running the integration test:\n```bash\n ✔ Container greeter-gripmock-gripmock-1  Created                                                                                                                            0.0s \n ✔ Container greeter-gripmock-greeter-1   Recreated                                                                                                                          0.0s \nAttaching to greeter-gripmock-greeter-1, greeter-gripmock-gripmock-1\ngreeter-gripmock-gripmock-1  | Starting GripMock\ngreeter-gripmock-gripmock-1  | Serving stub admin on http://:4771\ngreeter-gripmock-gripmock-1  | grpc server pid: 40\ngreeter-gripmock-gripmock-1  | Serving gRPC on tcp://:4770\ngreeter-gripmock-gripmock-1  | 172.20.0.2 - - [09/Sep/2023:07:45:05 +0000] \"GET /api/health/readiness HTTP/1.1\" 200 57\ngreeter-gripmock-gripmock-1  | 127.0.0.1 - - [09/Sep/2023:07:45:06 +0000] \"POST /api/stubs/search HTTP/1.1\" 200 50\ngreeter-gripmock-greeter-1   | 2023/09/09 07:45:06 Greeting: Hello, GripMock\ngreeter-gripmock-greeter-1 exited with code 0\nAborting on container exit...\n[+] Stopping 2/2\n ✔ Container greeter-gripmock-greeter-1   Stopped                                                                                                                            0.0s \n ✔ Container greeter-gripmock-gripmock-1  Stopped    \n ```\n\nIn the pipeline, you can operate with the code returned from docker compose and, if a non-zero value is received, mark the test as failed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbavix%2Fgreeter-gripmock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbavix%2Fgreeter-gripmock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbavix%2Fgreeter-gripmock/lists"}