mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
nixos/nextcloud: fix postgresql/redis test
This commit is contained in:
parent
a8b2e302c6
commit
5e8ae589a4
1 changed files with 2 additions and 35 deletions
|
@ -27,7 +27,7 @@ in {
|
|||
dbtype = "pgsql";
|
||||
dbname = "nextcloud";
|
||||
dbuser = "nextcloud";
|
||||
dbhost = "/run/postgresql";
|
||||
dbhost = "localhost:5432";
|
||||
inherit adminuser;
|
||||
adminpassFile = toString (pkgs.writeText "admin-pass-file" ''
|
||||
${adminpass}
|
||||
|
@ -36,49 +36,16 @@ in {
|
|||
};
|
||||
|
||||
services.redis = {
|
||||
unixSocket = "/var/run/redis/redis.sock";
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
unixsocketperm 770
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services.redis = {
|
||||
preStart = ''
|
||||
mkdir -p /var/run/redis
|
||||
chown ${config.services.redis.user}:${config.services.nginx.group} /var/run/redis
|
||||
'';
|
||||
serviceConfig.PermissionsStartOnly = true;
|
||||
};
|
||||
|
||||
systemd.services.nextcloud-setup= {
|
||||
requires = ["postgresql.service"];
|
||||
after = [
|
||||
"postgresql.service"
|
||||
"chown-redis-socket.service"
|
||||
];
|
||||
};
|
||||
|
||||
# At the time of writing, redis creates its socket with the "nobody"
|
||||
# group. I figure this is slightly less bad than making the socket world
|
||||
# readable.
|
||||
systemd.services.chown-redis-socket = {
|
||||
enable = true;
|
||||
script = ''
|
||||
until ${pkgs.redis}/bin/redis-cli ping; do
|
||||
echo "waiting for redis..."
|
||||
sleep 1
|
||||
done
|
||||
chown ${config.services.redis.user}:${config.services.nginx.group} /var/run/redis/redis.sock
|
||||
'';
|
||||
after = [ "redis.service" ];
|
||||
requires = [ "redis.service" ];
|
||||
wantedBy = [ "redis.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
};
|
||||
};
|
||||
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [ "nextcloud" ];
|
||||
|
@ -94,7 +61,7 @@ in {
|
|||
testScript = let
|
||||
configureRedis = pkgs.writeScript "configure-redis" ''
|
||||
#!${pkgs.stdenv.shell}
|
||||
nextcloud-occ config:system:set redis 'host' --value '/var/run/redis/redis.sock' --type string
|
||||
nextcloud-occ config:system:set redis 'host' --value 'localhost:6379' --type string
|
||||
nextcloud-occ config:system:set redis 'port' --value 0 --type integer
|
||||
nextcloud-occ config:system:set memcache.local --value '\OC\Memcache\Redis' --type string
|
||||
nextcloud-occ config:system:set memcache.locking --value '\OC\Memcache\Redis' --type string
|
||||
|
|
Loading…
Reference in a new issue