Skip to content

dudo/ruby_twirp_skeleton

Repository files navigation

My Service

Hanami / Twirp fusion. This service does... what?

System Architecture

Setup

This service makes heavy use of docker and docker compose. Setting up docker is beyond the scope of this readme.

mkdir ~/projects/my_project/
cd ~/projects/my_project/
git clone git@github.com:my_project/my_service.git
git clone git@github.com:my_project/protos.git

cd ~/projects/my_project/my_service
docker-compose run --rm bundle install --with development test

docker-compose up -d

docker-compose run --rm bundle exec hanami db prepare
docker-compose run --rm bundle exec rake seed:things
docker-compose run --rm bundle exec rake twirp:fetch_thing

Generate code when you change applicable .proto files:

# This expects your proto files to be in the same directory as your app
docker-compose run --rm protoc

How to run various Hanami commands:

docker-compose run --rm bundle exec hanami console
docker-compose run --rm bundle exec hanami g model NewModel

How to prepare (create and migrate) DB for development and test environments:

docker-compose run -e HANAMI_ENV=test --rm bundle exec hanami db prepare
docker-compose run --rm rpsec

Deployment

This should be done for you via CI/CD, but in case you need to manually push an image:

docker login https://docker.pkg.github.com
docker build -t docker.pkg.github.com/my_project/my_service/my_service:0.1.0 .
docker push docker.pkg.github.com/my_project/my_service/my_service:0.1.0

Reading

Explore Hanami guides, API docs, or jump in chat for help. Enjoy! 🌸

Learn about Twirp.

Learn about protobuf.

Learn about Docker.

Learn about GitHub Actions.