Re-organize constructor functions, separate processes models

This commit is contained in:
Sander van der Burg 2021-02-15 21:30:28 +01:00 committed by Sander van der Burg
parent f088f8b2bb
commit 1cb54e1743
34 changed files with 108 additions and 87 deletions

View File

@ -12,7 +12,7 @@
let
ids = if builtins.pathExists ./ids.nix then (import ./ids.nix).ids else {};
constructors = import ./constructors.nix {
constructors = import ../services-agnostic/constructors.nix {
inherit pkgs stateDir runtimeDir logDir tmpDir cacheDir forceDisableUserChange processManager ids;
};
in

View File

@ -16,7 +16,7 @@ let
};
in
{
simpleWebappApache = import ./simple-webapp-apache.nix {
simpleWebappApache = import ./apache/simple-webapp-apache.nix {
apacheConstructorFun = constructors.simpleWebappApache;
dysnomia = pkgs.dysnomia.override (origArgs: {
enableApacheWebApplication = true;
@ -24,7 +24,7 @@ in
inherit forceDisableUserChange;
};
simpleAppservingTomcat = import ./simple-appserving-tomcat.nix {
simpleAppservingTomcat = import ./apache-tomcat/simple-appserving-tomcat.nix {
inherit stateDir;
tomcatConstructorFun = constructors.simpleAppservingTomcat;
dysnomia = pkgs.dysnomia.override (origArgs: {
@ -32,23 +32,14 @@ in
});
};
mysql = import ./mysql.nix {
inherit runtimeDir;
mysqlConstructorFun = constructors.mysql;
simpleInfluxdb = import ./influxdb/simpleinfluxdb.nix {
influxdbConstructorFun = constructors.simpleInfluxdb;
dysnomia = pkgs.dysnomia.override (origArgs: {
enableMySQLDatabase = true;
enableInfluxDatabase = true;
});
};
postgresql = import ./postgresql.nix {
inherit runtimeDir;
postgresqlConstructorFun = constructors.postgresql;
dysnomia = pkgs.dysnomia.override (origArgs: {
enablePostgreSQLDatabase = true;
});
};
simpleMongodb = import ./simplemongodb.nix {
simpleMongodb = import ./mongodb/simplemongodb.nix {
inherit (pkgs) stdenv;
mongodbConstructorFun = constructors.simpleMongodb;
dysnomia = pkgs.dysnomia.override (origArgs: {
@ -56,7 +47,23 @@ in
});
};
extendableSupervisord = import ./extendable-supervisord.nix {
mysql = import ./mysql {
inherit runtimeDir;
mysqlConstructorFun = constructors.mysql;
dysnomia = pkgs.dysnomia.override (origArgs: {
enableMySQLDatabase = true;
});
};
postgresql = import ./postgresql {
inherit runtimeDir;
postgresqlConstructorFun = constructors.postgresql;
dysnomia = pkgs.dysnomia.override (origArgs: {
enablePostgreSQLDatabase = true;
});
};
extendableSupervisord = import ./supervisord/extendable-supervisord.nix {
inherit stateDir;
inherit (pkgs) stdenv;
supervisordConstructorFun = constructors.extendableSupervisord;
@ -65,17 +72,10 @@ in
});
};
svnserve = import ./svnserve.nix {
svnserve = import ./svnserve {
svnserveConstructorFun = constructors.svnserve;
dysnomia = pkgs.dysnomia.override (origArgs: {
enableSubversionRepository = true;
});
};
simpleInfluxdb = import ./simpleinfluxdb.nix {
influxdbConstructorFun = constructors.simpleInfluxdb;
dysnomia = pkgs.dysnomia.override (origArgs: {
enableInfluxDatabase = true;
});
};
}

View File

@ -22,7 +22,7 @@ let
'';
};
in
import ./tomcat.nix {
import ./default.nix {
inherit createManagedProcess stdenv tomcat jre stateDir runtimeDir tmpDir forceDisableUserChange commonLibs;
} {
inherit tomcatConfigFiles instanceName postInstall;

View File

@ -1,5 +1,17 @@
{createManagedProcess, stdenv, runCommand, apacheHttpd, php, writeTextFile, logDir, runtimeDir, cacheDir, forceDisableUserChange}:
{instanceSuffix ? "", instanceName ? "httpd${instanceSuffix}", port ? 80, modules ? [], serverName ? "localhost", serverAdmin, documentRoot ? ./webapp, enablePHP ? false, enableCGI ? false, extraConfig ? "", postInstall ? ""}:
{ instanceSuffix ? ""
, instanceName ? "httpd${instanceSuffix}"
, port ? 80
, modules ? []
, serverName ? "localhost"
, serverAdmin
, documentRoot ? ../http-server-common/webapp
, enablePHP ? false
, enableCGI ? false
, extraConfig ? ""
, postInstall ? ""
}:
let
user = instanceName;
@ -42,7 +54,7 @@ let
cat ${php.phpIni} > $out
'';
in
import ./apache.nix {
import ./default.nix {
inherit createManagedProcess apacheHttpd cacheDir;
} {
inherit instanceName postInstall;

View File

@ -16,103 +16,103 @@ let
};
in
{
apache = import ./apache.nix {
apache = import ./apache {
inherit createManagedProcess cacheDir;
inherit (pkgs) apacheHttpd;
};
simpleWebappApache = import ./simple-webapp-apache.nix {
simpleWebappApache = import ./apache/simple-webapp-apache.nix {
inherit createManagedProcess logDir cacheDir runtimeDir forceDisableUserChange;
inherit (pkgs) stdenv runCommand apacheHttpd php writeTextFile;
};
mysql = import ./mysql.nix {
inherit createManagedProcess stateDir runtimeDir forceDisableUserChange;
inherit (pkgs) stdenv mysql;
};
postgresql = import ./postgresql.nix {
inherit createManagedProcess stateDir runtimeDir forceDisableUserChange;
inherit (pkgs) stdenv postgresql su;
};
tomcat = import ./tomcat.nix {
tomcat = import ./apache-tomcat {
inherit createManagedProcess stateDir runtimeDir tmpDir forceDisableUserChange;
inherit (pkgs) stdenv;
jre = pkgs.jre8;
tomcat = pkgs.tomcat9;
};
simpleAppservingTomcat = import ./simple-appserving-tomcat.nix {
simpleAppservingTomcat = import ./apache-tomcat/simple-appserving-tomcat.nix {
inherit createManagedProcess stateDir runtimeDir tmpDir forceDisableUserChange;
inherit (pkgs) stdenv;
jre = pkgs.jre8;
tomcat = pkgs.tomcat9;
};
nginx = import ./nginx.nix {
inherit createManagedProcess stateDir runtimeDir cacheDir forceDisableUserChange;
inherit (pkgs) stdenv nginx;
docker = import ./docker {
inherit createManagedProcess;
inherit (pkgs) docker kmod;
};
nginxReverseProxyHostBased = import ./nginx-reverse-proxy-hostbased.nix {
inherit createManagedProcess stateDir runtimeDir cacheDir forceDisableUserChange;
inherit (pkgs) stdenv writeTextFile nginx;
influxdb = import ./influxdb {
inherit createManagedProcess stateDir;
inherit (pkgs) influxdb;
};
nginxReverseProxyPathBased = import ./nginx-reverse-proxy-pathbased.nix {
inherit createManagedProcess stateDir runtimeDir cacheDir forceDisableUserChange;
inherit (pkgs) stdenv writeTextFile nginx;
simpleInfluxdb = import ./influxdb/simpleinfluxdb.nix {
inherit createManagedProcess stateDir;
inherit (pkgs) influxdb writeTextFile;
};
mongodb = import ./mongodb.nix {
mongodb = import ./mongodb {
inherit createManagedProcess runtimeDir;
inherit (pkgs) mongodb;
};
simpleMongodb = import ./simplemongodb.nix {
simpleMongodb = import ./mongodb/simplemongodb.nix {
inherit createManagedProcess runtimeDir stateDir forceDisableUserChange;
inherit (pkgs) stdenv mongodb writeTextFile;
};
supervisord = import ./supervisord.nix {
mysql = import ./mysql {
inherit createManagedProcess stateDir runtimeDir forceDisableUserChange;
inherit (pkgs) stdenv mysql;
};
nginx = import ./nginx {
inherit createManagedProcess stateDir runtimeDir cacheDir forceDisableUserChange;
inherit (pkgs) stdenv nginx;
};
nginxReverseProxyHostBased = import ./nginx/nginx-reverse-proxy-hostbased.nix {
inherit createManagedProcess stateDir runtimeDir cacheDir forceDisableUserChange;
inherit (pkgs) stdenv writeTextFile nginx;
};
nginxReverseProxyPathBased = import ./nginx/nginx-reverse-proxy-pathbased.nix {
inherit createManagedProcess stateDir runtimeDir cacheDir forceDisableUserChange;
inherit (pkgs) stdenv writeTextFile nginx;
};
openssh = import ./openssh {
inherit createManagedProcess stateDir runtimeDir tmpDir forceDisableUserChange;
inherit (pkgs) writeTextFile openssh;
};
postgresql = import ./postgresql {
inherit createManagedProcess stateDir runtimeDir forceDisableUserChange;
inherit (pkgs) stdenv postgresql su;
};
s6-svscan = import ./s6-svscan {
inherit createManagedProcess runtimeDir;
inherit (pkgs) s6;
};
supervisord = import ./supervisord {
inherit createManagedProcess runtimeDir logDir;
inherit (pkgs.pythonPackages) supervisor;
};
extendableSupervisord = import ./extendable-supervisord.nix {
extendableSupervisord = import ./supervisord/extendable-supervisord.nix {
inherit createManagedProcess stateDir runtimeDir logDir;
inherit (pkgs) writeTextFile;
inherit (pkgs.pythonPackages) supervisor;
};
svnserve = import ./svnserve.nix {
svnserve = import ./svnserve {
inherit createManagedProcess runtimeDir forceDisableUserChange;
inherit (pkgs) stdenv subversion;
};
simpleInfluxdb = import ./simpleinfluxdb.nix {
inherit createManagedProcess stateDir;
inherit (pkgs) influxdb writeTextFile;
};
influxdb = import ./influxdb.nix {
inherit createManagedProcess stateDir;
inherit (pkgs) influxdb;
};
sshd = import ./sshd.nix {
inherit createManagedProcess stateDir runtimeDir tmpDir forceDisableUserChange;
inherit (pkgs) writeTextFile openssh;
};
docker = import ./docker.nix {
inherit createManagedProcess;
inherit (pkgs) docker kmod;
};
s6-svscan = import ./s6-svscan.nix {
inherit createManagedProcess runtimeDir;
inherit (pkgs) s6;
};
}

View File

@ -1,5 +1,14 @@
{createManagedProcess, influxdb, writeTextFile, stateDir}:
{instanceSuffix ? "", instanceName ? "influxdb${instanceSuffix}", rpcBindIP ? "127.0.0.1", rpcPort ? 8088, httpBindIP ? "", httpPort ? 8086, extraConfig ? "", postInstall ? ""}:
{ instanceSuffix ? ""
, instanceName ? "influxdb${instanceSuffix}"
, rpcBindIP ? "127.0.0.1"
, rpcPort ? 8088
, httpBindIP ? ""
, httpPort ? 8086
, extraConfig ? ""
, postInstall ? ""
}:
let
influxdbStateDir = "${stateDir}/lib/${instanceName}";
@ -24,7 +33,7 @@ let
'';
};
in
import ./influxdb.nix {
import ./default.nix {
inherit createManagedProcess influxdb stateDir;
} {
inherit instanceName configFile postInstall;

View File

@ -6,7 +6,7 @@ let
user = instanceName;
group = instanceName;
in
import ./mongodb.nix {
import ./default.nix {
inherit createManagedProcess mongodb runtimeDir;
} {
inherit instanceName postInstall;

View File

@ -10,7 +10,7 @@ let
nginxLogDir = "${nginxStateDir}/logs";
nginxCacheDir = "${cacheDir}/${instanceName}";
in
import ./nginx.nix {
import ./default.nix {
inherit createManagedProcess stdenv nginx stateDir forceDisableUserChange runtimeDir cacheDir;
} {
inherit instanceName;

View File

@ -12,7 +12,7 @@ let
dependencies = webapps ++ (builtins.attrValues interDependencies);
in
import ./nginx.nix {
import ./default.nix {
inherit createManagedProcess stdenv nginx stateDir forceDisableUserChange runtimeDir cacheDir;
} {
inherit instanceName;

View File

@ -4,7 +4,7 @@
let
includeDir = "${stateDir}/lib/${instanceName}/conf.d";
in
import ./supervisord.nix {
import ./default.nix {
inherit createManagedProcess supervisor logDir runtimeDir;
} {
inherit instanceName postInstall;