<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Night Time Experiments]]></title><description><![CDATA[Night Time Experiments]]></description><link>https://articles.narahari.dev</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 16:11:03 GMT</lastBuildDate><atom:link href="https://articles.narahari.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Private Overlay Networking on Akash: Connecting Independent Providers with Tailscale and DERP]]></title><description><![CDATA[Akash Is Built for This:
One of the most powerful things about Akash Network is that it lets you deploy workloads across a global, decentralized marketplace of providers — each bringing their own hard]]></description><link>https://articles.narahari.dev/private-mesh-networking-on-akash-connecting-workloads-across-providers-with-tailscale</link><guid isPermaLink="true">https://articles.narahari.dev/private-mesh-networking-on-akash-connecting-workloads-across-providers-with-tailscale</guid><category><![CDATA[akash network ]]></category><category><![CDATA[tailscale]]></category><category><![CDATA[infrastructure]]></category><category><![CDATA[networking]]></category><category><![CDATA[Security]]></category><dc:creator><![CDATA[Sandeep Narahari]]></dc:creator><pubDate>Sat, 28 Feb 2026 23:49:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/65204fbbcd73ad6a166f408b/45326425-bee2-455b-998e-7163b373313a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>Akash Is Built for This:</h2>
<p>One of the most powerful things about Akash Network is that it lets you deploy workloads across a global, decentralized marketplace of providers — each bringing their own hardware, location, and competitive pricing to the table. This diversity is a feature: it gives you geographic redundancy, cost flexibility, and true decentralization that no single cloud provider can match.</p>
<p>As you start building more sophisticated systems on Akash — distributed backends, AI inference pipelines, multi-region applications — a natural question comes up:</p>
<blockquote>
<p>How do my workloads, running on different providers, talk to each other securely?</p>
</blockquote>
<p>This is a real architectural challenge in any decentralized compute environment. Workloads on different providers exist in separate network namespaces. There are no guaranteed private subnets between providers. And for certain workloads like internal APIs, databases, model servers, job queues , you want communication to happen over a private channel, not the public internet</p>
<p>This guide walks through a clean, production-ready solution: <strong>building a private encrypted mesh network across your Akash deployments using Tailscale.</strong> It's lightweight, zero-configuration, and it runs entirely inside your containers.</p>
<h2>What Is Tailscale?</h2>
<p><a href="https://tailscale.com">Tailscale</a> is a mesh VPN built on WireGuard — the same cryptographic protocol trusted by major cloud providers and security researchers worldwide. Every device that joins a Tailscale network (called a "Tailnet") gets a stable private IP address in the <code>100.x.x.x</code> range, and encrypted peer-to-peer tunnels form automatically between nodes — even across NAT, firewalls, and different cloud environments.</p>
<p>For Akash deployments specifically, Tailscale's <strong>userspace networking mode</strong> (<code>--tun=userspace-networking</code>) is the key. It runs the WireGuard tunnel entirely in userspace, requiring no kernel-level TUN device — which means it works inside containers without any special privileges.</p>
<p>The result: your Akash workloads can form their own private network, no matter which providers they're running on.</p>
<h3>How DERP Works</h3>
<p>DERP servers are Tailscale's globally distributed relay network. When two nodes can't connect directly, their traffic is relayed through the nearest DERP server. Critically, <strong>the relay is end-to-end encrypted</strong> — DERP servers forward opaque WireGuard packets and have no ability to read the contents. The encryption keys never leave your nodes.</p>
<p>The result: your Akash workloads can form their own private encrypted network across providers, with traffic relayed through DERP when direct connections aren't available.</p>
<h2>The Architecture</h2>
<p>The pattern is straightforward. Each container:</p>
<ol>
<li><p>Starts the Tailscale daemon in userspace mode</p>
</li>
<li><p>Joins your private Tailnet using an auth key</p>
</li>
<li><p>Runs your actual service bound to <code>127.0.0.1</code></p>
</li>
</ol>
<p>Once all containers have joined the Tailnet, they can reach each other using their stable Tailscale IPs (<code>100.x.x.x</code>) — with end-to-end WireGuard encryption. Your internal service traffic stays inside the mesh and never needs to touch the public internet.</p>
<h2><strong>Get started</strong></h2>
<h3>Generating a Tailscale Auth Key</h3>
<ol>
<li><p>Log in to the <a href="https://login.tailscale.com/admin/settings/keys">Tailscale Admin Console</a></p>
</li>
<li><p>Go to <strong>Settings → Keys</strong></p>
</li>
<li><p>Click <strong>Generate auth key</strong></p>
</li>
<li><p>Select <strong>Reusable</strong> so multiple deployments can join using the same key</p>
</li>
<li><p>Copy the key — it will look like <code>tskey-auth-xxxx...</code></p>
</li>
</ol>
<h2>The SDL: Three Nodes, 3 Providers</h2>
<p>Here's a set of three Akash SDLs that each spin up a container, join a private Tailnet, and run a small HTTP server accessible only within the mesh. You'd deploy each one separately to get workloads distributed across providers.</p>
<pre><code class="language-yaml">version: "2.0"
services:
  backend:
    image: alpine:latest
    expose:
      - port: 8000
        as: 8000
        to:
          - global: true
    env:
      - TS_AUTHKEY=tskey-auth-YOUR_KEY_HERE
      - TS_HOSTNAME=akash-server-1
    command:
      - /bin/sh
      - "-c"
    args:
      - |
        apk add tailscale python3

        # Start Tailscale in userspace mode (works in containers, no kernel TUN needed)
        tailscaled --tun=userspace-networking --socks5-server=localhost:1055 &amp;
        sleep 5

        # Join the private Tailnet
        tailscale up \
          --authkey=$TS_AUTHKEY \
          --hostname=$TS_HOSTNAME \
          --reset \
          --accept-dns=false

        # Start the service — bound to loopback, reachable via Tailscale mesh
        echo "Hello from $TS_HOSTNAME" &gt; index.html
        python3 -m http.server 8000 --bind 127.0.0.1
