Commit graph

33 commits

Author SHA1 Message Date
Lancelot SIX 5b8072fff6
postgresql: Fix use with extensions
Fixes #15512 and #16032

With the multi output, postgresql cannot find at runtime what is its
basedir when looking for libdir and pkglibdir. This commit fixes that.
2016-09-02 11:51:21 +02:00
Eric Sagnes 4cdfeb78f9 modules: move meta at top level 2016-08-11 00:29:48 +09:00
Al Zohali fb6ea3dead postgresql service: initialScript fixup 2016-04-23 22:28:12 +03:00
Eelco Dolstra fd8bd17c3e postgresql: Bump default version to 9.5 2016-02-12 13:20:11 +01:00
Nikolay Amiantov 90ef11ddcd postgresql service: don't use su 2016-02-10 02:12:05 +03:00
Tom Burdick 2c23a311cd postgresql: (94 -> 95)
Updates postgresql to its latest versions
2016-01-08 10:13:01 -06:00
Luca Bruno ff02152def nixos/postgresql: fix extraPlugins example with a working one 2015-11-01 14:15:43 +01:00
aszlig 60d407b209
nixos/postgresql: Fix execution of initialScript.
Regression introduced by b21fd5d066.

The initialScript is only executed whenever there is a .first-startup in
the dataDir, so silently dropping the file essentially breaks
initialScript functionality.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2015-10-25 16:05:14 +01:00
Eelco Dolstra ace332eb36 Set a default value for services.postgresql.package
This is finally possible now that we have ‘system.stateVersion’
(allowing the default package to change over time).
2015-07-27 20:30:10 +02:00
danbst 26d5a1fc62 postgresql: add reload command 2015-07-24 01:41:32 +00:00
William A. Kennington III b21fd5d066 nixos/postgresql: Fix initdb for existing, empty postgres partitions 2015-07-02 00:08:02 -07:00
Eelco Dolstra f667310c06 Use mkAfter for services.postgresql.authentication
Authentication methods are tried in order, so if another NixOS module
defines a specific ident mapping like

  local hydra all ident map=hydra-users

it should appear before the generic

  local all all ident
2015-07-01 13:49:02 +02:00
Tino Breddin eb7bbb4862 postgresql: use configured port when invoking psql 2014-09-27 14:37:11 +02:00
Shea Levy b3cfb9084b Get all lib functions from lib, not pkgs.lib, in modules 2014-07-02 12:28:18 -04:00
Eelco Dolstra fec3bc85a6 postgresql: Use systemd's new "mixed" kill mode
"Mixed" mode sends the initial SIGINT only to the main process, but
sends the SIGKILL after the time-out expires to the entire cgroup.
2014-04-18 17:32:24 +02:00
Eelco Dolstra 29027fd1e1 Rewrite ‘with pkgs.lib’ -> ‘with lib’
Using pkgs.lib on the spine of module evaluation is problematic
because the pkgs argument depends on the result of module
evaluation. To prevent an infinite recursion, pkgs and some of the
modules are evaluated twice, which is inefficient. Using ‘with lib’
prevents this problem.
2014-04-14 16:26:48 +02:00
Shea Levy 0122697550 Revert "Merge branch 'postgresql-user' of git://github.com/ocharles/nixpkgs"
Reverting postgres superuser changes until after stable.

This reverts commit 6cc0cc7ff6, reversing
changes made to 3c4be425db.
2014-04-11 19:23:03 -04:00
Shea Levy 9b077bac58 Revert "postgresql: properly fix permissions issue by in postStart"
Reverting postgres superuser changes until after stable.

This reverts commit c66be6378d.
2014-04-11 19:22:43 -04:00
Shea Levy e9e60103de Revert "Create the 'postgres' superuser"
Reverting postgres superuser changes until after stable.

This reverts commit 7de29bd26f.
2014-04-11 19:22:39 -04:00
Shea Levy c23050e231 Revert "Use PostgreSQL 9.3's pg_isready to wait for connectivity"
Reverting postgres superuser changes until after stable.

