mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-19 02:44:17 +03:00
* Postgres job: start postgres directly, don't use the old control
script from the services tree. svn path=/nixos/trunk/; revision=10722
This commit is contained in:
parent
b98cb9a770
commit
8a1d362447
@ -1693,6 +1693,17 @@
|
||||
here is an interface...
|
||||
";
|
||||
};
|
||||
authentication = mkOption {
|
||||
default = ''
|
||||
# Generated file; do not edit!
|
||||
local all all ident sameuser
|
||||
host all all 127.0.0.1/32 md5
|
||||
host all all ::1/128 md5
|
||||
'';
|
||||
description = "
|
||||
Hosts (except localhost), who you allow to connect.
|
||||
";
|
||||
};
|
||||
allowedHosts = mkOption {
|
||||
default = [];
|
||||
description = "
|
||||
|
@ -177,8 +177,6 @@ let
|
||||
++ optional config.services.postgresql.enable
|
||||
(import ../upstart-jobs/postgresql.nix {
|
||||
inherit config pkgs;
|
||||
startDependency = if config.services.gw6c.enable then
|
||||
"gw6c" else "network-interfaces";
|
||||
})
|
||||
|
||||
# EJabberd service
|
||||
|
@ -1,30 +1,48 @@
|
||||
args: with args;
|
||||
{pkgs, config}:
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.postgresql;
|
||||
postgresqlService = import ../services/postgresql {
|
||||
inherit (pkgs) stdenv postgresql su;
|
||||
inherit (cfg) port logDir dataDir
|
||||
subServices allowedHosts
|
||||
authMethod;
|
||||
serverUser = "postgres";
|
||||
};
|
||||
cfg = config.services.postgresql;
|
||||
|
||||
postgresql = pkgs.postgresql;
|
||||
|
||||
startDependency = if config.services.gw6c.enable then
|
||||
"gw6c" else "network-interfaces";
|
||||
|
||||
run = "${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh postgres";
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
name = "postgresql";
|
||||
users = [ {
|
||||
name = "postgres";
|
||||
description = "PostgreSQL server user";
|
||||
} ];
|
||||
groups = [{name = "postgres";}];
|
||||
job = "
|
||||
description \"PostgreSQL server\"
|
||||
name = "postgresql";
|
||||
|
||||
start on ${startDependency}/started
|
||||
stop on shutdown
|
||||
users = [
|
||||
{ name = "postgres";
|
||||
description = "PostgreSQL server user";
|
||||
}
|
||||
];
|
||||
|
||||
respawn ${postgresqlService}/bin/control start
|
||||
";
|
||||
groups = [
|
||||
{ name = "postgres"; }
|
||||
];
|
||||
|
||||
extraPath = [postgresql];
|
||||
|
||||
job = ''
|
||||
description "PostgreSQL server"
|
||||
|
||||
start on ${startDependency}/started
|
||||
stop on shutdown
|
||||
|
||||
start script
|
||||
if ! test -e ${cfg.dataDir}; then
|
||||
mkdir -m 0700 -p ${cfg.dataDir}
|
||||
chown -R postgres ${cfg.dataDir}
|
||||
${run} -c '${postgresql}/bin/initdb -D ${cfg.dataDir} -U root'
|
||||
fi
|
||||
cp -f ${pkgs.writeText "pg_hba.conf" cfg.authentication} ${cfg.dataDir}/pg_hba.conf
|
||||
end script
|
||||
|
||||
respawn ${run} -c '${postgresql}/bin/postgres -D ${cfg.dataDir}'
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user