Add container service for the simple PostgreSQL variant
This commit is contained in:
parent
479afcda26
commit
8639182fa4
|
@ -89,6 +89,15 @@ in
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
simplePostgresql = import ./postgresql/simplepostgresql.nix {
|
||||||
|
inherit runtimeDir;
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
postgresqlConstructorFun = constructors.simplePostgresql;
|
||||||
|
dysnomia = pkgs.dysnomia.override (origArgs: {
|
||||||
|
enablePostgreSQLDatabase = true;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
extendableSupervisord = import ./supervisord/extendable.nix {
|
extendableSupervisord = import ./supervisord/extendable.nix {
|
||||||
inherit libDir;
|
inherit libDir;
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
|
|
|
@ -30,6 +30,7 @@ in
|
||||||
rec {
|
rec {
|
||||||
name = instanceName;
|
name = instanceName;
|
||||||
postgresqlPort = port;
|
postgresqlPort = port;
|
||||||
|
postgresqlRuntimeDir = "${runtimeDir}/${instanceName}";
|
||||||
postgresqlUsername = username;
|
postgresqlUsername = username;
|
||||||
|
|
||||||
inherit pkg;
|
inherit pkg;
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
{postgresqlConstructorFun, lib, dysnomia, runtimeDir}:
|
||||||
|
|
||||||
|
{ instanceSuffix ? "", instanceName ? "postgresql${instanceSuffix}"
|
||||||
|
, containerName ? "postgresql-database${instanceSuffix}"
|
||||||
|
, port ? 5432
|
||||||
|
, authentication ? null
|
||||||
|
, identMap ? null
|
||||||
|
, enableTCPIP ? false
|
||||||
|
, settings ? {}
|
||||||
|
, type ? null
|
||||||
|
, properties ? {}
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
username = instanceName;
|
||||||
|
|
||||||
|
pkg = postgresqlConstructorFun {
|
||||||
|
inherit instanceName instanceSuffix port authentication identMap enableTCPIP settings;
|
||||||
|
postInstall = ''
|
||||||
|
# Add Dysnomia container configuration file for PostgreSQL
|
||||||
|
mkdir -p $out/etc/dysnomia/containers
|
||||||
|
cat > $out/etc/dysnomia/containers/${containerName} <<EOF
|
||||||
|
postgresqlPort=${toString port}
|
||||||
|
postgresqlRuntimeDir=${runtimeDir}/${instanceName}
|
||||||
|
postgresqlUsername=${username}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Copy the Dysnomia module that manages a PostgreSQL database
|
||||||
|
mkdir -p $out/libexec/dysnomia
|
||||||
|
ln -s ${dysnomia}/libexec/dysnomia/postgresql-database $out/libexec/dysnomia
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
rec {
|
||||||
|
name = instanceName;
|
||||||
|
postgresqlPort = port;
|
||||||
|
postgresqlRuntimeDir = "${runtimeDir}/${instanceName}";
|
||||||
|
postgresqlUsername = username;
|
||||||
|
|
||||||
|
inherit pkg;
|
||||||
|
|
||||||
|
providesContainer = containerName;
|
||||||
|
} // lib.optionalAttrs (type != null) {
|
||||||
|
inherit type;
|
||||||
|
} // properties
|
Loading…
Reference in New Issue