Commit Graph

862 Commits

Author SHA1 Message Date
Felix Buehler
5949a18871 treewide: use externalPath 2025-11-10 20:51:44 +01:00
misuzu
ffcdcf99d6 nixos/clickhouse: allow configuring with Nix attribute set (#458319) 2025-11-05 16:44:39 +00:00
Konstantin Bogdanov
ddac798a5a nixos/clickhouse: allow configuring with Nix attribute set 2025-11-05 06:24:10 +01:00
Augustin Trancart
30ba7d34a2 postgresql: document the use of callPackage 2025-10-31 19:49:53 +01:00
Philip Taron
01898764b6 treewide: replace "yes" else "no" usages to lib.boolToYesNo (#442387) 2025-10-28 16:25:46 +00:00
StepBroBD
74cde83add nixos/{karma,pgbouncer}: use cfg.package instead of global pkgs (#412435) 2025-10-26 19:29:41 +01:00
Aliaksandr
80f12557f5 treewide: replace "yes" else "no" usages to lib.boolToYesNo 2025-10-21 16:04:34 +03:00
Tobias M
95625320bf nixos/lldap: use exec for start script
Use exec for running lldap itself so that the bash startup script does
not have to linger around.
2025-10-21 12:51:16 +02:00
patternspandemic
31ebd81a77 maintainers: remove patternspandemic 2025-10-14 19:07:35 -07:00
Wolfgang Walther
91a8fee3aa treewide: remove redundant parentheses
Auto-fixed by nixf-diagnose.
2025-10-05 10:52:03 +02:00
Wolfgang Walther
c283f32d29 treewide: remove unused with
Auto-fixed by nixf-diagnose.
2025-10-05 10:50:41 +02:00
Wolfgang Walther
90e7159c55 treewide: remove unused rec
Auto-fix by nixf-diagnose.
2025-10-05 10:49:12 +02:00
Franz Pletz
eef9711390 nixos/services.mysql: Fix restart on-abnormal (#430859) 2025-09-30 07:24:36 +00:00
Maximilian Bosch
2f8c1fda9c victoriatraces: init at 0.2.0 (#441750) 2025-09-25 08:17:46 +00:00
h7x4
09d9af7b73 nixos/foundationdb: use types.port 2025-09-22 16:32:59 +02:00
h7x4
5fc863dd73 nixos/cassandra: use types.port 2025-09-22 16:32:59 +02:00
Calum MacRae
44fe5c8ee0 nixos/victoriatraces: init service module
Add service module for VictoriaTraces, following the same patterns
as the existing victorialogs and victoriametrics modules.
2025-09-22 12:50:40 +01:00
h7x4
4ba3f60b8a various: use mkPackageOption 2025-09-22 02:46:54 +02:00
Yorick
3e2c4e85ad nixos/victoriametrics: Add ability to pass basicAuthPasswordFile (#441886) 2025-09-16 09:34:33 +00:00
Haylin Moore
e901061412 nixos/chromadb: deprecate logPath option
The module and nixos test are currently broken because the logPath option is always set by default and it passes a parameter to the CLI that no longer exists. Lets just remove logPath all together as the parameter it relied on got removed.
2025-09-12 18:27:06 -07:00
Illia Pshonkin
dcf2b9c0a0 nixos/victoriametrics: Add ability to pass basicAuthPasswordFile 2025-09-12 07:59:46 +02:00
Haylin Moore
cf540f8c98 treewide/nixos: move number typed port options to types.port 2025-09-08 15:27:19 +02:00
Harish Rajagopal
78e2b2ef06 Allow setting user password file with the environment 2025-08-31 21:36:06 +02:00
Sandro
bab1ec5bd3 victoriametrics & vmagent: Make the config check optional (#419908) 2025-08-27 22:25:51 +02:00
dish
970dcca69c treewide: Fix links in module documentation 2025-08-25 12:55:11 -04:00
ibizaman
078b5bba83 lldap: lldap 0.6.1 -> 0.6.2 2025-08-24 21:14:11 +02:00
ibizaman
42b6d62699 lldap: add options to set important secrets 2025-08-24 21:14:11 +02:00
Pol Dellaiera
bc36d3ac43 maintainers: drop drupol 2025-08-20 17:54:38 +02:00
Sandro
b146c51ce7 vlagent: init at 1.25.0 (#424934) 2025-08-18 01:12:26 +02:00
Philipp
620f813ef4 nixos/services.mysql: Fix restart on-abnormal 2025-08-04 10:23:03 +02:00
Maximilian Bosch
6ae194e419 nixos/postgresql: set Restart=always for postgresql.service
...including a slightly more careful config around restarts, i.e.

* We have intervals of 5 seconds between restarts instead of 100ms.

* If we exceed 5 start attempts in 5*120s (with 120s being the timeout),
  start job gets rate-limited and thus aborted. Do note that there are
  at most 5 start attempts allowed in ~625s by default. If the startup
  fails very quickly, either wait until the rate-limit is over or reset
  the counter using `systemctl reset-failed postgresql.service`.

* The interval of 625s (plus 5s of buffer) are automatically derived
  from RestartSec & TimeoutSec. Changing either will also affect
  StartLimitIntervalSec unless overridden with `mkForce`.
2025-07-26 19:11:54 +02:00
Maximilian Bosch
03d0fed6f8 nixos/postgresql: implement auto-restart & rework dependencies of postgresql.target
At my employer's NixOS-based platform, PostgreSQL is configured with
`Restart=always` which got never upstreamed, unfortunately.

This however revealed an interesting problem when using bi-directional
BindsTo: when killing `postgresql.service`, sometimes both the service &
target starts back up and sometimes they don't. According to an upstream
bugreport[1] this is a known problem because you have two conflicting
operations scheduled in a single transaction, namely

* When (auto-)restarting, a restart job for all units bound to the
  restarting unit are immediately scheduled[2].

* Due to the `BindsTo` relationship, a stop-job for `postgresql.target`
  is scheduled immediately by the manager loop[3]. This is caused by the
  `UNIT_ATOM_CANNOT_BE_ACTIVE_WITHOUT` "atom" which is ONLY set for a
  BindsTo relationship[4].

  When this is processed first, the restart is inhibited:

      Jul 12 13:25:51 nixos systemd[1]: postgresql.service: Main process exited, code=killed, status=9/KILL
      Jul 12 13:25:51 nixos systemd[1]: postgresql.service: Changed running -> stop-sigterm
      Jul 12 13:25:51 nixos systemd[1]: postgresql.target: Trying to enqueue job postgresql.target/stop/replace
      Jul 12 13:25:51 nixos systemd[1]: postgresql.service: Installed new job postgresql.service/stop as 80053
      Jul 12 13:25:51 nixos systemd[1]: postgresql.target: Installed new job postgresql.target/stop as 80052
      Jul 12 13:25:51 nixos systemd[1]: postgresql.target: Enqueued job postgresql.target/stop as 80052
      [...]
      Jul 12 13:25:51 nixos systemd[1]: postgresql.service: Service restart not allowed.

It's subtle and non-obvious from the man-page, but the way how units are
stopped is different when using `PartOf=` or `Requires=` which don't have the
`UNIT_ATOM_CANNOT_BE_ACTIVE_WITHOUT` property, but instead schedules the
stop/start of the target AFTER the stop-job of postgresql.service which
is turned into a start-job because of Restart=always:

    Jul 12 13:33:00 nixos systemd[1]: postgresql.service: Main process exited, code=killed, status=9/KILL
    [...]
    Jul 12 13:33:00 nixos systemd[1]: postgresql.service: Failed with result 'signal'.
    Jul 12 13:33:00 nixos systemd[1]: postgresql.service: Service will restart (restart setting)
    [...]
    Jul 12 13:33:00 nixos systemd[1]: postgresql.target: Installed new job postgresql.target/restart as 80996
    Jul 12 13:33:00 nixos systemd[1]: postgresql.service: Installed new job postgresql.service/restart as 80907
    [...]
    Jul 12 13:33:00 nixos systemd[1]: postgresql.service: Scheduled restart job, restart counter is at 1.
    [...]
    Jul 12 13:33:00 nixos systemd[1]: Stopped target postgresql.target.
    Jul 12 13:33:00 nixos systemd[1]: postgresql.target: Converting job postgresql.target/restart -> postgresql.target/start
    Jul 12 13:33:00 nixos systemd[1]: Stopping postgresql.target...
    [...]
    Jul 12 13:33:00 nixos systemd[1]: Stopped postgresql.service.
    Jul 12 13:33:00 nixos systemd[1]: postgresql.service: Converting job postgresql.service/restart -> postgresql.service/start
    [...]
    Jul 12 13:33:00 nixos systemd[1]: postgresql.service: Changed dead -> running
    Jul 12 13:33:00 nixos systemd[1]: postgresql.service: Job 80907 postgresql.service/start finished, result=done
    Jul 12 13:33:00 nixos systemd[1]: Started postgresql.service.
    Jul 12 13:33:00 nixos systemd[1]: postgresql.target: Changed dead -> active
    [...]
    Jul 12 13:33:00 nixos systemd[1]: Reached target postgresql.target.

Do note that the stop job (including the restart) of postgresql.service
is fully processed here before dealing with PartOf/ConsistsOf
relationships.

I tested this against the following cases:

    | Unit               | Action       | Propagates to      |
    | ------------------ | ------------ | ------------------ |
    | postgresql.target  | restart      | postgresql.service |
    | postgresql.target  | start        | postgresql.service |
    | postgresql.target  | stop         | psotgresql.service |
    | postgresql.service | start        | postgresql.target  |
    | postgresql.service | restart      | postgresql.target  |
    | postgresql.service | stop         | postgresql.target  |
    | postgresql.service | auto-restart | postgresql.target  |
    | postgresql.service | failure      | postgresql.target  |

[1] e.g. systemd issue 8374
[2] https://github.com/systemd/systemd/blob/v256-stable/src/core/service.c#L2535-L2542
[3] https://github.com/systemd/systemd/blob/v256-stable/src/core/manager.c#L1611-L1626
[4] https://github.com/systemd/systemd/blob/v256-stable/src/core/unit-dependency-atom.c#L30-L35
2025-07-26 19:09:48 +02:00
Shawn8901
29a7ca7340 nixos/victorialogs: add basicAuth options 2025-07-24 19:47:45 +02:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Wolfgang Walther
62fe016519 treewide: run treefmt with mdcr/nixfmt 2025-07-24 13:52:31 +02:00
Wolfgang Walther
6c47e7d5da treewide: fix syntax errors in nix code blocks
Fixes all code blocks with "nix" language in markdown files for syntax
errors to be able to run nixfmt in the next step.
2025-07-24 13:52:29 +02:00
Philip Taron
8279ffe622 treewide: specify that mebibytes are used when it's ambiguous (#424169) 2025-07-11 12:29:33 -07:00
Axel Karjalainen
7159ab6f43 treewide: specify where mebibytes are used when it's ambiguous 2025-07-11 00:44:23 +03:00
Martin Weinelt
91e217aad1 nixos/mysql: replace nettools with hostname-debian
If it just needs the hostname utility this is the better maintained
choice.
2025-07-06 00:59:37 +02:00
Kamil Monicz
f9339c853e nixos/postgresql: document beta versioning 2025-07-05 15:36:17 +02:00
Kamil Monicz
82248a6f7a nixos/postgresql: warn about unstable status 2025-07-05 15:36:14 +02:00
Kamil Monicz
abc5cff372 nixos/postgresql: deduplicate postgresql and use cfg.finalPackage 2025-07-05 11:52:42 +02:00
Maximilian Bosch
e031c5ff6b nixos/postgresql: add section about pg_config
See https://discourse.nixos.org/t/i-cannot-for-the-life-of-me-find-the-package-that-has-pg-config/66244/4

I decided against doing this in its own nixpkgs manual: the line
to draw is quite blurry already (e.g. we have documented our package
removal policy in here as well) and having to check two manuals for a
single subsystem feels pretty annoying to me.

The relevant part - where to find pg_config - is written at the top. I
decided to give a bit more context about the way our packaging works
since I realized a few times now that I don't remember all the details
about the problems we had in the past and having to look up individual
commit messages for that isn't very productive.
2025-07-03 19:33:01 +02:00
Mike Kusold
292073c5cc victoriametrics & vmagent: Make the config check optional
This follows the pattern that AlertManager uses. Currently if you use
environment variables, the config check will fail.
2025-06-25 08:55:34 -06:00
Wolfgang Walther
9656e1aa9d nixos/postgresql: make postgresql.target wait until recovery is done
The new postgresql.target will now wait until recovery is done and
read/write connections are possible.

This allows ensure* scripts and downstream migrations to work properly
after recovery from backup.

Resolves #346886
2025-06-24 15:26:48 +02:00
Wolfgang Walther
41c5662cbe nixos/postgresql: move postStart into separate unit
This avoids restarting the postgresql server, when only ensureDatabases
or ensureUsers have been changed. It will also allow to properly wait
for recovery to finish later.

To wait for "postgresql is ready" in other services, we now provide a
postgresql.target.

Resolves #400018

Co-authored-by: Marcel <me@m4rc3l.de>
2025-06-24 15:26:47 +02:00
Wolfgang Walther
c119848700 nixos/postgresql: align maintainers with postgresql package 2025-06-24 15:24:21 +02:00
Marie Ramlow
b9a699fe22 nixos/victorialogs: use pkgs.victorialogs by default 2025-06-21 21:00:30 +02:00
Aleksana
9bc7d52aff nixos/mongodb: fix initialScript when no initialRootPasswordFile is set (#411901) 2025-06-20 20:08:24 +08:00
Maximilian Bosch
950a089393 nixos/postgresql: make postgresql_17 the new default
That's overdue actually, given that it was released last fall.
2025-06-17 12:33:21 +02:00