38 lines
717 B
Nix
38 lines
717 B
Nix
{createManagedProcess, runtimeDir}:
|
|
{port, instanceSuffix ? ""}:
|
|
|
|
let
|
|
webapp = import ../webapp;
|
|
instanceName = "webapp${instanceSuffix}";
|
|
in
|
|
createManagedProcess {
|
|
name = instanceName;
|
|
description = "Simple web application";
|
|
inherit instanceName;
|
|
|
|
# This expression only specifies how to run the webapp in foreground mode
|
|
foregroundProcess = "${webapp}/bin/webapp";
|
|
|
|
environment = {
|
|
PORT = port;
|
|
};
|
|
user = instanceName;
|
|
credentials = {
|
|
groups = {
|
|
"${instanceName}" = {};
|
|
};
|
|
users = {
|
|
"${instanceName}" = {
|
|
group = instanceName;
|
|
description = "Webapp";
|
|
};
|
|
};
|
|
};
|
|
|
|
overrides = {
|
|
sysvinit = {
|
|
runlevels = [ 3 4 5 ];
|
|
};
|
|
};
|
|
}
|