Orchestra
Orchestra is a toolkit to manage a fleet of Go binaries/services. A unique place where you can run, stop, aggregate logs and config your Go binaries.
You can find an application design/proposal document here
Build & Install
go get -u github.com/vinceprignano/orchestra
Start an Orchestra Project
You should have an orchestra.yml
file in your root directory and a service.yml
file in every service directory.
.
├── first-service
│ ├── main.go
│ └── service.yml <- Service file
├── second-service
│ ├── second.go
│ ├── main.go
│ └── service.yml <- Service file
└── orchestra.yml <- Main project file
You can specify a custom configuration file using the --config
flag or setting the ORCHESTRA_CONFIG
env variable.
By default orchestra will use go install
to install your binaries in GOPATH/bin
.
Example
env:
ABC: "somethingGlobal"
before:
- "echo I am a global command before"
after:
- "echo I am a global after"
Commands
- start
--option [<service>...]
Starts every service
Options:
--attach, -a
Attach to services output after start
--logs, -l
Start logging after start
- stop
--option [<service>...]
Stops every service
- restart
--option [<service>...]
Restarts every service
Options:
--attach, -a
Attach to services output after start
--logs, -l
Start logging after start
- logs
--option [<service>...]
Aggregates the output from the services
- test
--option [<service>...]
Runs go test ./...
for every service
Options:
-v
--verbose
Run tests in verbose mode
-r
--race
Run tests with race condition
- ps Displays the status of every service
A service name can be prefixed with ~
to run a command in exclusion mode.
For example orchestra start ~second-service
will start everything expect the second-service.
When using -a
or --attach
with start/restart, the services will be spawned in the same ochestra's process group.
Configuring commands
Every command can be configured separately with special environment variables or with before/after commands.
For example, in orchestra.yml
you can configure to echo AFTER START
before running orchestra start
command.
env:
- "ABC=somethingGlobal"
before:
- "echo I am a global command before"
after:
- "echo I am a global after"
start:
env:
- "ABC=somethingStart"
after:
- "echo AFTER START"
Autocomplete
Orchestra supports bash autocomplete.
source $GOPATH/src/github.com/vinceprignano/orchestra/autocomplete/orchestra