nixos/mastodon: fix start services
This commit is contained in:
parent
ad0739b9e5
commit
2bb8cc27bd
1 changed files with 25 additions and 15 deletions
|
@ -475,7 +475,6 @@ in {
|
||||||
} // cfgService;
|
} // cfgService;
|
||||||
|
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.mastodon-init-db = lib.mkIf cfg.automaticMigrations {
|
systemd.services.mastodon-init-db = lib.mkIf cfg.automaticMigrations {
|
||||||
|
@ -500,16 +499,21 @@ in {
|
||||||
# System Call Filtering
|
# System Call Filtering
|
||||||
SystemCallFilter = [ ("~" + lib.concatStringsSep " " (systemCallsList ++ [ "@resources" ])) "@chown" "pipe" "pipe2" ];
|
SystemCallFilter = [ ("~" + lib.concatStringsSep " " (systemCallsList ++ [ "@resources" ])) "@chown" "pipe" "pipe2" ];
|
||||||
} // cfgService;
|
} // cfgService;
|
||||||
after = [ "mastodon-init-dirs.service" "network.target" ] ++ (if databaseActuallyCreateLocally then [ "postgresql.service" ] else []);
|
after = [ "network.target" "mastodon-init-dirs.service" ]
|
||||||
wantedBy = [ "multi-user.target" ];
|
++ lib.optional databaseActuallyCreateLocally "postgresql.service";
|
||||||
|
requires = [ "mastodon-init-dirs.service" ]
|
||||||
|
++ lib.optional databaseActuallyCreateLocally "postgresql.service";
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.mastodon-streaming = {
|
systemd.services.mastodon-streaming = {
|
||||||
after = [ "network.target" ]
|
after = [ "network.target" "mastodon-init-dirs.service" ]
|
||||||
++ (if databaseActuallyCreateLocally then [ "postgresql.service" ] else [])
|
++ lib.optional databaseActuallyCreateLocally "postgresql.service"
|
||||||
++ (if cfg.automaticMigrations then [ "mastodon-init-db.service" ] else [ "mastodon-init-dirs.service" ]);
|
++ lib.optional cfg.automaticMigrations "mastodon-init-db.service";
|
||||||
description = "Mastodon streaming";
|
requires = [ "mastodon-init-dirs.service" ]
|
||||||
|
++ lib.optional databaseActuallyCreateLocally "postgresql.service"
|
||||||
|
++ lib.optional cfg.automaticMigrations "mastodon-init-db.service";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
description = "Mastodon streaming";
|
||||||
environment = env // (if cfg.enableUnixSocket
|
environment = env // (if cfg.enableUnixSocket
|
||||||
then { SOCKET = "/run/mastodon-streaming/streaming.socket"; }
|
then { SOCKET = "/run/mastodon-streaming/streaming.socket"; }
|
||||||
else { PORT = toString(cfg.streamingPort); }
|
else { PORT = toString(cfg.streamingPort); }
|
||||||
|
@ -529,11 +533,14 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.mastodon-web = {
|
systemd.services.mastodon-web = {
|
||||||
after = [ "network.target" ]
|
after = [ "network.target" "mastodon-init-dirs.service" ]
|
||||||
++ (if databaseActuallyCreateLocally then [ "postgresql.service" ] else [])
|
++ lib.optional databaseActuallyCreateLocally "postgresql.service"
|
||||||
++ (if cfg.automaticMigrations then [ "mastodon-init-db.service" ] else [ "mastodon-init-dirs.service" ]);
|
++ lib.optional cfg.automaticMigrations "mastodon-init-db.service";
|
||||||
description = "Mastodon web";
|
requires = [ "mastodon-init-dirs.service" ]
|
||||||
|
++ lib.optional databaseActuallyCreateLocally "postgresql.service"
|
||||||
|
++ lib.optional cfg.automaticMigrations "mastodon-init-db.service";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
description = "Mastodon web";
|
||||||
environment = env // (if cfg.enableUnixSocket
|
environment = env // (if cfg.enableUnixSocket
|
||||||
then { SOCKET = "/run/mastodon-web/web.socket"; }
|
then { SOCKET = "/run/mastodon-web/web.socket"; }
|
||||||
else { PORT = toString(cfg.webPort); }
|
else { PORT = toString(cfg.webPort); }
|
||||||
|
@ -554,11 +561,14 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.mastodon-sidekiq = {
|
systemd.services.mastodon-sidekiq = {
|
||||||
after = [ "network.target" ]
|
after = [ "network.target" "mastodon-init-dirs.service" ]
|
||||||
++ (if databaseActuallyCreateLocally then [ "postgresql.service" ] else [])
|
++ lib.optional databaseActuallyCreateLocally "postgresql.service"
|
||||||
++ (if cfg.automaticMigrations then [ "mastodon-init-db.service" ] else [ "mastodon-init-dirs.service" ]);
|
++ lib.optional cfg.automaticMigrations "mastodon-init-db.service";
|
||||||
description = "Mastodon sidekiq";
|
requires = [ "mastodon-init-dirs.service" ]
|
||||||
|
++ lib.optional databaseActuallyCreateLocally "postgresql.service"
|
||||||
|
++ lib.optional cfg.automaticMigrations "mastodon-init-db.service";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
description = "Mastodon sidekiq";
|
||||||
environment = env // {
|
environment = env // {
|
||||||
PORT = toString(cfg.sidekiqPort);
|
PORT = toString(cfg.sidekiqPort);
|
||||||
DB_POOL = toString cfg.sidekiqThreads;
|
DB_POOL = toString cfg.sidekiqThreads;
|
||||||
|
|
Loading…
Reference in a new issue