summary refs log tree commit diff
path: root/doc/guix.texi
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2021-01-18 11:10:28 +0100
committerMathieu Othacehe <othacehe@gnu.org>2021-01-28 12:57:27 +0100
commitec145a2ff9f6a69234ddd2f3656ac324b53d30d3 (patch)
treefad29c256a47c132d5485e147577e4fadd12851f /doc/guix.texi
parent33687aa3d0c298d6bc587ed772a900cf8c3e8ba4 (diff)
downloadguix-ec145a2ff9f6a69234ddd2f3656ac324b53d30d3.tar.gz
services: postgresql: Add postgresql-role-service-type.
* gnu/services/databases.scm (postgresql-role,
postgresql-role?, postgresql-role-name,
postgresql-role-permissions, postgresql-role-create-database?,
postgresql-role-configuration, postgresql-role-configuration?,
postgresql-role-configuration-host, postgresql-role-configuration-roles,
postgresql-role-service-type): New procedures.
* gnu/tests/databases.scm: Test it.
* doc/guix.texi: Document it.
Diffstat (limited to 'doc/guix.texi')
-rw-r--r--doc/guix.texi62
1 files changed, 62 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index f4fbe6b0e6..6ea782fd23 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19455,6 +19455,68 @@ here}.
 @end table
 @end deftp
 
+@deffn {Scheme Variable} postgresql-role-service-type
+This service allows to create PostgreSQL roles and databases after
+PostgreSQL service start.  Here is an example of its use.
+
+@lisp
+(service postgresql-role-service-type
+            (postgresql-role-configuration
+             (roles
+              (list (postgresql-role
+                     (name "test")
+                     (create-database? #t))))))
+@end lisp
+
+This service can be extended with extra roles, as in this
+example:
+
+@lisp
+(service-extension postgresql-role-service-type
+                   (const (postgresql-role
+                           (name "alice")
+                           (create-database? #t))))
+@end lisp
+@end deffn
+
+@deftp {Data Type} postgresql-role
+PostgreSQL manages database access permissions using the concept of
+roles.  A role can be thought of as either a database user, or a group
+of database users, depending on how the role is set up.  Roles can own
+database objects (for example, tables) and can assign privileges on
+those objects to other roles to control who has access to which objects.
+
+@table @asis
+@item @code{name}
+The role name.
+
+@item @code{permissions} (default: @code{'(createdb login)})
+The role permissions list.  Supported permissions are @code{bypassrls},
+@code{createdb}, @code{createrole}, @code{login}, @code{replication} and
+@code{superuser}.
+
+@item @code{create-database?} (default: @code{#f})
+Whether to create a database with the same name as the role.
+
+@end table
+@end deftp
+
+@deftp {Data Type} postgresql-role-configuration
+Data type representing the configuration of
+@var{postgresql-role-service-type}.
+
+@table @asis
+@item @code{host} (default: @code{"/var/run/postgresql"})
+The PostgreSQL host to connect to.
+
+@item @code{log} (default: @code{"/var/log/postgresql_roles.log"})
+File name of the log file.
+
+@item @code{roles} (default: @code{'()})
+The initial PostgreSQL roles to create.
+@end table
+@end deftp
+
 @subsubheading MariaDB/MySQL
 
 @defvr {Scheme Variable} mysql-service-type