guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Postgres user UID and GID


From: Denis 'GNUtoo' Carikli
Subject: Re: Postgres user UID and GID
Date: Mon, 17 Jul 2023 21:49:31 +0200

On Mon, 17 Jul 2023 18:06:04 +0000
Martin Baulig <martin@baulig.is> wrote:

> Hello,
Hi,

> I have a bit of an unusual setup, as I am running GNU Guix in a VM on
> a Synology NAS. Unfortunately, their DSM software sucks quite badly,
> but I am currently stuck with this hardware as I don't have the
> budget to replace it. But I don't want to make any long-term
> commitment to their software either. One of the awesome features of
> GNU Guix is that it can nicely and easily be deployed elsewhere.
> However, for this to work, I need to be able to extract my data
> easily, so storing anything inside that VM that's not on GitLab isn't
> an option. I have decided to NFS-mount an encrypted shared folder
> from the NAS and store all data there.
I've also a setup where I share a postgresql data folder between
various distributions.

In my case it's shared between Parabola i686, Parabola x86_64, Guix
i686 and Guix x86_64. And I often need to chroot inside Parabola so
this is why I need to use the same IDs (than Parabola).

So for keeping the same id across different distributions, I hardcoded
it in the users and groups like that in my system.scm:
>   (users (cons* [...]
>                 (user-account
>                   (name "postgres")
>                   (uid 88)
>                   (group "postgres")
>                   (comment "PostgreSQL user")
>                   (home-directory
> "/path/to/shared-dir/var/lib/postgres") (shell (file-append bash
> "/bin/bash")) (system? #t)) %base-user-accounts))

And in the groups too:
>   (groups (cons* [...]
>                  (user-group
>                    (name "postgres")
>                    (id 88)
>                    (system? #t))
>                  [...]
>                  %base-groups))

And for the record here's how I use a different architecture: I define
a package:
> (define postgresql-14-i686-linux
>   (package                    
>    (inherit postgresql-14)  
>    (name "postgresql-14-i686-linux")
>    (arguments
>     (ensure-keyword-arguments
>      (package-arguments postgresql-14)
>      '(#:system "i686-linux")))))

And then use it in the PostgreSQL service:
>                    (service
>                      postgresql-service-type
>                      (postgresql-configuration
>                       (postgresql
>                        (if (target-x86-64?)
>                            postgresql-14-i686-linux
>                            postgresql-14))
>                       [...]))

The downside is that it prints a warning during boot if I recall
well but it works fine.

I'm unsure if that helps the conversation or not though as you might
want something cleaner.

Denis.

Attachment: pgp3NF2BzUdBS.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]