Merge pull request #88940 from stigtsp/package/convos-init
convos: init at 4.22
This commit is contained in:
@@ -831,6 +831,7 @@
|
||||
./services/web-apps/atlassian/crowd.nix
|
||||
./services/web-apps/atlassian/jira.nix
|
||||
./services/web-apps/codimd.nix
|
||||
./services/web-apps/convos.nix
|
||||
./services/web-apps/cryptpad.nix
|
||||
./services/web-apps/documize.nix
|
||||
./services/web-apps/dokuwiki.nix
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.convos;
|
||||
in
|
||||
{
|
||||
options.services.convos = {
|
||||
enable = mkEnableOption "Convos";
|
||||
listenPort = mkOption {
|
||||
type = types.port;
|
||||
default = 3000;
|
||||
example = 8080;
|
||||
description = "Port the web interface should listen on";
|
||||
};
|
||||
listenAddress = mkOption {
|
||||
type = types.str;
|
||||
default = "*";
|
||||
example = "127.0.0.1";
|
||||
description = "Address or host the web interface should listen on";
|
||||
};
|
||||
reverseProxy = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Enables reverse proxy support. This will allow Convos to automatically
|
||||
pick up the <literal>X-Forwarded-For</literal> and
|
||||
<literal>X-Request-Base</literal> HTTP headers set in your reverse proxy
|
||||
web server. Note that enabling this option without a reverse proxy in
|
||||
front will be a security issue.
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.convos = {
|
||||
description = "Convos Service";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "networking.target" ];
|
||||
environment = {
|
||||
CONVOS_HOME = "%S/convos";
|
||||
CONVOS_REVERSE_PROXY = if cfg.reverseProxy then "1" else "0";
|
||||
MOJO_LISTEN = "http://${toString cfg.listenAddress}:${toString cfg.listenPort}";
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.convos}/bin/convos daemon";
|
||||
Restart = "on-failure";
|
||||
StateDirectory = "convos";
|
||||
WorkingDirectory = "%S/convos";
|
||||
DynamicUser = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
ProtectHome = true;
|
||||
ProtectClock = true;
|
||||
ProtectHostname = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectControlGroups = true;
|
||||
PrivateDevices = true;
|
||||
PrivateMounts = true;
|
||||
PrivateUsers = true;
|
||||
LockPersonality = true;
|
||||
RestrictRealtime = true;
|
||||
RestrictNamespaces = true;
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6"];
|
||||
SystemCallFilter = "@system-service";
|
||||
SystemCallArchitectures = "native";
|
||||
CapabilityBoundingSet = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -65,6 +65,7 @@ in
|
||||
containers-portforward = handleTest ./containers-portforward.nix {};
|
||||
containers-restart_networking = handleTest ./containers-restart_networking.nix {};
|
||||
containers-tmpfs = handleTest ./containers-tmpfs.nix {};
|
||||
convos = handleTest ./convos.nix {};
|
||||
corerad = handleTest ./corerad.nix {};
|
||||
couchdb = handleTest ./couchdb.nix {};
|
||||
deluge = handleTest ./deluge.nix {};
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import ./make-test-python.nix ({ lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
port = 3333;
|
||||
in
|
||||
{
|
||||
name = "convos";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ sgo ];
|
||||
};
|
||||
|
||||
nodes = {
|
||||
machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
services.convos = {
|
||||
enable = true;
|
||||
listenPort = port;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("convos")
|
||||
machine.wait_for_open_port("${toString port}")
|
||||
machine.succeed("journalctl -u convos | grep -q 'Listening at.*${toString port}'")
|
||||
machine.succeed("curl http://localhost:${toString port}/")
|
||||
'';
|
||||
})
|
||||
Reference in New Issue
Block a user