Raspberry Debian 11: How automatically open http://localhost:1880/ui after node-red service start?

Dear All,
I have a raspberry pi3 with Raspbian 11 "bullseye", kernel 6.1 and the "old X11 server" with LXDE.
I have Node-Red v4 installed and enabled via "sudo systemctl enable nodered.service"
I want that after Node-red is starded and fully working, the web brower automatically open and show the Dashboard: "chromium-browser --kiosk http://localhost:1880/ui"

Which is the best and better way to do this?

  1. modify the "/lib/systemd/system/nodered.service" adding:
ExecStartPost=/bin/bash -c "sleep 15 && DISPLAY=:0 chromium-browser --kiosk http://localhost:1880/ui &"

AFTER the line:
ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS

  1. make a new systemd services: EXAMPLE:
    sudo nano /etc/systemd/system/chromium-dashboard.serviceOther way?

adding:

Description=Dashboard Chromium Kiosk Mode.
After=nodered.service
Requires=nodered.service
Display=:0

[Service]
User=pi
Group=pi
Environment=DISPLAY=:0
ExecStartPre=/bin/sleep 30  # ritardo avvio...
ExecStart=/usr/bin/chromium-browser --noerrdialogs --disable-infobars --kiosk http://localhost:1880/ui
Restart=on-failure
RestartSec=5

[Install]
WantedBy=graphical.target`

Thanks in advance

Do those ideas work?

The best way would likely be to use the power of systemd. Create a new service script that starts the kiosk browser but that makes it dependent on both the Node-RED service and, presumably, the startup of the desktop on which it relies.

Dear All,
Im using this SystemD services:

[Unit]
Description=Chromium Node-red startUp
After=nodered.service
Requires=nodered.service 

[Service]
User=pi
Group=pi
Environment=DISPLAY=:0
ExecStartPre=/bin/sleep 30
ExecStart=chromium-browser --noerrdialogs --disable-infobars --start-fullscreen --incognito http://localhost:1880/ui
Restart=on-failure
RestartSec=5

[Install]
WantedBy=graphical.target

Does it work?

YES, very well.

Good, so if the problem is solved please click the Solved checkbox at the bottom of the post that provides the solution so that others will know there is no need post further help on this.