You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we should support something like that for YARP ports as well, since most commands in docker-compose.yml files for YARP, are something like this: yarp wait /root; yarp wait /foo; yarp wait /bar; do_something.
At the moment yarp wait supports only waiting for one single port or connection.
First of all, it would be useful to support multiple ports instead of just one. For example the command above would become: yarp wait /root /foo /bar; do_something.
The second idea would be to add an environment variable YARP_WAIT_PORT which yarp wait will check when started without any extra arguments (we could eventually support also YARP_WAIT_CONNECTION). Assuming that the environment variable is set in some other way externally (for example with the environment section of the YAML file). This would change the command to run to yarp wait; do_something. This could also be used by inserting yarp wait directly in the entry point of the docker image. In this way the user will just have to pass the environment variable and run the command normally.
Another risky idea would be to add it directly in the yarp::os::NetworkBase constructor. In this way any module calling yarp::os::Network yarp will automatically stop and wait for the required ports. I'm afraid this might be dangerous, and cause unexpected issues, though.
Yet another option is to recommend the usage of NetworkBase::waitPort() in all the modules that expect certain ports to be available. Nonetheless I'm a bit confused whether this should be before or after the Network initialization, since all the modules expect that /root (or whatever namespace is configured) is available when the Network object is created, and therefore this should just be enabled for all the modules, except the yarp server.
Just for reference, in a docker-compose.yml file, even if you set a dependency on another service, this does not mean that the executable will be ready when your service is started, and that the ports will be opened. In fact this has been a problem causing random runtime issues, forcing me to add yarp wait /root before all the yarp commands, because even if depends_on was properly configured, the modules were started randomly before the yarp server, hence opening anonymous ports.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm moving the discussion here, since this is something that might be of interest for other people.
I found out about this script for docker compose, which is useful to wait for a (system) port to be opened, before starting the executable: https://github.com/ufoscout/docker-compose-wait/
I think we should support something like that for YARP ports as well, since most commands in
docker-compose.yml
files for YARP, are something like this:yarp wait /root; yarp wait /foo; yarp wait /bar; do_something
.At the moment
yarp wait
supports only waiting for one single port or connection.First of all, it would be useful to support multiple ports instead of just one. For example the command above would become:
yarp wait /root /foo /bar; do_something
.The second idea would be to add an environment variable
YARP_WAIT_PORT
whichyarp wait
will check when started without any extra arguments (we could eventually support alsoYARP_WAIT_CONNECTION
). Assuming that the environment variable is set in some other way externally (for example with theenvironment
section of the YAML file). This would change the command to run toyarp wait; do_something
. This could also be used by insertingyarp wait
directly in the entry point of the docker image. In this way the user will just have to pass the environment variable and run the command normally.Another risky idea would be to add it directly in the
yarp::os::NetworkBase
constructor. In this way any module callingyarp::os::Network yarp
will automatically stop and wait for the required ports. I'm afraid this might be dangerous, and cause unexpected issues, though.Yet another option is to recommend the usage of
NetworkBase::waitPort()
in all the modules that expect certain ports to be available. Nonetheless I'm a bit confused whether this should be before or after theNetwork
initialization, since all the modules expect that/root
(or whatever namespace is configured) is available when theNetwork
object is created, and therefore this should just be enabled for all the modules, except theyarp server
.Just for reference, in a
docker-compose.yml
file, even if you set a dependency on another service, this does not mean that the executable will be ready when your service is started, and that the ports will be opened. In fact this has been a problem causing random runtime issues, forcing me to addyarp wait /root
before all the yarp commands, because even ifdepends_on
was properly configured, the modules were started randomly before the yarp server, hence opening anonymous ports.Beta Was this translation helpful? Give feedback.
All reactions