Distributed is a Go-based microservices architecture system that provides service registration, discovery, and dependency update. You can put your custome micro services under the cmd directory to run the system.
Go v1.18 or higher
Docker (optional)
Clone this repository:
git clone https://github.com/your_username/distributed.gitNavigate to the cloned directory:
cd distributedStart the micro services by navigating to their respective directories under /cmd and run:
go run main.goFor example, to start the registry service:
cd cmd/registryservice
go run main.goUse the API endpoints provided by the package service to interact with the system.
For example, to register a service with the registry:
host, port := "localhost", "4000"
serviceAddr := fmt.Sprintf("http://%s:%s", host, port)
r := registry.Registration{
ServiceName: registry.LogService,
ServiceURL: serviceAddr,
RequiredServices: make([]registry.ServiceName, 0),
ServiceUpdateURL: serviceAddr + "/services",
HeartbeatURL: serviceAddr + "/heartbeat",
}
ctx, err := service.Start(
context.Background(),
host,
port,
r,
log.RegisterHandlers,
)Distributed can also be run using Docker.
TBD
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.