Nacelle

Go service framework
/

Booting

The github.com/go-nacelle/nacelle package provides a common bootstrapper object that initializes and supervises the core framework behaviors.


Applications written with nacelle should have a common entrypoint, as follows. The application-specific functionality is passed to a boostrapper on construction as a reference to a function that populates a process container. The BootAndExit function initializes and supervises the application, blocks until the application shut down, then calls os.Exit with the appropriate status code. A symmetric function called Boot will perform the same behavior, but will return the integer status code instead of calling os.Exit.

1
2
3
4
5
6
7
func setup(ctx context.Context, processes *nacelle.ProcessContainerBuilder, services *nacelle.ServiceContainer) error {
	// register initializer and process instances
}

func main() {
	nacelle.NewBootstrapper("app-name", setup).BootAndExit()
}

You can see additional examples of the bootstrapper in the example repository. Specifically, the main function of the HTTP API, the gRPC API, and the worker processes.