Plenty of unit files on the internet say After=network.target and assume the service now waits for the network. It doesn’t, really, and I think that one line explains a good share of the “works when I restart it by hand, fails at boot” complaints.
network.target is a passive unit. It says little more than “the network management stack has started”, so it barely delays anything. A service that needs to reach another host at startup (mount a share, or talk to a database on 192.168.1.x) should use network-online.target. And it needs two lines, because After= only sets the order. It does not pull the target in. Wants= does that:
sudo systemctl edit myapp.service
[Unit]
Wants=network-online.target
After=network-online.target
Save the drop-in and the next boot starts myapp.service only after the network management software reports the network as up. What “up” means depends on the wait service that belongs to your setup: systemd-networkd-wait-online.service with systemd-networkd, NetworkManager-wait-online.service with NetworkManager. They are enabled along with their main service, but only used once something wants network-online.target. You can see which one is active with:
systemctl is-enabled NetworkManager-wait-online.service systemd-networkd-wait-online.service
The caveat is boot time. The target can add a real delay and times out after 90 seconds, so I’d only add it to services that consume something over the network. A daemon that just listens for others, like a web server, doesn’t need it; the systemd docs say the same.
Further reading: systemd.special(7) manual page, Running services after the network is up (systemd.io)