unofficial mirror of 
 help / color / mirror / Atom feed
* Running postgres with shepherd as user-level service?
@ 2020-12-11  9:07 Carlo Holl
  2020-12-21 21:43 ` Joshua Branson
  0 siblings, 1 reply; 2+ messages in thread
From: Carlo Holl @ 2020-12-11  9:07 UTC (permalink / raw)
  To: help-guix

Hello Guix!

I'm struggling to find the right incantation to start a postgresql service with
shepherd outside of a system context.

Suppose the following snippet (postgres.scm):

(use-modules (gnu services)              (gnu packages databases)              
(gnu services databases))

(define pg-service   (service postgresql-service-type     
(postgresql-configuration       (postgresql postgresql)
       (data-directory "path-to-data-dir"))))

(register-services pg-service)
(start pg-service)

If I run the above with 'herd load root postgres.scm', I get:

     Loading postgres.scm.
     herd: exception caught while executing 'load' on service 'root':
     In procedure fport_write: Input/output error

Firstly, I'm not sure this is the right approach. Are the services defined in
say (gnu services databases) supposed to be run outside of system config context?

Secondly, I don't know how to go about diagnosing the issue since I'm not given
a stack trace and I don't know where to get a more detailed log of the 
failure. The shepherd log file just shows 'Loading postgres.scm' for 
every invocation of
the herd command.

A point in the right direction would be greatly appreciated.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Running postgres with shepherd as user-level service?
  2020-12-11  9:07 Running postgres with shepherd as user-level service? Carlo Holl
@ 2020-12-21 21:43 ` Joshua Branson
  0 siblings, 0 replies; 2+ messages in thread
From: Joshua Branson @ 2020-12-21 21:43 UTC (permalink / raw)
  To: Carlo Holl; +Cc: help-guix

Hey Carlo,

I am SUPER NOT a guix developer, but I figured I'd respond to your
email.  Please bear in mind I am making this up as I go along.  :)

It sounds like your user postgresql service is not even generating a
postgresql config file.  It sounds like it is error-ing out before
anything useful happens.  Specifically in while I assume in a guile
procedure call to "fport_write".  You may need to get into debugging the
shepherd.  The GNU Guile manual has a section of debugging the shepherd.
It's not as pretty as debugging elisp code.  (I really hope someone
making the debugging guile code as awesome as debugging elisp).

Let's test the assumption that your user service of postgresql is NOT
generating any postgresql config file.  I would ensure that /gnu/store
has NO postgresql config files.  To do this, remove postgresql from your
user profile, and ensure that you DO not have a running postgresql
service definition in config.scm.  Then do a guix gc.  Now do something

I think this is the right syntax for a recursive grep...
grep -r postgresql /gnu/store

Check for any files and directories that grep shows.  Do you see any
postgresql configuration files?

I would try to load the service as you did before via 'herd load root
postgres.scm' and then do a

cat /var/log/messages

You could also try looking at where postgresql logs files, but again it
doesn't sound like postgresql is even generating the config file...

When I was debugging my system nginx service, I found it useful to
discover what nginx file guix generated.  Currently the shepherd doesn't
have a way to show you the generated file, but you can do a recursive
grep and try to find said config file. 

You can also try to take a look at the system postgresql service
definition in guix-src/gnu/services/databases.scm.

Best of luck,


P.S.  If the above fails, try dipping an orange in a big barrel of
pickle juice, speak the incantation "Relational Databases are fantastic"
5 times, and gently pat your computer thinking the positive affirmation
"you are adorable".  :)

Joshua Branson
Sent from Emacs and Gnus
  "You can have whatever you want, as long as you help

enough other people get what they want." - Zig Ziglar

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-21 21:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11  9:07 Running postgres with shepherd as user-level service? Carlo Holl
2020-12-21 21:43 ` Joshua Branson

unofficial mirror of 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror guix-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-user guix-user/ \
	public-inbox-index guix-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:

AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git