Launchpad

This commit is contained in:
2025-12-13 14:37:29 +08:00
parent b9a97c67e2
commit 0e0ff24195
5 changed files with 426 additions and 0 deletions

View File

@@ -2,6 +2,56 @@
A modular service framework.
## Launchpad (Process Manager)
The `launchpad` is a CLI tool located in `pkg/launchpad` designed to simplify development and production workflows for the entire Turbine project. It acts as a process manager that can run all defined services concurrently for development and generate a `docker-compose.yml` file for production deployments.
### Configuration
The launchpad is configured via a `launchpad.toml` file in the project root. This file defines all the services, including how to run them in development and how to build them for production.
**`launchpad.toml` example:**
```toml
[[services]]
name = "gateway"
type = "go"
path = "./pkg/gateway"
[services.dev]
command = "go run ./main.go"
[services.prod]
dockerfile = "./pkg/gateway/Dockerfile"
image = "turbine/gateway:latest"
ports = ["8080:8080"]
[[services]]
name = "orders-api"
type = "dotnet"
path = "../turbine-dotnet-services/orders-api"
[services.dev]
command = "dotnet watch run"
[services.prod]
dockerfile = "../turbine-dotnet-services/orders-api/Dockerfile"
image = "turbine/orders-api:latest"
```
### Commands
To use the launchpad, run its `main.go` file with one of the following commands:
#### Development (`dev`)
Starts all services defined in `launchpad.toml` in development mode. Each service runs in a separate process, and their logs are streamed to the console with colored prefixes. A single `Ctrl+C` will gracefully shut down all services.
```bash
go run ./pkg/launchpad/main.go dev
```
#### Production Docker Compose Generation (`prod-gen`)
Generates a `docker-compose.yml` file in the project root based on the `prod` configuration of all services in `launchpad.toml`. This file can be used to build and run all services as Docker containers.
```bash
go run ./pkg/launchpad/main.go prod-gen
```
## Registrar
The Registrar is the service discovery system of the DysonNetwork.