Skip to content

Feat: (Health check) Check alt_ip if web domain is not accessible#768

Merged
metalisk merged 121 commits intodevfrom
feature/alternative-ip
Feb 20, 2026
Merged

Feat: (Health check) Check alt_ip if web domain is not accessible#768
metalisk merged 121 commits intodevfrom
feature/alternative-ip

Conversation

@graycraft
Copy link
Copy Markdown
Member

@graycraft graycraft commented Apr 20, 2025

Task check list

Task description

To test this complex algorithm clearly, in the src/config/development.json leave only one list with one entry.
There are 3 possible cases, let's take a look at the example of ADAMANT nodes:

  1. Domain is available, use domain.
{
  "adm": {
    "nodes": {
      "list":[
        {
          "url": "https://debate.adamant.im",
          "alt_ip": "http://95.216.161.113:36666"
        }
      ]
    }
  }
}

Screenshot from 2025-06-08 03-14-43

  1. Domain is unavailable, try to use IP.
{
  "adm": {
    "nodes": {
      "list":[
        {
          "url": "https://abc.adamant.im",
          "alt_ip": "http://95.216.161.113:36666"
        }
      ]
    }
  }
}

Screenshot from 2025-06-08 03-17-36

  1. Domain is unavailable, IP is unavailable.
{
  "adm": {
    "nodes": {
      "list":[
        {
          "url": "https://abc.adamant.im",
          "alt_ip": "http://123.123.123.123:36666"
        }
      ]
    }
  }
}

Screenshot from 2025-06-08 03-39-37

Remember to filter out log messages and leave only console.info

Screenshot from 2025-06-08 03-59-06

Test cases

url: tauri.adm.im
alt_ip: 154.26.159.245:36666

The application tries a health check (api/node/status) on the domain tauri.adm.im.

a) Domain is accessible

  • Save this state, and all subsequent requests (both health checks and data requests) go to tauri.adm.im.
  • The "by domain" status is kept until the page is reloaded or the checkbox is toggled.
  • If later a health check request fails, the node is considered (temporarily) offline, but health checks continue as before.
    This is not a node ban — the node may be temporarily offline.

b) Domain is not accessible

  • The application tries a health check (api/node/status) on IP 154.26.159.245:36666.
  • If the IP is accessible, save this state and all subsequent requests go to 154.26.159.245:36666.
  • The "by IP" status is kept until the page is reloaded or the checkbox is toggled.
  • If later a health check request fails, the node is considered (temporarily) offline, but health checks continue as before.
    This is not a node ban — the node may be temporarily offline.

c) Neither domain nor IP is accessible

  • We cannot be sure the node is unavailable. It may be a temporary node or internet failure.
  • There will be no "by domain" or "by IP" status.
  • Start again from step 1.

@graycraft graycraft added the enhancement New feature or request label Apr 20, 2025
@graycraft graycraft self-assigned this Apr 20, 2025
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
adamant-im Ready Ready Preview, Comment Feb 20, 2026 11:16am

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2025

Deployed to https://msg-adamant-pr-768.surge.sh 🚀

@graycraft
Copy link
Copy Markdown
Member Author

@graycraft graycraft marked this pull request as ready for review April 21, 2025 21:08
@graycraft graycraft requested a review from a team as a code owner April 21, 2025 21:08
Comment thread src/lib/nodes/abstract.node.ts Outdated
Comment thread src/lib/nodes/abstract.node.ts Outdated
Comment thread src/lib/nodes/abstract.node.ts Outdated
@dvelikiy
Copy link
Copy Markdown
Collaborator

dvelikiy commented Apr 28, 2025

The logic becomes more complex, it'd be good to write tests for different use-cases.

@adamantmm
Copy link
Copy Markdown
Member

@S-FrontendDev @bludnic
Please review

Comment thread src/lib/nodes/abstract.node.ts
Comment thread src/lib/nodes/adm/AdmNode.ts
Comment thread src/lib/nodes/adm/index.ts Outdated
Comment thread src/lib/nodes/abstract.node.ts Outdated
Comment thread src/lib/nodes/eth/EthNode.ts Outdated
Comment thread src/lib/nodes/rate-info-service/RateInfoService.ts
@metalisk
Copy link
Copy Markdown
Member

Connection selection and persistence rules (for nodes with url + alt_ip):

  1. Start by checking the domain (url).
  2. If the domain check succeeds first, lock the connection type to DOMAIN for the current session.
  3. If the domain check fails, immediately try alt_ip in the same health-check cycle.
  4. If the alt_ip check succeeds first, lock the connection type to IP for the current session.
  5. Once the connection type is determined (DOMAIN or IP), do not switch it during the session.
  6. If later requests/health checks fail after the type is determined, keep retrying the same determined type and treat the node as temporarily offline when checks fail.
  7. If neither domain nor alt_ip is reachable while the type is still not determined, keep retrying both in this order on each cycle: DOMAIN -> IP, until one succeeds.

Session scope: keep the selected type until page reload or until the node is toggled off/on by the user.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 97 out of 98 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib/nodes/abstract.node.ts
Comment thread src/lib/nodes/abstract.node.ts
Comment thread src/lib/nodes/abstract.node.ts
Comment thread src/lib/nodes/adm/AdmNode.ts
Comment thread src/lib/nodes/ipfs/IpfsNode.ts
Comment thread vite-pwa.config.ts Outdated
Comment thread src/store/modules/chat/index.js Outdated
Comment thread src/components/LoginPasswordForm.vue Outdated
Comment thread src/lib/nodes/abstract.node.ts
@al-onyxprotocol
Copy link
Copy Markdown
Member

@cursor review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 101 out of 102 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib/nodes/abstract.node.ts
Comment thread .husky/pre-commit
Comment thread src/lib/nodes/abstract.node.ts
Comment thread src/lib/nodes/abstract.node.ts
Comment thread src/views/devScreens/DevScreens.vue
@github-actions
Copy link
Copy Markdown

Successfully tore down https://msg-adamant-pr-768.surge.sh 🥲

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

APIs API design, endpoints, and integrations enhancement New feature or request JavaScript Frontend or backend code in JavaScript Nodes ADM node software issues, APIs, connectivity, consensus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat, Enhancement] Health-check: Check alt_ip if web domain is not accessible

10 participants