nixpkgs/nixos/modules/services/web-apps
Maximilian Bosch e7533df80f
nixos/mastodon: stop mastodon-init-db.service if check for seeded DB fails
The postgresql runs on a different node than my mastodon itself. Sometimes when
rebooting the entire host it can happen that mastodon gets started
before the DB[1] is up. In that case `mastodon-init-db.service` ran
through with the following log output:

    2024-03-07 15:30:56.856
    Migrating database (this might be a noop)
    2024-03-07 15:30:56.856
    /nix/store/xzm7www0qb7jg5zrgg7knynckx5yhki9-unit-script-mastodon-init-db-start/bin/mastodon-init-db-start: line 9: [: -eq: unary operator expected

It seems wrong to me to have this unit pass if the DB isn't even up,
especially with such an error.

This patch now checks if the exit code of the psql check was non-zero
and fails the entire unit. A retry can be implemented e.g. with
Restart/RestartSec then (which is more elegant than adding a while/sleep
loop anyways) like this:

    systemd.services.mastodon-init-db = {
      serviceConfig = {
        Restart = "on-failure";
        RestartSec = "5s";
        RestartMode = "direct";
        RemainAfterExit = true;
      };
      unitConfig = {
        StartLimitBurst = 5;
        StartLimitIntervalSec = "60";
      };
    };

Also using `-t --csv` now to not render the column name and to not
render a table so we don't need to rely on the format of psql (and parse
it with `sed(1)`).

[1] I added a script that blocks until postgres is there in the meantime
    though.