profiles:
  compute:
    backend:
      resources:
        cpu:
          units: 0.5
        memory:
          size: 512Mi
        storage:
          size: 512Mi
  placement:
    dcloud:
      pricing:
        backend:
          denom: ibc/170C677610AC31DF0904FFE09CD3B5C657492170E7E52372E48756B71E56F2F1
          amount: 1000
      signedBy:
        anyOf:
          - akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63
        allOf: []
deployment:
  backend:
    dcloud:
      profile: backend
      count: 1
</code></pre>
<p><strong>Node 2</strong> — same SDL, change <code>TS_HOSTNAME</code> to <code>akash-server-2</code><br /><strong>Node 3</strong> — same SDL, change <code>TS_HOSTNAME</code> to <code>akash-server-3</code></p>
<p>Once all three are deployed and running, open your Tailscale admin console. You'll see all three nodes listed with their <code>100.x.x.x</code> private IPs, connected to each other.</p>
<p>With all nodes in the same Tailnet, inter-node communication is simple:</p>
<p>option : 1 through ip</p>
<pre><code class="language-shell">curl -x socks5h://127.0.0.1:1055 http://100.90.158.125:8000
</code></pre>
<p>option :2 through host name</p>
<pre><code class="language-shell">curl -x socks5h://127.0.0.1:1055 http://akash-server-1:8000
</code></pre>
<p>Because Akash containers sit behind NAT and don't own their network interfaces, Tailscale will typically route this traffic through the nearest <strong>DERP relay server</strong> rather than a direct P2P connection. The DERP server forwards opaque WireGuard ciphertext — it cannot read the contents. Your data stays end-to-end encrypted the whole way.</p>
<h2>Real-World Use Cases</h2>
<p>This pattern unlocks a range of distributed architectures that weren't straightforward to build on Akash before:</p>
<p><strong>Distributed AI Inference</strong><br />Run a coordinator node and multiple GPU worker nodes across different providers. The coordinator distributes inference jobs over the private mesh. Workers respond with results. No request payload is exposed to the public internet.</p>
<p><strong>Internal APIs and Microservices</strong><br />Build a microservices architecture where each service runs on the most cost-effective provider for its workload type. Service-to-service calls happen over the encrypted mesh. Only your public-facing gateway exposes a port to the world.</p>
<p><strong>Private Databases</strong><br />Run PostgreSQL or Redis bound to loopback. Only nodes in your Tailnet — authorized by ACL — can connect. Your database never appears on a port scan.</p>
<p><strong>Multi-Region Job Queues</strong><br />Distribute workers across geographic providers for latency-optimized job processing. Workers pull tasks from a coordinator over the mesh, results are returned the same way.</p>
<p><strong>Staging Environments</strong><br />Spin up an isolated Tailnet for a staging environment. Your staging services are completely unreachable from the outside world and from your production Tailnet — by design.</p>
<h3><strong>Conclusion:</strong></h3>
<p>This Tailscale pattern is specifically for the subset of workloads that have internal communication requirements — where services need to talk to each other and that communication is inherently private by design, the same way microservices in a Kubernetes cluster communicate over an internal network rather than the public internet. It doesn't change how you pay for compute, how providers are selected, or how the Akash marketplace works. Providers still get their bids, still run your containers, and still get paid.</p>
<p>Think of it as the Akash equivalent of Kubernetes' internal cluster networking — a pattern for building sophisticated distributed systems on top of the compute layer that Akash providers so reliably deliver.</p>
]]></content:encoded></item><item><title><![CDATA[Secure Overlay Networking for Redis on the Akash Network - PART-1
]]></title><description><![CDATA[When deploying on the Akash Network, builders unlock access to a global, decentralized marketplace of compute. However, shifting stateful workloads—like a High-Availability Redis cluster from traditio]]></description><link>https://articles.narahari.dev/secure-overlay-networking-for-redis-on-the-akash-network-part-1</link><guid isPermaLink="true">https://articles.narahari.dev/secure-overlay-networking-for-redis-on-the-akash-network-part-1</guid><dc:creator><![CDATA[Sandeep Narahari]]></dc:creator><pubDate>Mon, 23 Feb 2026 13:59:02 GMT</pubDate><enclosure url="https://cloudmate-test.s3.us-east-1.amazonaws.com/uploads/covers/65204fbbcd73ad6a166f408b/5ffd741d-475c-438f-9d9e-31798630c186.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When deploying on the <a href="http://console.akash.network">Akash Network</a>, builders unlock access to a global, decentralized marketplace of compute. However, shifting stateful workloads—like a High-Availability Redis cluster from traditional centralized clouds (like AWS or GCP or AZURE) to decentralized providers requires a paradigm shift in how we handle networking.</p>
<p>In a traditional cloud, you rely on a Virtual Private Cloud (VPC) to isolate your databases. On Akash, your compute leases might be distributed across multiple independent providers globally. There is no native, cross-provider VPC.</p>
<p>To achieve enterprise-grade security and reliable connectivity for stateful databases on Akash, we must decouple the network from the physical infrastructure. This first part of the masterclass covers how to build a <strong>Zero-Trust</strong>, <strong>encrypted overlay network</strong> using <strong>Tailscale</strong> within your <strong>Akash SDL</strong> (Stack Definition Language).</p>
<h3>1. The Architecture: Bridging Decentralized Providers</h3>
<p>When deploying a distributed database, the nodes must communicate with each other seamlessly. If a Redis Master is leased from a provider in North America and a Replica is leased from a provider in Europe, they cannot safely communicate over the open internet without an encryption layer.</p>
<p>An overlay network acts as a dynamic, software-defined VPC that travels directly inside your Akash containers.</p>
<p>By installing a mesh VPN (like Tailscale) inside the deployment, we achieve three architectural goals crucial for the Akash ecosystem:</p>
<ol>
<li><p><strong>End-to-End Encryption:</strong> All database replication and gossip protocols are routed through WireGuard tunnels, completely hidden from the underlying provider.</p>
</li>
<li><p><strong>Provider Agnosticism:</strong> Containers communicate using static <code>100.x.x.x</code> mesh IPs. You can close a lease, spin up a new one on a completely different provider, and the mesh network will seamlessly re-route the traffic.</p>
</li>
<li><p><strong>Zero-Trust Access:</strong> The database ports do not need to be exposed in the <code>expose</code> block of your Akash SDL, making them invisible to the public internet.</p>
</li>
</ol>
<h3>2. Securing the Database: Localhost Isolation on Public Compute</h3>
<p>A common oversight when deploying Redis on public cloud infrastructure is leaving the default binding open. Configuring <code>bind 0.0.0.0</code> tells the Redis process to listen for incoming connections on all available network interfaces.</p>
<p>From a Site Reliability Engineering perspective, the most secure database on decentralized compute is one that refuses to talk to the network at all.</p>
<p>We achieve absolute isolation by restricting Redis strictly to the container's loopback interface:</p>
<pre><code class="language-plaintext"># /etc/redis/redis.conf
bind 127.0.0.1
requirepass &lt;YOUR_STRONG_PASSWORD&gt;  # Instead of using only requirepass, using ACL is a better security practice.
</code></pre>
<p>By binding to <code>127.0.0.1</code>, Redis is now completely blind to the outside world and the underlying provider's network. It will only accept connections originating from inside its own container. We then use Tailscale to build a secure bridge into this isolated environment.</p>
<h3>3. The Mesh Overlay: Userspace Networking on Akash</h3>
<p>For security reasons, Akash providers drop elevated kernel privileges. This means containers do not have access to <code>/dev/net/tun</code>, which traditional VPNs require. To bypass this, we run the Tailscale daemon in <strong>userspace networking mode</strong>.</p>
<p>Once the node is authenticated to the mesh, we need a way to pass the encrypted mesh traffic to our isolated Redis instance. We use <code>tailscale serve</code>, a lightweight, built-in reverse proxy.</p>
<p>Here is the exact boot sequence to include in your deployment script:</p>
<pre><code class="language-plaintext"># 1. Start Tailscale in Userspace Mode
tailscaled --tun=userspace-networking --socks5-server=localhost:1055 &amp;

