Serverless dApp backend

  • Problem Statement:
    serverless dApp backend

  • Impact:
    offer alternatives to centralized options like moralis, lambda, cloudflare, etc

  • Goals: What are you aiming to accomplish?
    run n8n nodes in akash vms
    implement everything we currently do with moralis cloud functions in n8n
    … call eth smart contracts, use notion and discord apis, save data to a db

  • Methodology:
    using webhooks and visual node programming

  • Timeline:
    2wks max

  • Team :
    no support needed yet

  • Reporting :
    medium, discord, etc

  • Design :
    n8n.io

Hoping for some start up funding to spin up a node in an akash vm

ref: Quick Start Guide - Akash Guidebook

my address
akash15gjha2fx86meaare45nqh43dpgyr4ssg9a9zxr

2 Likes

What would be helpful here is also including an ask :slight_smile:

How much AKT are you looking for to fund your efforts? That’ll allow the community a clearer picture.

What I love about this is the format/framework and I think we’ll be adopting something very similar to this.

cc @colin.lowenberg

1 Like

Is the plan to run your moralis.io server piece on Akash?

not exactly.
i want to mimic everything that i currently do via moralis via n8n.io

in a fully decentralized “serverless” way… akash vms are of course not really serverless, but it is a different way to rent a vps that is fully integrated with blockchain.

sorry, i was basically just following instructions from the docs and i have no idea how much i really need to spin up a vm.

it has now been approved and funded so I’ll see if i can get it running soon…
got all the way to here: Deployment - Akash Guidebook
but only one bid shows up and it is state:closed

Managed to get n8n running with this yaml:

---
version: "2.0"
services:
  n8n:
    image: n8nio/n8n
    restart: always
    env:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=xxx
      - N8N_BASIC_AUTH_PASSWORD=yyy
      - N8N_HOST=${updateThisAfterFirstDeploy}.ingress.ewr1p0.mainnet.akashian.io
      - N8N_PORT=5678
      - N8N_PROTOCOL=http
      # - NODE_ENV=production
      # - N8N_PATH
      # - WEBHOOK_URL=http://${updateThisAfterFirstDeploy}.ingress.ewr1p0.mainnet.akashian.io/
    expose:
      - port: 5678
        as: 80
        to:
          - global: true
    command: 
      - "n8n start"
profiles:
  compute:
    n8n:
      resources:
        cpu:
          units: 1
        memory:
          size: 1024Mi
        storage:
          size: 64Mi
  placement:
    westcoast:
        attributes:
          host: akash
        signedBy:
          anyOf:
            - "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63"
        pricing:
          n8n: 
            denom: uakt
            amount: 1000      
    
deployment:
  n8n:
    westcoast:
      profile: n8n
      count: 1

n8n allows visual api/automation programming.
So I registered a webhook and did some basic validation using IF nodes and SET nodes.

Once all the params check out, i make two calls to send a messge to Discord and add to a Notion DB
I set the responses so the multiplexed result looks like this:

{
   "discord":{
      "success":true
   },
   "notion":{
      "id":"xxx-782c-4d18-a1d2-xxx",
      "ID":" [14] -> me@foo.bar"
   }
}

full round trip takes 2s on n8n cloud and 5-6s on akash.
Not sure where the delay is, but worth investigating (as n8n cloud is also using k8ns).
First thing to try is production mode.

So i did some webhook tests and it seems that n8n is only taking 1s and 4-5s of delay come between the request starting and when n8n webhook node gets the request.

Is this akash routing delays?

Request started at 1:55:14 (bottom right) but did not start the webhook till 1:55:18(top):

so i managed to boost the n8n log level and discovered that the delay is n8n internal:

2021-06-21T06:31:16.518Z | verbose  | Started execution of workflow "My workflow" from webhook with execution ID 3 
    {"executionId":"3","file":"WebhookHelpers.js","function":"executeWebhook"}
2021-06-21T06:31:20.394Z | verbose  | Initializing n8n sub-process 
    {"pid":38,"workflowId":1,"file":"WorkflowRunnerProcess.js","function":"runWorkflow"}
2021-06-21T06:31:20.582Z | verbose  | Workflow execution started 
    {"workflowId":1,"file":"WorkflowExecute.js","function":"processRunExecutionData"}
2021-06-21T06:31:21.342Z | verbose  | Workflow execution finished successfully 
    {"workflowId":1,"file":"WorkflowExecute.js","function":"processSuccessExecution"}

will divert question about timings there

Does your workflow running within n8n make network requests?