Monorepo Microservice Orchestrator
Peter Malina
CTO @ FlowUp
https://github.com/flowup/mmo
https://github.com/flowup/mmo-plugins
go get -u github.com/flowup/mmo$ mmo init myapp
$ tree myapp/
myapp/
├── LICENSE
├── mmo.yaml
├── README.md
└── .drone.yml$ mmo add service book
$ tree book/
book/
├── cmd
│ └── book
│ └── main.go
├── deployment
│ └── deployment.yaml
├── protobuf
│ └── proto.proto
├── service.go
└── service_test.goname: myapp
plugins:
- flowup/mmo-gen-swagger:1.0.1
prefix: github.com/flowup/testbench/myapp
services:
book:
description: ""
plugins:
- flowup/mmo-gen-go-grpc:1.0.2
- flowup/mmo-gen-grpc-gateway:1.0.1syntax = "proto3";
package book;
import "google/protobuf/empty.proto";
service BookService {
rpc GetVersion (google.protobuf.Empty) returns (Version) {}
rpc CreateBook(Book) returns (Book) {}
rpc GetAllBooks(google.protobuf.Empty) returns (Books) {}
}
message Version {
string name = 1;
}
message Book {
string name = 1;
string description = 2;
string author = 3;
}
message Books {
repeated Book books = 1;
}// Service represents an implementation of the Book service interface
type Service struct {
}
// NewService creates a new service object
func NewService() *Service {
return &Service{}
}
// CreateBook creates a new book
func (s *Service) CreateBook(ctx context.Context, in *Book) (*Book, error) {
return in, nil
}syntax = "proto3";
package book;
import "google/protobuf/empty.proto";
service BookService {
rpc CreateBook(Book) returns (Book) {
+ option (google.api.http) = {
+ post: "/v1/example/echo"
+ body: "*"
+ };
}
}
message Book {
string name = 1;
string description = 2;
string author = 3;
}import "github.com/flowup/testbench/myapp/book"
type OtherService struct {
books *book.Service
}
func (s *OtherService) DoSomething(ctx context.Context, in *Model) (*Model, error) {
book, err := s.books.CreateBook(ctx, book.Book{.....})
...
}