ProjectLibertyLabs / social-app-template

Social Application Template that uses Gateway Services
Apache License 2.0
1 stars 4 forks source link

Fix Startup Race conditions when using local frequency node #175

Open mattheworris opened 1 week ago

mattheworris commented 1 week ago

Description

When starting social-app-template with a local node, there is a race condition with the startup of the gateway services and the frequency node. If the services come up before the node, the provider seed phrase validation fails.

Steps to Reproduce

  1. Execute start.sh
  2. Accept all of the defaults
  3. Check docker logs to see that one or more of the workers have failed to verify the seed phrase and exited.

Solution

JoeCap08055 commented 1 week ago

I don't think the issue is that Frequency isn't running. docker-compose.local-frequency.yaml includes a dependency on frequency: service_healthy for all Gateway services.

The issue, I think, is that although the chain is up, the provider hasn't been provisioned yet when the Gateway services come up, so seed phrase validation fails.

Potential solution:

Define a custom HEALTHCHECK command for the local frequency service that runs a curl jsonrpc query to get the provider info for provider 1; when that returns with the the expected value, the service is healthy.