-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --existing-hasura-url flag for indexer API in localnet #15313
Merged
Conversation
This file contains 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
⏱️ 1h 20m total CI duration on this PR
|
banool
force-pushed
the
banool/existing-hasura-localnet
branch
3 times, most recently
from
November 19, 2024 12:20
8a9830d
to
a840543
Compare
gregnazario
approved these changes
Nov 19, 2024
banool
force-pushed
the
banool/existing-hasura-localnet
branch
from
November 19, 2024 14:01
a840543
to
1866021
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
GhostWalker562
approved these changes
Nov 19, 2024
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.
Description
With the CLI as it is right now, it is difficult to run a localnet in a Docker Compose environment given the localnet itself tries to create Docker containers. You can get around this by binding the host Docker daemon socket into the localnet container but it isn't very ergonomic or cross platform. To that end, we add support here for the
--existing-hasura-url
flag. If this is set, we won't try to run Hasura, but will just trust that Hasura is already running there and we'll apply the metadata after the processors have been started. With this and--use-host-postgres
combined it is possible to use--with-indexer-api
without the localnet ever trying to run anything with Docker.How Has This Been Tested?
Normal case
Run a localnet normally, see that it still works:
Existing Hasura instance
Run a postgres instance:
Create the
local_testnet
database:Run Hasura locally by hand:
Run a localnet with an existing DB and Hasura instance:
See that the localnet comes up successfully:
When I visit http://127.0.0.1:8092/console I see that the metadata is applied and I can make queries successfully.
Note that you can't use
--force-restart
when--use-host-postgres
and--existing-hasura-url
are both set because Hasura is already connected to the DB. We figure this is fine because you should only be using--existing-hasura-url
if you're doing something like running the localnet in a Docker Compose setup and you're creating a fresh DB every time anyway.Skip metadata apply
See that the
--skip-metadata-apply
flag works:After this the localnet comes up successfully but the Hasura instance is unconfigured.
Key Areas to Review
Ensure the logic is correct, especially confirming that Docker isn't required for the localnet if the appropriate combination of flags is specified.
Type of Change
Which Components or Systems Does This Change Impact?
Checklist