# 2. Authenticate the Node to the Mesh Network
tailscale up --authkey=\(TS_AUTHKEY --hostname=\)NODE_HOSTNAME --accept-dns=true

# 3. Route Mesh Traffic to the Local Database
tailscale serve --tcp=6379 127.0.0.1:6379

# 4. Start Redis in the background
proxychains4 -q redis-server /etc/redis/redis.conf &amp;
</code></pre>
<p>Redis is safely restricted to <code>127.0.0.1</code>, Tailscale is free to bind to the <code>6379</code> port on the mesh interface. Tailscale receives the encrypted WireGuard packets from other Akash deployments, decrypts them, and proxies them directly to Redis on localhost. Redis accepts the traffic because it appears to be entirely local.</p>
]]></content:encoded></item><item><title><![CDATA[How to create telegram bot token]]></title><description><![CDATA[Open the Telegram app.

Search for BotFather in the search bar.

Clicked on verified Botfather like the the below image
 

Open the chat and send any message, such as Hi.




click the command /newbot



Choose a name for your bot (for example, picoo...]]></description><link>https://articles.narahari.dev/how-to-create-telegram-bot-token</link><guid isPermaLink="true">https://articles.narahari.dev/how-to-create-telegram-bot-token</guid><category><![CDATA[telegram bot]]></category><category><![CDATA[bot]]></category><category><![CDATA[openclaw]]></category><category><![CDATA[clawdbot]]></category><category><![CDATA[botfather]]></category><dc:creator><![CDATA[Sandeep Narahari]]></dc:creator><pubDate>Wed, 18 Feb 2026 13:05:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/u4F54GIZWGI/upload/1e7c3b0539c06021a58f92ce8e06d0a1.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Open the <strong>Telegram</strong> app.</p>
<ol>
<li><p>Search for <strong>BotFather</strong> in the search bar.</p>
</li>
<li><p>Clicked on verified Botfather like the the below image</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771429945928/9032789a-c357-4e9c-838a-91a06039d76b.jpeg" alt class="image--center mx-auto" /></p>
</li>
<li><p>Open the chat and send any message, such as <strong>Hi</strong>.</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771418923115/f60c69d7-8761-4fc1-a347-e6328e41ab52.jpeg" alt class="image--center mx-auto" /></p>
<ol start="4">
<li>click the command <strong>/newbot</strong></li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771418946556/70cf6b0f-6b53-4b2c-8a59-d45e30359833.jpeg" alt class="image--center mx-auto" /></p>
<ol start="5">
<li>Choose a name for your bot (for example, <em>picoooo</em>).</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771418959709/f4512eff-11bc-40dd-9c97-1be9f61035bb.jpeg" alt class="image--center mx-auto" /></p>
<ol start="6">
<li>Choose the unique user name for your bot , it must end with “bot”<br /> ex: tetrisbot or tetris_bot</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771418982175/fdc08538-bb93-4fec-b7b5-5f14c0350ad9.jpeg" alt class="image--center mx-auto" /></p>
<p>Once completed, you will receive a <strong>confirmation message</strong> along with your <strong>bot token</strong>. Copy and save this token securely.</p>
<p>Click the provided bot URL to start interacting with your new bot.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771418993534/0403ee59-0026-4c5e-a557-bac973147949.jpeg" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771419010883/8c4cfa5b-949d-4bc5-bb14-fe3c1a972ca5.jpeg" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Deploying Redis on Akash Network: Save Over 90% on Cloud Costs]]></title><description><![CDATA[If you are running a Redis server on traditional cloud providers like Azure, AWS, or GCP, you might be overpaying for resources.
In this guide, I’ll walk you through how to deploy a Redis server on the Akash Network — a decentralized cloud computing ...]]></description><link>https://articles.narahari.dev/deploying-redis-on-akash-network-save-over-90-on-cloud-costs</link><guid isPermaLink="true">https://articles.narahari.dev/deploying-redis-on-akash-network-save-over-90-on-cloud-costs</guid><category><![CDATA[akash network ]]></category><category><![CDATA[Redis]]></category><category><![CDATA[Azure]]></category><category><![CDATA[GCP]]></category><category><![CDATA[AWS]]></category><category><![CDATA[Cloud Computing]]></category><dc:creator><![CDATA[Sandeep Narahari]]></dc:creator><pubDate>Sun, 15 Feb 2026 12:39:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1771158841848/32a85ece-9f16-4d0f-b2c7-1a81a4653c6c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>If you are running a Redis server on traditional cloud providers like Azure, AWS, or GCP, you might be overpaying for resources.</strong></p>
<p>In this guide, I’ll walk you through how to deploy a Redis server on the <strong>Akash Network</strong> — a decentralized cloud computing marketplace. By the end of this tutorial, you will see how we achieved a running cost of just <strong>$1.98/month</strong>, compared to $20-$40/month on major platforms.</p>
<p><strong>Let’s get started.</strong></p>
<h2 id="heading-why-akash"><strong>Why Akash?</strong></h2>
<p>Before we deploy, let’s look at the numbers.</p>
<ul>
<li><p><strong>Traditional Cloud (e.g., Azure):</strong> A standard instance with ~1GB RAM often costs between <strong>$16 and $40 per month</strong>.</p>
</li>
<li><p><strong>Akash Network:</strong> For superior specs (1 VCPU, 1GI RAM), we secured a deal for <strong>$1.98 per month</strong>.</p>
</li>
</ul>
<p>That is a massive difference for the exact same utility.</p>
<h2 id="heading-step-1-access-the-console"><strong>Step 1: Access the Console</strong></h2>
<p>First, navigate to the Akash Console → <a target="_blank" href="https://console.akash.network/"><strong>https://console.akash.network</strong></a></p>
<ul>
<li>Click <strong>Sign In</strong></li>
</ul>
<p>Press enter or click to view image in full size</p>
<p><img src="https://miro.medium.com/v2/resize:fit:875/1*rd3vIVi0FtEGPBM8MbCB6g.png" alt /></p>
<p><strong>Get $100 free credits (for first-time users)</strong></p>
<ol>
<li><p>Click <strong>Sign Up</strong> using Gmail or email.</p>
</li>
<li><p>Verify your email and add your credit card to activate the credits.</p>
</li>
<li><p>Log in to your account.</p>
</li>
<li><p>Click <strong>Deploy</strong>.</p>
</li>
<li><p>Select <strong>Run Custom Container</strong>.</p>
</li>
</ol>
<h2 id="heading-step-2-configure-the-deployment-sdl"><strong>Step 2: Configure the Deployment (SDL)</strong></h2>
<p>Now need to define our Docker image and resource requirements. You can use the SDL Builder or edit the Yaml (SDL) directly.</p>
<p><strong>The Configuration:</strong></p>
<ul>
<li><p><strong>Image:</strong> <code>redis:8.4</code> (Or your preferred version)</p>
</li>
<li><p><strong>Port:</strong> <code>6379</code></p>
</li>
<li><p><strong>CPU:</strong> <code>1.0</code></p>
</li>
<li><p><strong>Memory:</strong> <code>1Gi</code></p>
</li>
<li><p><strong>Port</strong> 6379</p>
</li>
<li><p><strong>Ephimeral Storage(temporary) :</strong> <code>1Gi</code></p>
</li>
<li><p>We also need to set a password for security so unauthorized users cannot access our cache. We do this by passing a command</p>
</li>
</ul>
<pre><code class="lang-yaml"><span class="hljs-bullet">-</span> <span class="hljs-string">sh</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">"-c"</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">redis-server</span> <span class="hljs-string">--appendonly</span> <span class="hljs-literal">yes</span> <span class="hljs-string">--requirepass</span> <span class="hljs-string">Test@123</span>
</code></pre>
<p>Press enter or click to view image in full size</p>
<p><img src="https://miro.medium.com/v2/resize:fit:875/1*R1fWSsLF_hxUiAn2P0FdxQ.png" alt /></p>
<pre><code class="lang-yaml"><span class="hljs-meta">---</span>
<span class="hljs-attr">version:</span> <span class="hljs-string">"2.0"</span>
<span class="hljs-attr">services:</span>
  <span class="hljs-attr">redis:</span>
    <span class="hljs-attr">image:</span> <span class="hljs-string">redis:8.4</span>
    <span class="hljs-attr">expose:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">port:</span> <span class="hljs-number">6379</span>
        <span class="hljs-attr">as:</span> <span class="hljs-number">6379</span>
        <span class="hljs-attr">to:</span>
          <span class="hljs-bullet">-</span> <span class="hljs-attr">global:</span> <span class="hljs-literal">true</span>
    <span class="hljs-attr">command:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">sh</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">"-c"</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">redis-server</span> <span class="hljs-string">--appendonly</span> <span class="hljs-literal">yes</span> <span class="hljs-string">--requirepass</span> <span class="hljs-string">Test@123</span>
<span class="hljs-attr">profiles:</span>
  <span class="hljs-attr">compute:</span>
    <span class="hljs-attr">redis:</span>
      <span class="hljs-attr">resources:</span>
        <span class="hljs-attr">cpu:</span>
          <span class="hljs-attr">units:</span> <span class="hljs-number">1</span>
        <span class="hljs-attr">memory:</span>
          <span class="hljs-attr">size:</span> <span class="hljs-string">1Gi</span>
        <span class="hljs-attr">storage:</span>
          <span class="hljs-bullet">-</span> <span class="hljs-attr">size:</span> <span class="hljs-string">1Gi</span>
  <span class="hljs-attr">placement:</span>
    <span class="hljs-attr">dcloud:</span>
      <span class="hljs-attr">pricing:</span>
        <span class="hljs-attr">redis:</span>
          <span class="hljs-attr">denom:</span> <span class="hljs-string">ibc/170C677610AC31DF0904FFE09CD3B5C657492170E7E52372E48756B71E56F2F1</span>
          <span class="hljs-attr">amount:</span> <span class="hljs-number">100000</span>
      <span class="hljs-attr">signedBy:</span>
        <span class="hljs-attr">anyOf:</span>
          <span class="hljs-bullet">-</span> <span class="hljs-string">akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63</span>
        <span class="hljs-attr">allOf:</span> []
<span class="hljs-attr">deployment:</span>
  <span class="hljs-attr">redis:</span>
    <span class="hljs-attr">dcloud:</span>
      <span class="hljs-attr">profile:</span> <span class="hljs-string">redis</span>
      <span class="hljs-attr">count:</span> <span class="hljs-number">1</span>
</code></pre>
<p>Here is the clean <strong>YAML (SDL)</strong> file . You can copy-paste this into the Yaml editor</p>
<p><em>(<strong>**Note:</strong></em> <em>Change</em> <code>test@123</code> <em>to a secure, strong password before deploying!)</em></p>
<h2 id="heading-step-3-deployment-amp-bidding"><strong>Step 3: Deployment &amp; Bidding</strong></h2>
<ol>
<li><p><strong>Deposit Funds:</strong> To create a deployment, you need to have at least <strong>$5</strong> in an escrow account.</p>
</li>
<li><p>Click <strong>Create Deployment.</strong></p>
</li>
<li><p><strong>Choose a Provider:</strong> Akash is a cloud marketplace. Once you request resources, providers will bid on your workload.</p>
</li>
</ol>
<ul>
<li><p>Wait a moment for bids to come in.</p>
</li>
<li><p>In our example, we found a provider offering 100<strong>% uptime</strong> and a monthly cost of roughly <strong>$1.98</strong></p>
</li>
</ul>
<p>Press enter or click to view image in full size</p>
<p><img src="https://miro.medium.com/v2/resize:fit:875/1*yOgtp0JBBkBdIEiRSvucpA.png" alt /></p>
<p>4<strong>. Accept Bid:</strong> Select the provider and approve the transaction.</p>
<h2 id="heading-step-4-verification"><strong>Step 4: Verification</strong></h2>
<p>Once the container status shows <strong>Active</strong>, verify that Redis is running correctly.</p>
<h3 id="heading-check-logs"><strong>. Check Logs</strong></h3>
<p>Go to the <strong>Logs</strong> tab in the dashboard.<br />You should see Redis starting up and ready to accept connections.</p>
<h3 id="heading-install-redis-cli-if-not-installed"><strong>. Install Redis CLI (if not installed)</strong></h3>
<p>On Ubuntu:</p>
<pre><code class="lang-plaintext">sudo apt install redis-tools
</code></pre>
<p>On macOS:</p>
<pre><code class="lang-plaintext">brew install redis
</code></pre>
<p>Get your <strong>Host</strong> and <strong>Port</strong> from the <strong>Leases</strong> section.</p>
<ul>
<li><p>Provider → <strong>Host</strong></p>
</li>
<li><p>External Port → <strong>Port</strong></p>
</li>
</ul>
<p>Once the container status shows <strong>Active</strong>, verify that Redis is running correctly.</p>
<p>Press enter or click to view image in full size</p>
<p><img src="https://miro.medium.com/v2/resize:fit:875/1*9Dmk72N9EHIr8SOCgNOoNw.png" alt /></p>
<p>From your local machine terminal, test the Redis instance using <code>redis-cli</code></p>
<pre><code class="lang-plaintext">redis-cli -h provider.ahn2-na.akash.pub -p 32030 -a Test@123
</code></pre>
<p>If successful, you should be connected.</p>
<p>Press enter or click to view image in full size</p>
<p><img src="https://miro.medium.com/v2/resize:fit:875/1*lh7-HSZYQer_NgaJFySOeg.png" alt /></p>
<p><strong>We successfully deployed a robust Redis instance with 1vCPUs and 1Gi RAM</strong></p>
<p><strong>Pricing compare (1 Gi redis cache per month)</strong></p>
<p>Press enter or click to view image in full size</p>
<p><img src="https://miro.medium.com/v2/resize:fit:875/1*SNcwKLoJeBT3ZTKp7N9Rqg.png" alt /></p>
<p><strong>The setup took under five minutes, required no complicated contracts, and cut our infrastructure costs by more than 90%. If you’re trying to reduce your DevOps spend, migrating stateless workloads like Redis to Akash is an easy win.</strong></p>
]]></content:encoded></item><item><title><![CDATA[Why to use and when to use promises in JS]]></title><description><![CDATA[Promises are especially valuable in scenarios where we need to manage asynchronous operations that have dependencies, need to execute tasks sequentially or require error handling
Let's see some of the use cases of promises so that you will understand...]]></description><link>https://articles.narahari.dev/why-to-use-and-when-to-use-promises-in-js</link><guid isPermaLink="true">https://articles.narahari.dev/why-to-use-and-when-to-use-promises-in-js</guid><category><![CDATA[promises]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Sandeep Narahari]]></dc:creator><pubDate>Fri, 20 Oct 2023 05:00:09 GMT</pubDate><content:encoded><![CDATA[<p>Promises are especially valuable in scenarios where we need to manage asynchronous operations that have dependencies, need to execute tasks sequentially or require error handling</p>
<p>Let's see some of the use cases of promises so that you will understand when to use and why to use</p>
<ol>
<li><p><strong>HTTP Requests</strong>: Promises are commonly used when making HTTP requests in web applications. You can use libraries like Axios or the Fetch API, both of which return promises to handle responses and errors.</p>
<pre><code class="lang-javascript"> <span class="hljs-comment">// Simulate an asynchronous data fetching operation</span>
 <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fetchDataFromServer</span>(<span class="hljs-params"></span>) </span>{
   <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve, reject</span>) =&gt;</span> {
     <span class="hljs-comment">// Simulate a delay (e.g., an HTTP request)</span>
     <span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
       <span class="hljs-keyword">const</span> success = <span class="hljs-built_in">Math</span>.random() &lt; <span class="hljs-number">0.8</span>; <span class="hljs-comment">// Simulate success most of the time</span>
       <span class="hljs-keyword">if</span> (success) {
         resolve(<span class="hljs-string">'Data fetched successfully'</span>);
       } <span class="hljs-keyword">else</span> {
         reject(<span class="hljs-string">'Failed to fetch data'</span>);
       }
     }, <span class="hljs-number">1000</span>); <span class="hljs-comment">// Simulate a 1-second delay</span>
   });
 }

 fetchDataFromServer()
   .then(<span class="hljs-function">(<span class="hljs-params">data</span>) =&gt;</span> {
     <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Success:'</span>, data);
   })
   .catch(<span class="hljs-function">(<span class="hljs-params">error</span>) =&gt;</span> {
     <span class="hljs-built_in">console</span>.error(<span class="hljs-string">'Error:'</span>, error);
   });
</code></pre>
<p> from the above code we have used <strong>resolve</strong> and <strong>reject,</strong> resolve is called when the promise is successfully fulfilled, and reject is called when the promise is unfulfilled</p>
</li>
<li><p><strong>File I/O</strong>: When reading or writing files asynchronously, promises help ensure that you can handle file operations elegantly.</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">'fs/promises'</span>);

 fs.readFile(<span class="hljs-string">'file.txt'</span>, <span class="hljs-string">'utf8'</span>)
   .then(<span class="hljs-function">(<span class="hljs-params">data</span>) =&gt;</span> {
     <span class="hljs-comment">// Handle the file content</span>
   })
   .catch(<span class="hljs-function">(<span class="hljs-params">error</span>) =&gt;</span> {
     <span class="hljs-comment">// Handle file read errors</span>
   });
</code></pre>
</li>
<li><p><strong>Database Operations</strong>: Promises are frequently used in database interactions. When querying a database, you can wrap the query operation in a promise.</p>
</li>
</ol>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> db = <span class="hljs-built_in">require</span>(<span class="hljs-string">'my-database-library'</span>);

db.query(<span class="hljs-string">'SELECT * FROM users'</span>)
  .then(<span class="hljs-function">(<span class="hljs-params">result</span>) =&gt;</span> {
    <span class="hljs-comment">// Handle the query result</span>
  })
  .catch(<span class="hljs-function">(<span class="hljs-params">error</span>) =&gt;</span> {
    <span class="hljs-comment">// Handle database query errors</span>
  });
</code></pre>
<p>If you're wondering where we are using the promises from the above file and database examples, in both examples we are consuming the promises which are given in the form of response, and in the examples actually we are handling the operations using then and catch, if it is resolved then we will get the data into the <strong>then</strong> else <strong>catch</strong>  </p>
<p>If hope you got something from my explanation, I will try to improve my way of explaining in every post. Please shoot your difficult topic in javascript and Golang I will try my best to make you understand confortable with it  </p>
<p>Thank you</p>
]]></content:encoded></item></channel></rss>