~sumner/nixos-configuration

420e4d0e5cfefb9f912247e607ced9d7c0fade40 — Sumner Evans a month ago adb1c85
synapse: create matrix-synapse.target
M modules/services/matrix/synapse/cleanup-synapse.nix => modules/services/matrix/synapse/cleanup-synapse.nix +2 -2
@@ 115,7 115,7 @@ let

  reindexAndVaccum = writeShellScriptBin "reindex-and-vaccum" ''
    set -xe
    systemctl stop matrix-synapse.service
    systemctl stop matrix-synapse.target

    echo 'REINDEX (VERBOSE) DATABASE "matrix-synapse"' |
      /run/wrappers/bin/sudo -u postgres ${postgresql}/bin/psql -d matrix-synapse


@@ 123,7 123,7 @@ let
    echo "VACUUM FULL VERBOSE" |
      /run/wrappers/bin/sudo -u postgres ${postgresql}/bin/psql -d matrix-synapse

    systemctl start matrix-synapse.service
    systemctl start matrix-synapse.target
  '';

  cleanupSynapseScript = writeShellScriptBin "cleanup-synapse" ''

M modules/services/matrix/synapse/default.nix => modules/services/matrix/synapse/default.nix +10 -3
@@ 34,7 34,8 @@ let

  mkSynapseWorkerService = config: recursiveUpdate config {
    after = [ "matrix-synapse.service" ];
    wantedBy = [ "multi-user.target" ];
    partOf = [ "matrix-synapse.target" ];
    wantedBy = [ "matrix-synapse.target" ];
    serviceConfig = {
      Type = "notify";
      User = "matrix-synapse";


@@ 187,11 188,17 @@ in
      gid = config.ids.gids.matrix-synapse;
    };

    systemd.targets.matrix-synapse = {
      description = "Synapse processes";
      after = [ "network.target" "postgresql.service" ];
      wantedBy = [ "multi-user.target" ];
    };

    # Run the main Synapse process
    systemd.services.matrix-synapse = {
      description = "Synapse Matrix homeserver";
      after = [ "network.target" "postgresql.service" ];
      wantedBy = [ "multi-user.target" ];
      partOf = [ "matrix-synapse.target" ];
      wantedBy = [ "matrix-synapse.target" ];
      preStart = ''
        ${package}/bin/homeserver \
          --config-path ${sharedConfigFile} \