Commit Graph

71 Commits

Author SHA1 Message Date
Sridhar Ratnakumar
d6d9cf2de1
feat: Allow overriding namespace + make default namespace fully qualified (#258)
**PR description**

- The user can now set `namespace` for the processes under each service
- Default namespace is now `${service}.${name}` (previously, just
`${name}`)


**Tasks**

- [x] Do this for postgres, to begin with.
- [x] Rest of the services


![image](https://github.com/juspay/services-flake/assets/3998/9ffea918-6481-42ad-ac47-cb5c1c81bd92)

After the user overrides it:

<img width="460" alt="image"
src="https://github.com/juspay/services-flake/assets/3998/da6fb51e-e39f-4c33-bb47-e6b7cfd8c2b5">

After the user overrides the local processes as well:

<img width="460" alt="image"
src="https://github.com/juspay/services-flake/assets/3998/ae493309-4449-4cde-b239-c6e234b9f8af">
2024-07-05 22:49:51 +05:30
Sridhar Ratnakumar
b713baa32b
docs(postgres): Fully document initialDatabases.schemas (#259)
cf.
dea27be987/nix/postgres/setup-script.nix (L11-L17)
2024-07-05 13:04:52 +05:30
shivaraj-bh
8145ba10cb fix(ollama): kernelPackages are irrelevant on non-NixOS distributions 2024-06-24 17:09:21 +05:30
Pol Dellaiera
f3098faecd
feat(searxng): init (#241) 2024-06-21 01:38:45 +05:30
shivaraj-bh
db7ab711d9 fix(ollama): Broken dataDir convention; Allow ENVs in dataDir
Easy to break the convention, see:
https://github.com/juspay/services-flake/issues/200

double-quotting in shell script prevents globbing:
https://www.shellcheck.net/wiki/SC2086
2024-06-14 03:11:07 +05:30
shivaraj-bh
e7eb9dec41 feat(open-webui): init
ported from:
https://github.com/shivaraj-bh/ollama-flake/blob/main/services/open-webui.nix

This was also recently upstreamed to
[nixpkgs](https://github.com/NixOS/nixpkgs/tree/master):
https://github.com/NixOS/nixpkgs/pull/316248

---------

Co-authored-by: Pol Dellaiera <pol.dellaiera@protonmail.com>
Co-authored-by: Sridhar Ratnakumar <3998+srid@users.noreply.github.com>
2024-06-14 03:11:07 +05:30
shivaraj-bh
d84efa4788 feat(ollama): init
ported from
https://github.com/shivaraj-bh/ollama-flake/blob/main/services/ollama.nix

Also see the nixos module:
https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/ollama.nix
2024-06-12 16:09:12 +05:30
Alex Pearwin
eb3bac5543
feat(grafana): add providers configuration (#211)
Addresses juspay/services-flake#210.

I've tested this by hand with configuration:

```nix
services.grafana."grafana" = {
  enable = true;
  providers = [
    {
      name = "Databases";
      type = "file";
      options = {
        path = ./dashboards;
        foldersFromFilesStructure = true;
      };
    }
  ];
};
```

I haven't looked into it, but it might be possible to extend the
existing Grafana test to check that a folder of dashboards is loaded.
2024-06-06 21:39:45 +05:30
shivaraj-bh
12e74823f4 fix(postgres): stop init on error in sql scripts
From psql docs (https://www.postgresql.org/docs/current/app-psql.html):

> psql returns 0 to the shell if it finished normally, 1 if a fatal
error of its own occurs (e.g., out of memory, file not found), 2 if the
connection to the server went bad and the session was not interactive,
and 3 if an error occurred in a script and the variable ON_ERROR_STOP
was set.

Also resolves https://github.com/juspay/services-flake/issues/107
2024-06-06 20:47:29 +05:30
Mahdi Seyedan
2fba2e0009
feat: Add Weaviate service (#195)
resolves #90
2024-05-28 12:30:40 +05:30
Tim
c6b5977f65
feat: add tempo service (#192) 2024-05-19 17:06:45 +05:30
Adam Szucs-Matyas
75a42b9e9e fix(nginx): link nginx.conf to dataDir (#173) 2024-05-09 21:56:38 +05:30
Adam Szucs-Matyas
c93d0ad98f chore(nginx): move nginx files to their own folder 2024-05-09 21:56:38 +05:30
Attila Ersek
dbb93b39ce feat(mysql): allow configuring socketDir on mysql. if not provided, uses dataDir as default. solves #171 2024-04-26 18:42:04 +05:30
Attila Ersek
b5d29b0734 chore(mysql): cover mysql importTimezones with tests 2024-04-24 14:29:24 +05:30
Attila Ersek
3082fcf5ca fix(mysql): use absolute socket path in configureTimezones. this fixes #169 2024-04-24 14:29:24 +05:30
John Hampton
4d363b6d22 test(postgres): set socketDir with empty listen_addresses
Test a postgres service with socketDir set and empty listen_addresses.
2024-04-14 08:57:42 +05:30
John Hampton
6c9b34f0b1 fix(postgres): fix pg_isready issue with empty listen_addresses
This commit resolves the issue where `pg_isready` would fail when
`socketDir` is set and `listen_addresses` is empty. `pg_isready` is now
modified to leverage `socketDir` when it is available.
2024-04-14 08:57:42 +05:30
Shivaraj B H
04b5f77604
fix(grafana): add coreutils as runtimeInput for the startScript (#164)
`readlink` shipped by default in macOS doesn't support `-m` flag
2024-04-11 00:42:46 +05:30
Javier Pollak
8d390cb955
fix(pgadmin): Fix pgadmin scripts on MacOS (#163)
`readlink -m` is invalid on mac. Added coreutils as a runtime input for darwin.
2024-04-11 00:31:33 +05:30
shivaraj-bh
423b85482d refactor(deprecation): replace types.string with types.str
see https://github.com/NixOS/nixpkgs/pull/66346
2024-03-29 21:20:23 +05:30
shivaraj-bh
ecc409436c chore(postgres): default value for listen_addresses is already localhost
This is true after https://github.com/juspay/services-flake/pull/160
2024-03-27 12:43:35 +05:30
Shivaraj B H
18d5c1d168
fix(postgres): empty socketDir by default (#160)
resolves #139 

> empty `unix_socket_directories` means not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server.

see: https://www.postgresql.org/docs/current/runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES

* use TCP/IP by default for health check
2024-03-26 18:44:11 +05:30
Shivaraj B H
819ab20e8e
refactor: writeShellScriptBin -> writeShellApplication (#155)
Provides us with following benefits:
- use `runtimeInputs` instead of manually exporting `PATH`
- get shellcheck by default

---------

Co-authored-by: Sridhar Ratnakumar <3998+srid@users.noreply.github.com>
2024-03-19 01:47:25 +05:30
Shivaraj B H
f158353b59
fix(mysql)!: look for *.sql files in the top-level schema directory (#154)
* mysql service would assume that all the `*.sql` files in the directory, provided by `initialDatabases [{ schema = <directory>; … }]`, exists in a folder named [mysql-databases](291e7be83a/nix/mysql.nix (L239-L241)), after this change it would just look for all the `*.sql` files in the top-level schema directory.
* add tests
2024-03-18 22:32:08 +05:30
Shivaraj B H
18f9decf13
refactor(postgres): replace string argument with attrset for connectionURI (#146)
for justification, see:
https://github.com/juspay/services-flake/pull/143#discussion_r1521290361
2024-03-13 00:40:13 +05:30
Shivaraj B H
8c25972cfb
feat(postgres): add connectionURI option (#143)
resolves #141
2024-03-12 14:24:28 +05:30
Abhishek Singh
e0a1074f8a
bump: update flake lock (#117)
* fix: pgadmin-init

in pgadmin-8.2, the command to setup configuration db is `setup-db`

* fix: add grafana overlay
grafana 10.3.3 from upstream nixpkgs doesn’t work in darwin

* chore: free up space in ubuntu-latest

---------

Co-authored-by: shivaraj-bh <sbh69840@gmail.com>
2024-03-06 16:55:00 +05:30
Abhishek Singh
6aeb0eafe6
cassandra: init service (#116)
* cassandra: init service

* cassandra: add cassandra/conf files

* cassandra_test: change package to cassandra_4

* update readiness_probe

* update cassandra_test

* cassandra: add doc

* cassandra_4 doesn't require python-2

---------

Co-authored-by: shivaraj-bh <sbh69840@gmail.com>
2024-03-03 16:07:36 +05:30
Abhishek Singh
5e48c5a965
add pgAdmin service (#115) 2024-02-29 18:10:22 +05:30
Abhishek Singh
bdd6dde41a
add prometheus service (#114)
* prometheus: init service

* prometheus: add doc

* prometheus: update doc
2024-02-28 11:00:52 +05:30
Shivaraj B H
65ebef12e5
clickhouse: fix test regression (#109) 2024-02-27 19:35:08 +05:30
Abhishek Singh
ef2f930e1a
clickhouse: use lib.recursiveUpdate to deep merge extraConfig (#110) 2024-02-22 22:32:52 +05:30
Abhishek Singh
625f207034
add grafana service (#108) 2024-02-22 22:25:51 +05:30
Adrian
f8cd3fbcb5
postgres init: use -U ${config.superuser} with psql if superuser != null (#106) 2024-02-21 23:36:56 +05:30
Abhishek Singh
76beca31cc
change clickhouse extraConfig type to yaml (#99)
* change clickhouse `extraConfig` type to yaml

* update clickhouse doc
2024-02-19 11:08:14 +05:30
Shivaraj B H
7593351c71
Mysql: add initialScript option (#98)
—

Co-authored-by: rsrohitsingh682 <rsrohitsingh682@gmail.com>
2024-02-15 16:36:18 +05:30
Shivaraj B H
63ff90eed9
redis-cluster: run create cluster only if it is not already initalised (#97) 2024-02-13 19:24:08 +05:30
roman-bodavskiy
a0bde519ed
clickhouse init script (#91)
* clickhouse init script

* clickhouse schema test

* clickhouse folder

* docs: add initialDatabases to tips & tricks

* docs: use heading anchor

* add TODO to find an alternative to start clickhouse-server during init

---------

Co-authored-by: shivaraj-bh <sbh69840@gmail.com>
2024-02-07 22:03:06 +05:30
Shivaraj B H
9b806b53f3
postgres: always create socketDir during init if not already present (#88)
If the socketDir is in tmpfs, or if it is deleted by some other process, we would want the socketDir to be created, if not already present, on restarts.
2024-01-31 18:47:52 +05:30
Shivaraj B H
af4af40169
Add Clickhouse service (#85) 2024-01-24 20:54:26 +05:30
John A. Lotoski
eb8361b9ab
postgres ensure socketDir mktemp init succeeds (#81)
* fix: ensure socketDir mktemp succeeds when path does not exist yet

* postgres: test socketDir with a multi-level non-existing path
2024-01-20 00:20:08 +05:30
John A. Lotoski
1a3f2d1936
postgres: add socketDir option (#77) 2024-01-18 23:10:16 +05:30
Shivaraj B H
bf3a582502
[Postgres]: Fix test process not starting (#78)
* needn't copy depends_on option, demonstrated in example/flake.nix

* postgres: test process must depend on both pg1 and pg2
2024-01-18 11:28:15 +05:30
Shivaraj B H
c7bed59b87
[apache-kafka] Fix the configuration to allow kafka to run on non-default port (#76)
Tests are inspired from: https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/kafka.nix
The module is based on: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/apache-kafka.nix
2024-01-16 14:35:05 +05:30
Shivaraj B H
62e13715f8
[Postgres]: Use schemas in-place of initialDumps (#73)
* (postgres) rename schema to schemas; rm initialDumps, use schemas instead
2024-01-13 22:48:46 +05:30
Rohit Singh
2211042f3e
Postgres: Added option depends_on (#71)
* Added option depends_on which will be useful to append extra depends_on configuration to the <name>-init process.

* more meaningful `depends_on` option's description

---------

Co-authored-by: shivaraj-bh <sbh69840@gmail.com>
2023-12-28 20:44:32 +05:30
Rohit Singh
d6b73e401e
Adding option initialDumps to Postgres (#67)
---------

Co-authored-by: Shivaraj B H <sbh69840@gmail.com>
2023-12-26 15:15:32 +05:30
Rohit Singh
22e121b246
Using psql command instead of postgres in initialScript (#66)
* Use psql instead of postgres, as a result, use `pg_ctl` to temporarily start the postgres server in `${name}-init` process.
* Avoid creating a custom `postgresPkg` with extensions by using `apply` attribute provided by `mkOption`
* Refactor setup script, use `writeShellApplication` and resolve shell-check errors

---------

Co-authored-by: shivaraj-bh <sbh69840@gmail.com>
2023-12-25 00:35:03 +05:30
Shivaraj B H
8cd80d7a16
nginx: service init (#69) 2023-12-22 16:42:51 +05:30