After restarting the Corteza server, there is a delay of approximately 1 minute before server-scripts with triggers are recognized and executed correctly. During this delay, the Corteza web application is accessible, but server-scripts do not seem to be fully initialized or operational.
Immediately After Restart:
The Corteza web application becomes accessible.
Adding a record in a module does not trigger server-scripts as expected.
The “Admin / Corredor Scripts” section remains empty.
After About 1 Minute:
Adding a record in a module causes the server-scripts to execute as expected.
The “Admin / Corredor Scripts” section has the list of scripts
In my docker-compose.yaml file, the server service depends on the corredor service.
In this log, it took about 10 seconds for the script to be registered while the Corteza server was operational.
Could you please advise on how to ensure that the Corteza server or its web application does not become fully operational until the Corredor service has completely initialized and processed all scripts ?
This configuration actually has only 1 server script. I guess with more scripts the delay can be bigger.
Corridor service is already added to depende_on docker-compose yaml.
Corridor server actually starts, but for some reasons, it takes some time to read the scripts.
I thought about two solutions :
1. Edit the initial healthcheck on corteza server:
→ Exemple in corteza/server/pkg/corredor/healthcheck.go
→ Add a condition that throws an error if corridor didn’t read all scripts via communication with corridor server
2. Edit the corteza-server-corredor to wait for the scripts to be read:
→ edit ENTRYPOINT / healthcheck to make it wait for a ready flag
→ edit server-script.ts to make the ready flag once the loader finishes its job.
I think solution number 1 is better but solution number 2 seems to be simpler.
I will try to make a pull request with the modifications for solution 2 but I might need some help.
In Docker Compose versions 3.x and above, the condition field in depends_on was removed. which makes waiting for another service to be healthy impossible.
I noticed the problem when a user created a record just after the server restarted. A server script was supposed to do the auto-increment but it did’t happened. After some debugging I noticed that corridor restart working after some delay.
I was able to resolve the problem with :
→ for corteza : adding condition: service_healthy to depends_on option (some stackoverflow posts said that condition where removed but after some digging it was not true).
→ for corridor : editing healthcheck : [“CMD”, “nc”, “-z”, “-v”, “corredor”, “53051”]
Corteza won’t start before corridor starts and with state healthy (instead of starting).
{"level":30,"time":1723154801706,"name":"gRPC","msg":"server stopped","v":1}
{"level":30,"time":1723154825831,"name":"check","msg":"checking API endpoints","v":1}
It means that corredor takes around 24 seconds to start.