13 releases (4 breaking)

0.5.6 Jul 19, 2024
0.5.5 Jul 19, 2024
0.4.7 Jul 19, 2024
0.3.0 Jul 18, 2024
0.1.1 Jun 29, 2024

#368 in Configuration

Download history 35/week @ 2024-07-21 60/week @ 2024-07-28 1/week @ 2024-08-04 10/week @ 2024-09-15 119/week @ 2024-09-29

639 downloads per month

MIT license

52KB
1K SLoC

sproc

Sproc is a simplified process manager that uses a composable configuration file to manage multiple services.

Config

Services are defined in Sproc using a simple services.toml file (passed into Sproc using the pin command).

[services.example]
command = "example --a b"           # required
working_directory = "/home/example" # required

  [services.example.environment]    # optional
  EXAMPLE_ENV_VAR = "42"

You can inherit the services defined in other files using the inherit field. Inherited service files cannot expose an inherit field.

inherit = ["/path/to/other/services.toml", "/path/to/other/other/services.toml"]

[services.example]
# ...

Because these files are not loaded when the main file is pinned, they can be updated and will take effect with services active. When updating the main service file, you'll have to stop all active services and pin again.

You can configure the server key and port in the server field:

[server]
port = 6374
key = "abcd"

# ...

The server is needed to start services that use the restart field. You can make services automatically restart (when spawned from the server) by setting restart to true:

[services.example]
command = "node index.js"
working_directory = "/home/example"
restart = true # this service will ONLY restart when started from the server

It is not recommended that you manually update the pinned services.toml file ($HOME/.config/sproc/services.toml). This file is regularly updated by the CLI and server, and manual changes should ONLY be done through sproc pin.

Usage

Load config file:

sproc pin {path}

Start service(s):

sproc run [names]

Start service(s) in a new task (HTTP server required):

sproc spawn [names]

Start all services:

sproc run-all

Stop service(s):

sproc kill [names]

Stop all services:

sproc kill-all

Get running service info:

sproc info {name}

Get info about all running services:

sproc info-all

Start observation server:

sproc serve

View pinned configuration:

sproc pinned

Merge external services into the source configuration file (source file from pin):

sproc merge {path}

Pull external services into the stored configuration file (after pin):

sproc pull {path}

Install a service from a remote registry:

sproc install {url} {service}

Uninstall a service from the pinned config file:

sproc uninstall {service}

Dependencies

~11–41MB
~629K SLoC