ci: local environment checks health before creating assets#2220
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the reliability of the local Rafiki dev environment by adding explicit readiness gating before the setup script performs authenticated admin GraphQL operations (tenant/assets/liquidity). This reduces flaky first-run behavior (notably when Postgres/Redis take longer to become usable) and avoids known pagination limits when listing assets.
Changes:
- Switch local Rafiki setup defaults from
localhostto127.0.0.1to avoid IPv6localhostresolution issues on Node 18+. - Add configurable readiness polling and a new “admin GraphQL is answering signed requests” probe before creating/ensuring assets.
- Add Docker Compose healthchecks for Postgres/Redis and gate Rafiki containers on those checks; align asset pagination
firstwith Rafiki’s cap.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| local/scripts/rafiki-setup.js | Adds readiness configuration, admin-API readiness probe, safer defaults for endpoints, and reduces asset list pagination to 100. |
| local/redis.yaml | Adds a Redis container healthcheck to support health-based dependency gating. |
| local/rafiki.yaml | Updates depends_on to wait for Postgres/Redis to be healthy before starting Rafiki services. |
| local/postgres.yaml | Adds a Postgres healthcheck to prevent dependent services from starting before DB is accepting connections. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
MihaiAndrei98
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR - Makes the local environment setup script more robust
The local environment scripts would sometimes cause silent failures thereby confusing users in cases where the database would take a long time to start. For some reason this used to be an issue especially in Mac environments.
This PR adds better error handling and health checks to mitigate these types of problems in the future.
Generated description
This pull request makes several improvements to the local development environment, focusing on more robust service readiness checks, better handling of service dependencies, and improved reliability of the Rafiki setup process. The changes ensure that dependent services only start after Postgres and Redis are fully ready, preventing startup failures and race conditions. The Rafiki setup script is enhanced to probe the admin GraphQL API for true readiness, and several configuration options are made tunable for slow environments. Additionally, minor fixes and improvements are included for asset pagination and cleaning scripts.
Service Readiness and Dependency Handling:
healthchecksections topostgres(local/postgres.yaml) andredis(local/redis.yaml) services to ensure they are actually ready before dependents start. This prevents race conditions where services attempt to connect before the database or cache is initialized. [1] [2]depends_oninlocal/rafiki.yamlso that Rafiki services wait for Postgres and Redis to be healthy before starting, using Docker Compose'scondition: service_healthy. This avoids migration and seeding failures during container startup. [1] [2]Rafiki Setup Script Improvements:
/healthz), preventing transient authentication errors during setup. Readiness parameters are now configurable via environment variables for flexibility on slower systems. [1] [2] [3] [4]localhostto127.0.0.1to avoid IPv6 resolution issues in Node 18+ that can cause connection failures with Docker's published ports.Other Fixes and Improvements:
cleanscript inpackage.jsonto also bring down and reset local Docker services, ensuring a more thorough cleanup.