This reverts commit e206684110.
2014-04-11 19:21:50 -04:00
Oliver Charles e206684110 Use PostgreSQL 9.3's pg_isready to wait for connectivity
The postgresql module has a postStart section that waits for a database
to accept connections before continuing. However, this assumes various
properties about the database - specifically the database user
and (implicitly) the database name. This means that for old
installations, this command fails because there is no 'postgres' user,
and the service never starts.

While 7deff39 does create the 'postgres' user, a better solution is to
use `pg_isready`, who's sole purpose is to check if the database is
accepting connections. This has no dependency on users, so should be
more robust.
2014-04-06 12:38:02 +01:00
Oliver Charles 7de29bd26f Create the 'postgres' superuser
Old PostgreSQL installations were created using the 'root' database
user. In this case, we need to create a new 'postgres' account, as we
now assume that this is the superuser account.

Unfortunately, these machines will be left with a 'root' user as
well (which will have ownership of some databases). While PostgreSQL
does let you rename superuser accounts, you can only do that when you
are connected as a *different* database user. Thus we'd have to create a
special superuser account to do the renaming. As we default to using
ident authentication, we would have to create a system level user to do
this. This all feels rather complex, so I'm currently opting to keep the
'root' user on these old machines.
2014-04-06 12:38:01 +01:00
Vladimir Kirillov c66be6378d postgresql: properly fix permissions issue by in postStart
as per postgresql manual, interactions with psql should be carried
out with the postgresql system user and postgresql db user by default.

ensure it happens in postStart.
2014-03-31 18:06:06 +08:00
Shea Levy 6cc0cc7ff6 Merge branch 'postgresql-user' of git://github.com/ocharles/nixpkgs
postgresql module: Use the default superuser username
2014-03-15 13:29:52 -04:00
Domen Kožar 97a0dd9eb9 nixos: set all package options to have type package 2014-02-27 13:22:29 +01:00
Oliver Charles 2ea7c90839 postgresql module: Use the default superuser username
PostgreSQL defaults to having 'postgres' as the superuser. NixOS should
use this default name to provide a less surprising result to people who
enable services.postgres.
2014-02-13 18:52:59 +00:00
Oliver Charles 422f2032ab services.postgresql: Hint to use mkForce for authentication
This fixes #1395
2014-01-11 22:01:21 +00:00
Eelco Dolstra 7809134e29 postgresql: Fix shutdown
Postgres was taking a long time to shutdown.  This is because we were
sending SIGINT to all processes, apparently confusing the autovacuum
launcher.  Instead it should only be sent to the main process (which
takes care of shutting down the others).

The downside is that systemd will also send the final SIGKILL only to
the main process, so other processes in the cgroup may be left behind.
There should be an option for this...
2013-12-03 12:04:20 -05:00
Eelco Dolstra c6529ac9eb postgresql: Fix the port option
Also clarify the description of the enableTCPIP option.
2013-11-27 17:09:17 +01:00
Eelco Dolstra 2b0aea1793 Allow running NixOS services outside of systemd
The attribute ‘config.systemd.services.<service-name>.runner’
generates a script that runs the service outside of systemd.  This is
useful for testing, and also allows NixOS services to be used outside
of NixOS.  For instance, given a configuration file foo.nix:

  { config, pkgs, ... }:

  { services.postgresql.enable = true;
    services.postgresql.package = pkgs.postgresql92;
    services.postgresql.dataDir = "/tmp/postgres";
  }

you can build and run PostgreSQL as follows:

  $ nix-build -A config.systemd.services.postgresql.runner -I nixos-config=./foo.nix
  $ ./result

This will run the service's ExecStartPre, ExecStart, ExecStartPost and
ExecStopPost commands in an appropriate environment.  It doesn't work
well yet for "forking" services, since it can't track the main
process.  It also doesn't work for services that assume they're always
executed by root.
2013-11-18 18:04:17 +01:00
Eelco Dolstra 408b8b5725 Add lots of missing option types 2013-10-30 18:47:43 +01:00
Evgeny Egorochkin d2f612b1b6 postgresql.authMethod: remove unimplemented option.
close #1104.
2013-10-21 19:26:26 +03:00
Eelco Dolstra 5c1f8cbc70 Move all of NixOS to nixos/ in preparation of the repository merge 2013-10-10 13:28:20 +02:00
Renamed from modules/services/databases/postgresql.nix (Browse further)