This is the sample grpc server written with golang.
- Docker Desktop
- VSCode & Dev Container Extension
※I use codespaces.
- Go 1.22
- MySQL 8
- gRPC
Others:
- gorm
- golang-migrate
etc.
# migration and generate go code from proto
# the password is necessary for mysql. see .devcontainer/.env
$ make init
# start grpc server
$ make run-server
# start grpc server with reflection
$ make run-server-ref
$ if you need sample data
$ make sample
You can try gRPC request via Postman of VSCode extension. The server URL is localhost:8080.
Building binary file can be achieved by ./github/workflows/build.yml via GitHub Actions.
The artifact would be uploaded to artifact-storage.
That workflow needs personal access token as PERSONAL_ACCESS_TOKEN.
I prepared deploy system for development purpose. See the following repositories.
$ make test
$ make lint
$ go install -tags mysql github.com/golang-migrate/migrate/v4/cmd/[email protected]
$ migrate create -ext sql -dir /mnt/grpc-sample/app/resource/migration -seq ${MIGRATION_FILE_NAME}
# the password is written in .devcontainer/.env
$ make mysql
Other commands are written in Makefile.