unofficial mirror of help-guix@gnu.org 
 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; 3+ 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.

-Carlo


^ permalink raw reply	[flat|nested] 3+ 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
  2021-02-12  3:16   ` Services related project for GSoC? Was: " raingloom
  0 siblings, 1 reply; 3+ 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
like:

I think this is the right syntax for a recursive grep...
#+BEGIN_SRC sh
grep -r postgresql /gnu/store
#+END_SRC

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

#+BEGIN_SRC sh
cat /var/log/messages
#+END_SRC

You could also try looking at where postgresql logs files, but again it
doesn't sound like postgresql is even generating the config file...
https://www.postgresql.org/docs/9.1/runtime-config-logging.html

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,

Joshua

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
  https://gnucode.me
  https://video.hardlimit.com/accounts/joshua_branson/video-channels
  https://propernaming.org
  "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] 3+ messages in thread

* Services related project for GSoC? Was: Running postgres with shepherd as user-level service?
  2020-12-21 21:43 ` Joshua Branson
@ 2021-02-12  3:16   ` raingloom
  0 siblings, 0 replies; 3+ messages in thread
From: raingloom @ 2021-02-12  3:16 UTC (permalink / raw)
  To: Joshua Branson; +Cc: help-guix, Carlo Holl

On Mon, 21 Dec 2020 16:43:17 -0500
Joshua Branson <jbranso@dismail.de> wrote:

> It's not as pretty as debugging elisp code.  (I really hope
> someone making the debugging guile code as awesome as debugging
> elisp).

GSoC project?

(I'm neither a student nor an official contributor, but would love to
help, even from the sidelines.)


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

end of thread, other threads:[~2021-02-12  5:14 UTC | newest]

Thread overview: 3+ 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
2021-02-12  3:16   ` Services related project for GSoC? Was: " raingloom

unofficial mirror of help-guix@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-user/0 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/ https://yhetil.org/guix-user \
		help-guix@gnu.org
	public-inbox-index guix-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.user
	nntp://news.gmane.io/gmane.comp.gnu.guix.user


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