2024-03-22 17:51:20 +01:00
..
atlassian treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
icingaweb2
kasmweb kasmweb: init at 1.12.0 2023-01-09 07:19:54 +02:00
akkoma.md nixos/manual: fix manpage links 2023-02-21 18:26:39 +01:00
akkoma.nix nixos: fix a bunch of services missing dep on network-online.target 2024-01-19 00:11:34 -08:00
alps.nix nixos: fix a bunch of services missing dep on network-online.target 2024-01-19 00:11:34 -08:00
anuko-time-tracker.nix treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
audiobookshelf.nix audiobookshelf: init module 2023-09-29 22:01:45 +02:00
bookstack.nix treewide: use new tmpfiles api 2024-01-24 05:13:17 +01:00
c2fmzq-server.md nixos/c2fmzq-server: init module 2023-10-26 17:27:51 +02:00
c2fmzq-server.nix nixos: fix remaining services for network-online dep fix 2024-01-19 00:11:34 -08:00
calibre-web.nix nixos/calibre-web: add package and enableKepubify options 2023-08-27 15:25:17 +02:00
changedetection-io.nix changedetection-io: remove podman.defaultNetwork.dnsname.enable 2023-01-11 00:32:59 +01:00
chatgpt-retrieval-plugin.nix chatgpt-retrieval-plugin: init module 2023-04-02 09:26:35 -04:00
cloudlog.nix nixos: fix bad mkEnableOption descriptions 2023-10-20 16:22:40 +01:00
code-server.nix nixos: fix a bunch of services missing dep on network-online.target 2024-01-19 00:11:34 -08:00
coder.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
convos.nix
dex.nix nixos/dex: fix start with latest systemd update 2023-10-13 00:34:08 +02:00
discourse.md nixos/discourse: convert manual chapter to MD 2023-01-10 10:31:57 +01:00
discourse.nix treewide: fix redirected and broken URLs 2023-11-11 10:49:01 +01:00
documize.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
dokuwiki.nix nixos/dokuwiki: Remove old migration warnings 2024-01-09 20:51:12 +01:00
dolibarr.nix treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
engelsystem.nix engelsystem: cleanup 2024-03-18 17:08:01 +01:00
ethercalc.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
fluidd.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
freshrss.nix treewide: use new tmpfiles api 2024-01-24 05:13:17 +01:00
galene.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
gerrit.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
gotify-server.nix
gotosocial.md nixos/gotosocial: init 2023-06-05 09:07:34 +03:00
gotosocial.nix nixos/gotosocial: add blakesmith as a maintainer 2024-03-12 21:13:22 -05:00
grocy.md nixos/grocy: convert manual chapter to MD 2023-01-10 10:31:58 +01:00
grocy.nix treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
guacamole-client.nix treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
guacamole-server.nix treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
healthchecks.nix nixos: fix a bunch of services missing dep on network-online.target 2024-01-19 00:11:34 -08:00
hedgedoc.nix hedgedoc: move files to share/hedeodc in the package 2024-02-06 19:26:21 +01:00
hledger-web.nix nixos: fix bad mkEnableOption descriptions 2023-10-20 16:22:40 +01:00
honk.md nixos/modules/honk: init 2023-08-27 23:43:40 +02:00
honk.nix treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
invidious.nix nixos/invidious: Additional fix for user message on 24.05 changes 2024-01-03 10:17:06 -05:00
invoiceplane.nix nixos/invoiceplane: add nginx as a webserver option for invoiceplane 2024-01-17 05:09:34 +01:00
isso.nix nixos: fix bad mkEnableOption descriptions 2023-10-20 16:22:40 +01:00
jirafeau.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
jitsi-meet.md nixos/jitsi-meet: convert manual chapter to MD 2023-01-10 10:31:58 +01:00
jitsi-meet.nix nixos/jitsi-meet: Integrate jigasi 2023-12-07 13:36:53 +00:00
kavita.nix treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
keycloak.md nixos/keycloak: convert manual chapter to MD 2023-01-10 10:31:58 +01:00
keycloak.nix Merge pull request #267906 from talyz/keycloak-hostname-url 2023-12-07 12:07:49 +01:00
komga.nix nixos/komga: use lib.getExe 2024-03-02 13:56:20 +13:00
lanraragi.nix treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
lemmy.md
lemmy.nix lemmy: fix nginx config generation 2024-01-28 19:15:02 +03:00
limesurvey.nix limesurvey: mark as broken 2023-05-16 19:18:22 +02:00
mainsail.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
mastodon.nix nixos/mastodon: stop mastodon-init-db.service if check for seeded DB fails 2024-03-22 17:51:20 +01:00
matomo.md nixos/matomo: fix typo 2023-05-09 18:02:17 +04:00
matomo.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
mattermost.nix treewide: use new tmpfiles api 2024-01-24 05:13:17 +01:00
mealie.nix nixos/mealie: init module 2024-02-23 07:15:24 +01:00
mediawiki.nix Merge pull request #261702 from h7x4/replace-mkoption-with-mkpackageoption 2023-11-30 02:49:30 +01:00
meme-bingo-web.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
microbin.nix nixos/microbin: add module 2023-10-16 21:38:20 +02:00
miniflux.nix nixos/tests/miniflux: add test for external database 2024-03-04 09:07:21 +01:00
mobilizon.nix treewide: fix services.postgresql.extraPlugins usage 2023-12-08 14:58:18 +01:00
monica.nix nixos: fix typos 2023-05-19 22:31:04 -04:00
moodle.nix treewide: use new tmpfiles api 2024-01-24 05:13:17 +01:00
netbox.nix netbox_3_5: remove 2024-01-22 16:31:45 +01:00
nextcloud-notify_push.nix nixos/nextcloud: Rename extraOptions to settings 2024-01-26 14:22:49 +01:00
nextcloud.md nixos/nextcloud: Rename extraOptions to settings 2024-01-26 14:22:49 +01:00
nextcloud.nix nixos/nextcloud: remove opcache.enable_cli=1 2024-03-14 18:36:11 +02:00
nexus.nix nixos/nexus: use mkPackageOption, cleanup 2023-07-19 13:13:28 +02:00
nifi.nix treewide: use new tmpfiles api 2024-01-24 05:13:17 +01:00
node-red.nix nixos/node-red: fix cfg.package default value documentation 2023-12-16 21:03:18 +01:00
onlyoffice.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
openvscode-server.nix nixos: fix a bunch of services missing dep on network-online.target 2024-01-19 00:11:34 -08:00
openwebrx.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
outline.nix outline: 0.73.1 -> 0.74.0 (#275007) 2024-01-15 02:31:14 +04:00
peering-manager.nix nixos: fix a bunch of services missing dep on network-online.target 2024-01-19 00:11:34 -08:00
peertube.nix peertube: Clarify option descriptions of listenHttp, listenWeb, enableWebHttps 2023-11-22 21:15:36 +01:00
pgpkeyserver-lite.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
photoprism.nix Merge pull request #278698 from bachp/photoprism-update 2024-03-02 23:03:49 +01:00
phylactery.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
pict-rs.md nixos/manual: regenerate chapter xml files 2023-01-10 10:31:59 +01:00
pict-rs.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
pixelfed.nix treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
plantuml-server.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
plausible.md nixos/plausible: convert manual chapter to MD 2023-01-10 10:31:58 +01:00
plausible.nix treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
powerdns-admin.nix powerdns-admin: 0.3.0 -> 0.4.1 2023-05-22 00:39:58 +02:00
pretalx.nix nixos/pretalx: init 2024-01-30 17:41:34 +01:00
pretix.nix nixos/pretix: raise TimeoutStartSec 2024-03-21 21:49:40 +01:00
prosody-filer.nix
rimgo.nix rimgo: add module 2023-09-29 08:59:59 +02:00
rss-bridge.nix
selfoss.nix
sftpgo.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
shiori.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
slskd.nix treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
snipe-it.nix snipe-it: Convert to php.buildComposerPackage 2023-10-26 18:51:05 +02:00
sogo.nix nixos/sogo: fix nginx proxy_buffer config 2023-05-01 13:04:10 +02:00
suwayomi-server.md nixos/suwayomi-server: init at 0.7.0 2024-01-19 02:31:23 +01:00
suwayomi-server.nix treewide: use formats.hocon 2024-02-09 16:40:22 +01:00
trilium.nix
tt-rss.nix nixos/tt-rss: add phpPackage option 2024-02-07 17:41:27 +01:00
vikunja.nix nixos/vikunja: remove setupNginx option 2024-02-20 22:43:53 +01:00
whitebophir.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
wiki-js.nix wiki-js: use nodejs18 2023-05-14 14:25:33 +02:00
windmill.nix nixos/windmill: init module 2023-12-05 22:54:18 +00:00
wordpress.nix Merge pull request #277739 from KiaraGrouwstra/fix-sample-value-services-wordpress-sites-name-languages 2024-01-19 03:51:40 +01:00
writefreely.nix treewide: use new tmpfiles api 2024-01-24 05:13:17 +01:00
youtrack.md nixos/youtrack: rebuild module for 2023.x support 2024-02-01 13:36:13 +01:00
youtrack.nix nixos/youtrack: fix warnings (#285775) 2024-02-05 17:17:45 +01:00
zabbix.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
zitadel.nix nixos: fix bad mkEnableOption descriptions 2023-10-20 16:22:40 +01:00