pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Server start with systemd and configured with IP address
2+ messages / 2 participants
[nested] [flat]

* Server start with systemd and configured with IP address
@ 2022-10-11 20:52  PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Doc comments form @ 2022-10-11 20:52 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: pablito.federico@gmail.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/server-start.html
Description:

The url of the document is
https://www.postgresql.org/docs/current/server-start.html
My suggestion is add to the documentation in the segment that shows the
systemd entry inside the [Unit] segment the line
After=network-online.target

I saw in several sites that most people recommends using
After=network.target

but this will fail if the server is configured to listen on a specific IP
address instead of just localhost or 127.0.0.1
the differences between them is explained here
https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/#conceptsinsystemd
TLDR; network.target is after the network is up (but presumably without
address set, just the network stack)  and network-online.target is after an
IP address has been set.

Best Regards
Pablo.


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

* Re: Server start with systemd and configured with IP address
@ 2022-10-12 14:38  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Doc comments form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2022-10-12 14:38 UTC (permalink / raw)
  To: pablito.federico@gmail.com; +Cc: pgsql-docs@lists.postgresql.org

PG Doc comments form <noreply@postgresql.org> writes:
> My suggestion is add to the documentation in the segment that shows the
> systemd entry inside the [Unit] segment the line
> After=network-online.target

> I saw in several sites that most people recommends using
> After=network.target

> but this will fail if the server is configured to listen on a specific IP
> address instead of just localhost or 127.0.0.1

Yeah, I have also found with other daemons that if you use specific
IP addresses in the configuration, you need network-online.target.
Some references suggest that you *also* need to say
Wants=network-online.target [1].

It might be that network.target is sufficient if you just bind to
"*", but considering that we're not mentioning that either right
now, I don't see a need to discuss the difference.

(Down the road, maybe we should consider using IP_FREEBIND on
Linux, as suggested at [1] ... although that hobbles error
detection, so I'm not really sold that it's such a great idea.)

			regards, tom lane

[1] https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/





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


end of thread, other threads:[~2022-10-12 14:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-10-11 20:52 Server start with systemd and configured with IP address PG Doc comments form <noreply@postgresql.org>
2022-10-12 14:38 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox