-
Notifications
You must be signed in to change notification settings - Fork 2
Disable voyager when running on Saturn node #3
Conversation
const ip = await getPublicIPv4Address() | ||
const subdomain = ip.replaceAll('.', '-') | ||
try { | ||
await fetch(`https://${subdomain}.l1s.saturn.ms/`, { |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 👍
There was a problem hiding this comment.
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
There was a problem hiding this 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
}
There was a problem hiding this 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.
Tests will be added once Voyager settles. Atm it's still too much of a moving target |
There was a problem hiding this 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/`, { |
There was a problem hiding this comment.
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/`, { |
There was a problem hiding this comment.
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
As requested in https://filecoinproject.slack.com/archives/C06DF14LGUA/p1709071237385749