mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-20 04:31:52 +00:00
Merge pull request #1911 from offlinehacker/nixos/couchdb/fix
nixos/couchdb: fix stopping of service, by making it non-forking, a few other improvments
This commit is contained in:
commit
42d7923752
|
@ -1,9 +1,7 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.couchdb;
|
||||
configFile = pkgs.writeText "couchdb.ini"
|
||||
''
|
||||
|
@ -19,10 +17,8 @@ let
|
|||
[log]
|
||||
file = ${cfg.logFile}
|
||||
'';
|
||||
configExtraFile = pkgs.writeText "couchdb-extra.ini" cfg.extraConfig;
|
||||
|
||||
in
|
||||
{
|
||||
in {
|
||||
|
||||
###### interface
|
||||
|
||||
|
@ -64,14 +60,6 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
pidFile = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/run/couchdb/couchdb.pid";
|
||||
description = ''
|
||||
pid file.
|
||||
'';
|
||||
};
|
||||
|
||||
# couchdb options: http://docs.couchdb.org/en/latest/config/index.html
|
||||
|
||||
databaseDir = mkOption {
|
||||
|
@ -153,26 +141,23 @@ in
|
|||
|
||||
preStart =
|
||||
''
|
||||
mkdir -p `dirname ${cfg.pidFile}`;
|
||||
mkdir -p `dirname ${cfg.uriFile}`;
|
||||
mkdir -p `dirname ${cfg.logFile}`;
|
||||
touch ${cfg.logFile};
|
||||
mkdir -p ${cfg.databaseDir};
|
||||
mkdir -p ${cfg.viewIndexDir};
|
||||
chown ${cfg.user}:${cfg.group} `dirname ${cfg.pidFile}`
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
chown ${cfg.user}:${cfg.group} `dirname ${cfg.uriFile}`
|
||||
chown ${cfg.user}:${cfg.group} ${cfg.logFile}
|
||||
chown ${cfg.user}:${cfg.group} ${cfg.databaseDir}
|
||||
chown ${cfg.user}:${cfg.group} ${cfg.viewIndexDir}
|
||||
fi
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
PermissionsStartOnly = true;
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
Type = "forking";
|
||||
ExecStart = "${cfg.package}/bin/couchdb -b -o /dev/null -e /dev/null -p ${cfg.pidFile} -a ${configFile} -a ${configExtraFile}";
|
||||
ExecStop = "${cfg.package}/bin/couchdb -d";
|
||||
ExecStart = "${cfg.package}/bin/couchdb -a ${configFile} -a ${pkgs.writeText "couchdb-extra.ini" cfg.extraConfig}";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue