GithubHelp home page GithubHelp logo

Comments (4)

cl0vrfi3ld avatar cl0vrfi3ld commented on August 19, 2024

Akash doesn't have persistent storage at the moment (it's coming very soon though!) so if a pod (deployment) gets restarted on the provider for whatever reason, it's state is lost. I've tested these manifests on the persistent storage testnet and it solved that problem. For the meantime through, because gun can work offline and sync once reconnected, it can also easily recover lost data. Say the relay restarts and a user's blog posts were stored there. Since gun keeps a local copy on the user's device it'll resync that to the relay when they reopen the app/website and the data will be recovered.

$PEERS is just a comma separated string of relays you want to peer with, just like in the browser. let gun = new Gun(['https://peer.1/gun','https://peer.2/gun']) is the same as PEERS=https://peer.1/gun,https://peer.2/gun. In server-like settings, environment variables are a preferred way to configure deployments without needing to hardcode things into the image itself.

Feel free to ask any clarifying questions you may have, hope this helps!

from gun-akash.

cryptoboid avatar cryptoboid commented on August 19, 2024

Thanks for your answer! So, your relays https://gun-ams1.maddiex.wtf/gun and https://gun-sjc1.maddiex.wtf/gun are running on the Akash network right? So that's way they may 'lose' info?

Since gun keeps a local copy on the user's device it'll resync that to the relay when they reopen the app/website and the data will be recovered.

From what I've tested, if a group (with info stored on Gun) isn't opened for a while, then the data will never load again. It's really weird, because all info is still stored in the IndexedDB but Gun can't seem to find it, has that ever happened to you? maybe someone is doing a rogue .put(null)? I can't tell

relays you want to peer with, just like in the browser.

Got it, knew about env vars, but didn't know how gun treated peers in a relay. So, in theory, if my server has other as a peer (I configure PEERS=https://gun-us.herokuapp.com/gun) and I then write to https://gun-us.herokuapp.com/basic/paste.html, the text should appear in my server's paste.html, right?
edit: tried this last suggestion and didn't work, I've got my relay (https://splitio-relay.herokuapp.com/basic/paste.html) using https://gun-us.herokuapp.com/basic/paste.html as peer, but no luck :( am I missing something?

Edit 2 - adding two more questions:
if you are actively using Akash, how much does it cost to run a Gun relay for, lets say, one month? I've seen you can get some free tokens, but I can't tell if they are a lot or not

Also, what's the downside of using, lets say, 6-10 peers in the browser? does the performance decrease by a lot? The gun docs aren't clear about the performance implications

from gun-akash.

cl0vrfi3ld avatar cl0vrfi3ld commented on August 19, 2024

Sorry for the late response on this one.

So that's way they may 'lose' info?

Yeah, again akash just didn't have a reliable way to persist a container's state until v3.0, which is launching this week! Also if your heroku relay is on the free tier and it goes to sleep, it will lose it's state.

Gun can't seem to find it, has that ever happened to you? maybe someone is doing a rogue .put(null)? I can't tell

I've personally had no issues with this, but I am also syncing my apps with my own "private" relays alongside my public ones, which may mitigate a malicious overwrite (if you want to protect data from being overwritten, use SEA's user system or try content addressing). Maybe try downgrading your Gun version? This has fixed sync issues for me a few times.

am I missing something?

I'm not a core contributor to Gun so I don't know it's networking suuuper in-depth, might be better to ask on their Gitter (https://gitter.im/amark/gun) for a better explanation.

if you are actively using Akash, how much does it cost to run a Gun relay for, lets say, one month?

With 1vCPU, 1 GiB RAM, and 2 GiB container storage it's about 2.55 $AKT per month. At the time of writing that's roughly $US 3 per month. The "real way" akash charges for services is in uAKT per block, so each block a very small fraction of the AKT token is charged from the deployment's escrow account. This value is presented by your provider/host during the deployment bidding process. My setup is locked in at 6 uAKT/block.

I've seen you can get some free tokens, but I can't tell if they are a lot or not

Each deployment on akash requires an upfront deposit of 5 AKT to create a deployment (you are refunded all remaining tokens when a deployment is closed). If the faucet is working (it's been down for maintenance for a while since people were abusing it) you'll get 20 AKT if you complete those steps, good enough for 4 simultaneous deployments. If it's still down, ask in the discord and one of the admins will set you up with at least 5 AKT.

Also, what's the downside of using, lets say, 6-10 peers in the browser? does the performance decrease by a lot?

In-browser, webRTC can't handle more than 6 simultaneous connections. Also you don't really need that many relays, most apps get away with using one or two. Three peers might be a better sweet spot for you if you're looking for more decentralization.

from gun-akash.

cl0vrfi3ld avatar cl0vrfi3ld commented on August 19, 2024

Oh also, if you're considering running your gun backend on akash, make a request on their forum (https://forum.akash.network) for funding. I used to be on the board that manages these grants and they're always excited to hear about new projects.

from gun-akash.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.