A reverse proxy and load balancer for ambiorix applications (and shiny).
go get github.com/devOpifex/belgic
or
go install github.com/devOpifex/belgic@latest
or download one of the available binaries.
Belgic requires a very simple configuration file.
{
"path": "/belgic",
"port": "8080",
"backends": "max",
"attempts": 3
}
To create it you can use the config
command and pass it the full
path to the directory where you want the configuration file
to be created.
./belgic config -p "path/to/directory"
path
: the path containing the ambiorix application you want to serve. It assumes the application is in anapp.R
file.port
: port on which the apps should be served.backends
: number of background applications to run in the background. Defaults to the maximum number of cores available on the machine.attempts
: number of times to try and revive a backend if it dies.
Add the BELGIC_CONFIG
environment variable to point to the configuration
file you just created.
Voilà, all set, just launch the server.
belgic start
# ./belgic start
The server will launch multiple applications in the background.
The number of applications running in the background is determined
by the backends
variable defined in the configuration file.
Either set this option to the number of applications you want to
run in the background as a string,
e.g.: set it to "4"
not 4
.
If set to "max"
if will run one application for each core
available on the machine.