{"id":29572706,"url":"https://github.com/accelbyte/example-advanced-sample-app-grpc-golang","last_synced_at":"2025-07-19T05:10:57.967Z","repository":{"id":173552050,"uuid":"650910114","full_name":"AccelByte/example-advanced-sample-app-grpc-golang","owner":"AccelByte","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-05T21:13:24.000Z","size":97,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-05T22:20:17.742Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/AccelByte.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}},"created_at":"2023-06-08T04:40:22.000Z","updated_at":"2024-12-05T21:13:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"75499a50-3b36-407d-bcd5-d139b8e5853d","html_url":"https://github.com/AccelByte/example-advanced-sample-app-grpc-golang","commit_stats":null,"previous_names":["accelbyte/example-crew-and-game-matchmakers-grpc-golang","accelbyte/example-advanced-sample-app-grpc-golang"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AccelByte/example-advanced-sample-app-grpc-golang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AccelByte%2Fexample-advanced-sample-app-grpc-golang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AccelByte%2Fexample-advanced-sample-app-grpc-golang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AccelByte%2Fexample-advanced-sample-app-grpc-golang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AccelByte%2Fexample-advanced-sample-app-grpc-golang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AccelByte","download_url":"https://codeload.github.com/AccelByte/example-advanced-sample-app-grpc-golang/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AccelByte%2Fexample-advanced-sample-app-grpc-golang/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265892517,"owners_count":23845034,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-07-19T05:10:57.381Z","updated_at":"2025-07-19T05:10:57.954Z","avatar_url":"https://github.com/AccelByte.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# example-advanced-sample-app-grpc-golang\r\n\r\n```mermaid\r\nflowchart LR\r\n   subgraph AB Cloud Service\r\n   CL[gRPC Client]\r\n   end\r\n   subgraph gRPC Server Deployment\r\n   SV[\"gRPC Server\\n(YOU ARE HERE)\"]\r\n   DS[Dependency Services]\r\n   CL --- DS\r\n   end\r\n   DS --- SV\r\n```\r\n\r\n`AccelByte Gaming Services` capabilities can be extended using custom functions implemented in a `gRPC server`.\r\nIf configured, custom functions in the `gRPC server` will be called by `AccelByte Gaming Services` instead of the default function.\r\n\r\nThe `gRPC server` and the `gRPC client` can actually communicate directly. \r\nHowever, additional services are necessary to provide **security**, **reliability**, **scalability**, and **observability**. \r\nWe call these services as `dependency services`. \r\nThe [grpc-plugin-dependencies](https://github.com/AccelByte/grpc-plugin-dependencies) repository is provided \r\nas an example of what these `dependency services` may look like. \r\nIt contains a docker compose which consists of these `dependency services`.\r\n\r\n\u003e :warning: **grpc-plugin-dependencies is provided as example for local development purpose only:** The dependency services in the actual gRPC server deployment may not be exactly the same.\r\n\r\n## Overview\r\n\r\nThis repository contains `sample matchmaking function gRPC server app` written in `Go`, It provides simple custom\r\nmatchmaking function implementation for matchmaking service in `AccelByte Gaming Services`. \r\n\r\nThis sample app also shows how this `gRPC server` can be instrumented for better observability.\r\nIt is configured by default to send metrics, traces, and logs to the observability `dependency services` \r\nin [grpc-plugin-dependencies](https://github.com/AccelByte/grpc-plugin-dependencies).\r\n\r\n## Prerequisites\r\n\r\n1. Windows 10 WSL2 or Linux Ubuntu 20.04 with the following tools installed.\r\n\r\n   a. bash\r\n\r\n   b. make\r\n\r\n   c. docker v23.x\r\n\r\n   d. docker-compose v2.x\r\n\r\n   e. docker loki driver\r\n      \r\n      ```\r\n      docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions\r\n      ```\r\n\r\n   f. go 1.18\r\n\r\n2. Access to `AccelByte Gaming Services` demo environment.\r\n\r\n   a. Base URL: https://test.accelbyte.io\r\n\r\n   b. [Create a Game Namespace](https://docs.accelbyte.io/esg/uam/namespaces.html#tutorials) if you don't have one yet. Keep the `Namespace ID`.\r\n\r\n   c. [Create an OAuth Client](https://docs.accelbyte.io/guides/access/iam-client.html) with confidential client type with the following permission. Keep the `Client ID` and `Client Secret`.\r\n\r\n      - NAMESPACE:{namespace}:MMV2GRPCSERVICE [READ]\r\n\r\n## Setup\r\n\r\nTo be able to run this sample app, you will need to follow these setup steps.\r\n\r\n1. Create a docker compose `.env` file by copying the content of [.env.template](.env.template) file.\r\n\r\n   \u003e :warning: **The host OS environment variables have higher precedence compared to `.env` file variables**: If the variables in `.env` file do not seem to take effect properly, check if there are host OS environment variables with the same name. \r\n   See documentation about [docker compose environment variables precedence](https://docs.docker.com/compose/environment-variables/envvars-precedence/) for more details.\r\n\r\n2. Fill in the required environment variables in `.env` file as shown below.\r\n\r\n   ```\r\n   AB_BASE_URL=https://test.accelbyte.io      # Base URL of AccelByte Gaming Services demo environment\r\n   AB_CLIENT_ID='xxxxxxxxxx'         # Client ID from the Prerequisites section\r\n   AB_CLIENT_SECRET='xxxxxxxxxx'     # Client Secret from the Prerequisites section\r\n   AB_NAMESPACE='xxxxxxxxxx'                  # Namespace ID from the Prerequisites section\r\n   PLUGIN_GRPC_SERVER_AUTH_ENABLED=false      # Enable or disable access token and permission verification\r\n   ```\r\n\r\n   \u003e :warning: **Keep PLUGIN_GRPC_SERVER_AUTH_ENABLED=false for now**: It is currently not\r\n   supported by `AccelByte Gaming Services`, but it will be enabled later on to improve security. If it is\r\n   enabled, the gRPC server will reject any calls from gRPC clients without proper authorization\r\n   metadata.\r\n\r\n## Building\r\n\r\nTo build this sample app, use the following command.\r\n\r\n```\r\nmake build\r\n```\r\n\r\n## Running\r\n\r\nTo (build and) run this sample app in a container, use the following command.\r\n\r\n```\r\ndocker-compose up --build\r\n```\r\n\r\n## Pushing\r\n\r\nTo build and push this sample app multi-arch container image to AWS ECR, use the following command.\r\n\r\n```\r\nmake imagex_push REPO_URL=xxxxxxxxxx.dkr.ecr.us-west-2.amazonaws.com/accelbyte/justice/development/extend/xxxxxxxxxx/xxxxxxxxxx IMAGE_TAG=v0.0.1\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccelbyte%2Fexample-advanced-sample-app-grpc-golang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faccelbyte%2Fexample-advanced-sample-app-grpc-golang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccelbyte%2Fexample-advanced-sample-app-grpc-golang/lists"}