Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Disable voyager when running on Saturn node #3

Merged
merged 3 commits into from
Mar 12, 2024

Conversation

juliangruber
Copy link
Member

const ip = await getPublicIPv4Address()
const subdomain = ip.replaceAll('.', '-')
try {
await fetch(`https://${subdomain}.l1s.saturn.ms/`, {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure this is enough, at least for now, but I want @hannahhoward to double check my reasoning that if this returns anything at all there is a Saturn node running on the given IP - couldn't think of any cases where that wouldn't be true (aside from maybe some node startup/shutdown edge cases that probably aren't worth worrying about right now?) but also worth noting that I'm still feeling my way around the Saturn codebase so might be missing something!

This definitely seems worth shipping now in any case - we can refine as we go!

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, let's merge if there is pressure to do so, otherwise wait for @hannahhoward's review?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's totally fine to wait, this isn't "need it today" urgent as far as I know!

Copy link
Collaborator

Choose a reason for hiding this comment

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

have we tested this against an actual saturn node to verify it accepts an HTTP connection at root?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If this doesn't end up working, you can definitely use /ipfs with the health check cid -- https://github.com/filecoin-saturn/orchestrator/blob/651e34809ac02cf174f6fa9444524b8624132b1c/src/cron/health-check.js#L26

Copy link
Member Author

Choose a reason for hiding this comment

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

I've tested this with an actual Saturn node, and it worked 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

On the root address, it will redirect to saturn.ms, so it's a good http response code

voyager.js Outdated Show resolved Hide resolved
Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

There is a lot of code churn here because of indentation changes and the function runSaturBenchmarkInterval() is becoming a bit of a spaghetti code.

Would you mind keeping the benchmark implementation inside a smaller function (this will preserve indentation/avoid code churn) and move the saturn-check to a new function?

export async function runSaturnBenchmark() {
  // original code from runSaturnBenchmarkInterval 
}

export async function runSaturnBenchmarkInterval() {
  // add the check for running on a Saturn node
  // call runSaturnBenchmark when not running on a Saturn node
}

@juliangruber juliangruber requested a review from bajtos March 6, 2024 11:54
Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

Much better! 👏🏻

It would be nice to add some automated tests to verify the code works as intended or at least document the steps for verifying this feature manually.

@juliangruber
Copy link
Member Author

juliangruber commented Mar 6, 2024

Tests will be added once Voyager settles. Atm it's still too much of a moving target

Copy link
Collaborator

@hannahhoward hannahhoward left a comment

Choose a reason for hiding this comment

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

LGTM

const ip = await getPublicIPv4Address()
const subdomain = ip.replaceAll('.', '-')
try {
await fetch(`https://${subdomain}.l1s.saturn.ms/`, {
Copy link
Collaborator

Choose a reason for hiding this comment

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

have we tested this against an actual saturn node to verify it accepts an HTTP connection at root?

const ip = await getPublicIPv4Address()
const subdomain = ip.replaceAll('.', '-')
try {
await fetch(`https://${subdomain}.l1s.saturn.ms/`, {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this doesn't end up working, you can definitely use /ipfs with the health check cid -- https://github.com/filecoin-saturn/orchestrator/blob/651e34809ac02cf174f6fa9444524b8624132b1c/src/cron/health-check.js#L26

@juliangruber juliangruber merged commit 4eef1b2 into main Mar 12, 2024
@juliangruber juliangruber deleted the remove/saturn-testing-on-saturn-node branch March 12, 2024 15:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants