nixos/nextcloud: fix postgresql/redis test
This commit is contained in:
parent
a8b2e302c6
commit
5e8ae589a4
|
@ -27,7 +27,7 @@ in {
|
||||||
dbtype = "pgsql";
|
dbtype = "pgsql";
|
||||||
dbname = "nextcloud";
|
dbname = "nextcloud";
|
||||||
dbuser = "nextcloud";
|
dbuser = "nextcloud";
|
||||||
dbhost = "/run/postgresql";
|
dbhost = "localhost:5432";
|
||||||
inherit adminuser;
|
inherit adminuser;
|
||||||
adminpassFile = toString (pkgs.writeText "admin-pass-file" ''
|
adminpassFile = toString (pkgs.writeText "admin-pass-file" ''
|
||||||
${adminpass}
|
${adminpass}
|
||||||
|
@ -36,49 +36,16 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
services.redis = {
|
services.redis = {
|
||||||
unixSocket = "/var/run/redis/redis.sock";
|
|
||||||
enable = true;
|
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= {
|
systemd.services.nextcloud-setup= {
|
||||||
requires = ["postgresql.service"];
|
requires = ["postgresql.service"];
|
||||||
after = [
|
after = [
|
||||||
"postgresql.service"
|
"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 = {
|
services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
ensureDatabases = [ "nextcloud" ];
|
ensureDatabases = [ "nextcloud" ];
|
||||||
|
@ -94,7 +61,7 @@ in {
|
||||||
testScript = let
|
testScript = let
|
||||||
configureRedis = pkgs.writeScript "configure-redis" ''
|
configureRedis = pkgs.writeScript "configure-redis" ''
|
||||||
#!${pkgs.stdenv.shell}
|
#!${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 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.local --value '\OC\Memcache\Redis' --type string
|
||||||
nextcloud-occ config:system:set memcache.locking --value '\OC\Memcache\Redis' --type string
|
nextcloud-occ config:system:set memcache.locking --value '\OC\Memcache\Redis' --type string
|
||||||
|
|
Loading…
Reference in New Issue