all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#59515: nginx: Fails to start on boot while upstream service is not yet running
@ 2022-11-23 15:34 Jonathan Brielmaier
  2022-11-23 17:35 ` mirai
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jonathan Brielmaier @ 2022-11-23 15:34 UTC (permalink / raw)
  To: 59515

When I start my personal server with a radicale service behind a nginx
reverse proxy, nginx fails to start.

The relevant part in the log:
Nov 23 16:02:56 localhost shepherd[1]: Service networking has been started.
Nov 23 16:02:56 localhost shepherd[1]: Service radicale has been started.
Nov 23 16:02:56 localhost shepherd[1]: Service ssh-daemon has been started.
Nov 23 16:02:56 localhost shepherd[1]: [nginx] nginx: [emerg] host not
found in upstream "localhost:5232" in
/gnu/store/y29zl57pprwxbcxfx593s16456kxk99y-nginx.conf:15
Nov 23 16:02:56 localhost shepherd[1]: Failed to start nginx in the
background.

The config can be found here:
https://gitlab.com/jonsger/jonsger-guix/-/blob/master/config/baebia.scm#L116
```
(upstream-blocks (list
   (nginx-upstream-configuration
     (name "radicale")
     (servers (list "localhost:5232")))))
```

I wonder whats going wrong here. Is there a way to define that nginx
service should wait until radicale service is started?

~Jonathan




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

* bug#59515: nginx: Fails to start on boot while upstream service is not yet running
  2022-11-23 15:34 bug#59515: nginx: Fails to start on boot while upstream service is not yet running Jonathan Brielmaier
@ 2022-11-23 17:35 ` mirai
  2022-11-25  8:56 ` Jonathan Brielmaier
  2023-03-21 23:02 ` Jonathan Brielmaier
  2 siblings, 0 replies; 6+ messages in thread
From: mirai @ 2022-11-23 17:35 UTC (permalink / raw)
  To: 59515

nginx-configuration has a 'shepherd-requirement' parameter that can be used here




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

* bug#59515: nginx: Fails to start on boot while upstream service is not yet running
  2022-11-23 15:34 bug#59515: nginx: Fails to start on boot while upstream service is not yet running Jonathan Brielmaier
  2022-11-23 17:35 ` mirai
@ 2022-11-25  8:56 ` Jonathan Brielmaier
  2022-11-27 21:14   ` Ludovic Courtès
  2023-03-21 23:02 ` Jonathan Brielmaier
  2 siblings, 1 reply; 6+ messages in thread
From: Jonathan Brielmaier @ 2022-11-25  8:56 UTC (permalink / raw)
  To: 59515

Ah thanks.

I added `(shepherd-requirement '(radicale))` to my nginx-configuration.
Sadly the issue is not fixed, the situation is the same as before.

I assume that radicale takes a fracture of a second to start. And nginx
starts faster up. See this small experiment:

$ sudo herd stop radicale
$ sudo herd start radicale; curl localhost:5232
Service radicale has been started.
curl: (7) Failed to connect to localhost port 5232 after 0 ms:
Verbindungsaufbau abgelehnt

$ sudo herd stop radicale
$ sudo herd start radicale; sleep 0.2; curl localhost:5232
Service radicale has been started.
Redirected to /.web




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

* bug#59515: nginx: Fails to start on boot while upstream service is not yet running
  2022-11-25  8:56 ` Jonathan Brielmaier
@ 2022-11-27 21:14   ` Ludovic Courtès
  2023-01-02 17:09     ` Jonathan Brielmaier
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2022-11-27 21:14 UTC (permalink / raw)
  To: Jonathan Brielmaier; +Cc: 59515

Jonathan Brielmaier <jonathan.brielmaier@web.de> skribis:

> I added `(shepherd-requirement '(radicale))` to my nginx-configuration.
> Sadly the issue is not fixed, the situation is the same as before.
>
> I assume that radicale takes a fracture of a second to start. And nginx
> starts faster up. See this small experiment:

That looks like a bug in the radicale service: there’s no
synchronization upon startup:

--8<---------------cut here---------------start------------->8---
     (list (shepherd-service
            (provision '(radicale))
            (documentation "Run the radicale daemon.")
            (requirement '(networking))
            (start #~(make-forkexec-constructor
                      (list #$(file-append package "/bin/radicale")
                        "-C" #$config-file)
                      #:user "radicale"
                      #:group "radicale"))
            (stop #~(make-kill-destructor))))
--8<---------------cut here---------------end--------------->8---

It should wait for a PID file or be started as a systemd or inetd
service.  That way, we’d be sure that shepherd considers it started once
it’s really listening for input.  A quick grep in the source suggests it
creates a PID file somewhere.

HTH!

Ludo’.




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

* bug#59515: nginx: Fails to start on boot while upstream service is not yet running
  2022-11-27 21:14   ` Ludovic Courtès
@ 2023-01-02 17:09     ` Jonathan Brielmaier
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Brielmaier @ 2023-01-02 17:09 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 59515

On 27.11.22 22:14, Ludovic Courtès wrote:> That looks like a bug in the
radicale service: there’s no
> synchronization upon startup:

I think its rather an issue with nscd, networking or some other base
service.

Changing the nginx configuration from
(servers (list "localhost:5232"))
to
(servers (list "127.0.0.1:5232"))
resolves the issue for me :)

> It should wait for a PID file or be started as a systemd or inetd
> service.  That way, we’d be sure that shepherd considers it started once
> it’s really listening for input.  A quick grep in the source suggests it
> creates a PID file somewhere.

I couldn't find any PID file on my server of radicale. But there seems
to by a .lock file: /var/lib/radicale/collections/.Radicale.lock
No idea if that would be helpful...

~Jonathan




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

* bug#59515: nginx: Fails to start on boot while upstream service is not yet running
  2022-11-23 15:34 bug#59515: nginx: Fails to start on boot while upstream service is not yet running Jonathan Brielmaier
  2022-11-23 17:35 ` mirai
  2022-11-25  8:56 ` Jonathan Brielmaier
@ 2023-03-21 23:02 ` Jonathan Brielmaier
  2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Brielmaier @ 2023-03-21 23:02 UTC (permalink / raw)
  To: 59515-done

Closing.
Workaround with using "127.0.0.1" instead of "localhost" provided.




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

end of thread, other threads:[~2023-03-21 23:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23 15:34 bug#59515: nginx: Fails to start on boot while upstream service is not yet running Jonathan Brielmaier
2022-11-23 17:35 ` mirai
2022-11-25  8:56 ` Jonathan Brielmaier
2022-11-27 21:14   ` Ludovic Courtès
2023-01-02 17:09     ` Jonathan Brielmaier
2023-03-21 23:02 ` Jonathan Brielmaier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.