Skip to content

Commit

Permalink
Merge pull request #308291 from Ma27/nc-update-db
Browse files Browse the repository at this point in the history
nixos/nextcloud: add nextcloud-update-db.service, nextcloud-cron isn't oneshot
  • Loading branch information
onny authored May 8, 2024
2 parents fe433eb + 5ef467d commit 4a451cb
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion nixos/modules/services/web-apps/nextcloud.nix
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ in {

in {
wantedBy = [ "multi-user.target" ];
wants = [ "nextcloud-update-db.service" ];
before = [ "phpfpm-nextcloud.service" ];
after = optional mysqlLocal "mysql.service" ++ optional pgsqlLocal "postgresql.service";
requires = optional mysqlLocal "mysql.service" ++ optional pgsqlLocal "postgresql.service";
Expand Down Expand Up @@ -997,7 +998,7 @@ in {
after = [ "nextcloud-setup.service" ];
environment.NEXTCLOUD_CONFIG_DIR = "${datadir}/config";
serviceConfig = {
Type = "oneshot";
Type = "exec";
User = "nextcloud";
ExecCondition = "${lib.getExe phpPackage} -f ${webroot}/occ status -e";
ExecStart = "${lib.getExe phpPackage} -f ${webroot}/cron.php";
Expand All @@ -1013,6 +1014,20 @@ in {
};
startAt = cfg.autoUpdateApps.startAt;
};
nextcloud-update-db = {
after = [ "nextcloud-setup.service" ];
environment.NEXTCLOUD_CONFIG_DIR = "${datadir}/config";
script = ''
${occ}/bin/nextcloud-occ db:add-missing-columns
${occ}/bin/nextcloud-occ db:add-missing-indices
${occ}/bin/nextcloud-occ db:add-missing-primary-keys
'';
serviceConfig = {
Type = "exec";
User = "nextcloud";
ExecCondition = "${lib.getExe phpPackage} -f ${webroot}/occ status -e";
};
};
};

services.phpfpm = {
Expand Down

0 comments on commit 4a451cb

Please sign in to comment.