Skip to content
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

feat: Add script to suspend Indexers #829

Merged
merged 9 commits into from
Jun 25, 2024
Merged

Conversation

morgsmccauley
Copy link
Collaborator

This PR adds a Node script to Runner to suspend Indexers due to inactivity. The script will:

  1. Call Coordinator to disable the indexer
  2. Write to the Indexers logs table to notify of suspension

Note that as Coordinator is in a private network, you must tunnel to the machine to expose the gRPC server. This can be achieved via running the following in a separate terminal:

gcloud compute ssh ubuntu@queryapi-coordinator-mainnet -- -L 9003:0.0.0.0:9003

The following environment variables are required:

  • HASURA_ADMIN_SECRET
  • HASURA_ENDPOINT
  • PGPORT
  • PGHOST

All of which can be found in the Runner compute instance metadata:

gcloud compute instances describe queryapi-runner-mainnet

Usage: npm run script:suspend-indexer -- <accountId> <functionName>

@morgsmccauley morgsmccauley requested a review from a team as a code owner June 24, 2024 02:50
const pgCredentials = await new Provisioner().getPostgresConnectionParameters(config.userName());

await new IndexerMeta(config, pgCredentials).writeLogs([
LogEntry.systemInfo('Suspending Indexer due to inactivity'),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkudinov let me know if you want me to expand on this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indexer is suspended due to inactivity.

@morgsmccauley morgsmccauley merged commit ec17eee into main Jun 25, 2024
3 checks passed
@morgsmccauley morgsmccauley deleted the feat/suspend-indexer-script branch June 25, 2024 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Script to manually stop indexers with no GraphQL queries in the past 7 days
2 participants