MyBitFoundation / MyBit-Go.app

🔷 The MyBit Platform™ for investing in alternative assets
https://app.mybit.io
GNU General Public License v3.0
8 stars 31 forks source link

Deploy dapp to IPFS #518

Closed MyBitIO closed 4 years ago

MyBitIO commented 4 years ago

Our goal is to go serverless and decentralised with the MyBit application. We no longer want to rely on a centralised server hosting company such as AWS. If possible, we would like it to be deployed to IPFS and we will redirect the domain to the IPFS URL where the application can be located.

We understand this is a new approach to deploying applications and may have some limitations or not be feasible. Please ask all the questions you have and share any uncertainties, constraints, limitations, or otherwise issues that you believe may arise from taking on this approach.

This task was inspired by this blog: https://medium.com/elbstack/decentralized-hosting-of-a-static-react-app-with-ipfs-aae11b860f5e

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 1000.0 DAI (1000.0 USD @ $1.0/DAI) attached to it.

gitcoinbot commented 4 years ago

@iamonuwa Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

iamonuwa commented 4 years ago

@gitcoinbot waiting for feedback from the team

think-in-universe commented 4 years ago

Does this issue allow or need cooperative work? I don't mean to request for the bounty since it's already approved to the developer.

I'm interested to do some research for this issue if needed.

gitcoinbot commented 4 years ago

@iamonuwa Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


@iamonuwa due to inactivity, we have escalated this issue to Gitcoin's moderation team. Let us know if you believe this has been done in error!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

crypto-guys commented 4 years ago

I think I can do this project if your current developer is unable to complete. I have some experience with IPFS and Arweave. Please see this article for more information https://medium.com/@arweave/arweave-ipfs-persistence-for-the-interplanetary-file-system-9f12981c36c3

cryptnotiq commented 4 years ago

hey @crypto-guys the current developer was unable to complete so it is now available on gitcoin if you are interested in tackling it. But before you start on it let's have a quick discussion to make sure we're on the same page. We can either do that here or on telegram t.me/mybitio

I'm curious about the limitations specifically. Such as managing updates and if that requires a redeployment to IPFS for even small changes, and then having to update the hash/URL after each update.

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 2 days, 23 hours from now. Please review their action plans below:

1) tcrowe has been approved to start work.

Very cool! I've checked out MyBit apps and docs before. I recently put in some patches for ipfs-deploy. Maybe some of my experience can help you get deployed! 2) mikehibbert has applied to start work _(Funders only: approve worker | reject worker)_.

Hi

I've deployed several ReactJS apps to the Arweave permaweb network which sounds like its doing what you would like to achieve. You can also redirect your sites domain to the permaweb link once created, (see the example below).

Here's an example: https://arweave.net/I24VcIjNFAQQpyXLcu-eBSl3DPGL2aioaltIeXpSUlc

You can get a free wallet with 1AR worth of coin so you can access the site and look it over here: https://tokens.arweave.org/

I'm happy to assist you in converting your app to a serverless version and deploying to the permaweb for you.

Kind Regards

Mike 3) devilla has applied to start work _(Funders only: approve worker | reject worker)_.

We're able to deploy the DAPP to IPFS recently. Hope we can do it again. Thanks. 4) kryptos-ke has applied to start work _(Funders only: approve worker | reject worker)_.

Hello, I am interested in taking on the project. Thanks, let's do it!

Learn more on the Gitcoin Issue Details page.

cryptnotiq commented 4 years ago

@tcrowe could you expand on how you plan to approach this deployment to IPFS?

And also explain how publishing updates works? Does it require having to redeploy to IPFS for even very small changes to the codebase? And will that create a new hash each time which we will have to repoint the URL to?

If there are any other limitations or aspects that may be a concern for running an application efficiently please also mention those here.

tcrowe commented 4 years ago

@cryptnotiq Yes, your understanding is correct. Finding the correct solution could be somewhat involved. Let me show why.


app.mybit.io subdomain runs with Lets Encrypt possibly on zeit now.

app mybit io-lets-encrypt-ssl

There's some connections to static assets and API servics across these hosts. Most of these would not need to change.

app mybit io-umatrix-assets

mybit.io domain runs on a different server but could be unified into IPFS if there is a solution for proper domain, subdomain, and SSL certs.

mybit io-cloudflare-ssl

Now that we've mapped out the static and dynamic assets there's a few things to consider.

IPFS direct

If someone has an IPFS extension in their browser they would be able to directly view the dApp.

Pinners & Gateways

These are the public gateways: https://ipfs.github.io/public-gateway-checker/

They will mostly give you URLs like:

Some will provide:

With IPNS+ENS courtesy of ens.domains you get something like mybit.eth.link.

Some of those services can host the content for free, or up to 1GB, or so.

Some R&D would need to be done to figure out which gateway, *if any, can correctly give `.mybit.io` an SSL certificate.**

MyBit domains

The above solutions are fine as mirrors but if you want *.mybit.io to have the correct SSL for non-IPFS-extension users then some other solution is needed. Otherwise we could end up with this for people without IPFS-enabled browser.

Screen Shot 2020-01-21 at 1 46 21 PM

For example you could easily set DNS CNAME or ALIAS some of the above URL patterns. But you will likely get this SSL message above if you don't have it setup correctly with the gateways. Even then there is no guarantee they will have that feature.

Invent a solution

If it's needed to have *.mybit.io hosted on an IPFS gateway and none of the gateways on the list support the feature it may need to be invented. Most of the puzzle pieces are available via node+npm+express.

What is missing?

If you or anyone sees flaws in my arguments comment and we can roll this into an article or tutorial.

tcrowe commented 4 years ago

The above would be repeated similarly for deployment on Dat Protocol with Dat+BeakerBrowser or Dat+hashbase.io Pinner.

tcrowe commented 4 years ago

Ideally, for IPFS, one of the built-in Pinners will suffice on ipfs-deploy: https://github.com/ipfs-shipyard/ipfs-deploy

tcrowe commented 4 years ago

I forgot to mention the above can get rolled into the CI: https://github.com/MyBitFoundation/MyBit-Go.app/blob/develop/.circleci/config.yml https://github.com/MyBitFoundation/MyBit-Go.app/blob/develop/.travis.yml

⚠️ If there is actually a need for private or secret key operations on the server it wont work: https://github.com/MyBitFoundation/MyBit-Go.app/blob/develop/now.json#L5 https://github.com/MyBitFoundation/MyBit-Go.app/blob/develop/server/controllers/civicController.js#L7 https://github.com/MyBitFoundation/MyBit-Go.app/blob/develop/server/controllers/airTableController.js#L12 https://github.com/MyBitFoundation/MyBit-Go.app/blob/develop/server/controllers/awsController.js#L5

cryptnotiq commented 4 years ago

Hey @tcrowe awesome explanation, I really appreciate it. Everything makes sense to me, and I don't think there is actually a need for secret key operations.

tcrowe commented 4 years ago

@MyBitIO @cryptnotiq I didn't see any notifications but gitcoin hints that I'm on it. I'll keep you up to date as I go. I'm available on t.me/tcrowe too.

tcrowe commented 4 years ago

Update: I'm mapping out what is in the server and how to find existing work in the front-end to replace it. Some pieces are already there and others haven't been hooked up yet. So far so good. 👍🏻

tcrowe commented 4 years ago

Update

So far so good. We're getting to the point where we need to start deploying.

CloudFlare IPFS

CloudFlare was the only one that says it will put up the SSL. It's also built-in to ipfs-deploy.

We need a few secret environment variables added to the CI/CD system(s). Get API token

IPFS_DEPLOY_CLOUDFLARE__API_TOKEN=
IPFS_DEPLOY_CLOUDFLARE__ZONE=app.mybit.io
IPFS_DEPLOY_CLOUDFLARE__RECORD=_dnslink.app.mybit.io

⚠️ If you cannot use CloudFlare DNS we need to find another solution.

IPFS Pinners

The CI/CD will deploy to an IPFS pinner service but the good news is that we can all host it. 🎉

Please also get an account with Piñata so we can get these secret environment variables.

IPFS_DEPLOY_PINATA__API_KEY=
IPFS_DEPLOY_PINATA__SECRET_API_KEY=

CI/CD security

Please also PM me so we can see if the environment variables are secure.

tcrowe commented 4 years ago

Temporary static export: https://tcrowe-mybit-ipfs.commons.host

⚠️This is not on IPFS yet. Parts of it connect to IPFS but not this one.

gitcoinbot commented 4 years ago

@tcrowe Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

tcrowe commented 4 years ago

@gitcoinbot WIP PR #530

tcrowe commented 4 years ago

🎉 First successful build since five months ago 🎉 https://circleci.com/gh/MyBitFoundation/MyBit-Go.app/1061

@MyBitIO

tcrowe commented 4 years ago

Test IPFS deploy URL: https://ipfs-app.mybit.io/

Currently it's taking a while for the IPFS changes to propagate. Not all the files appear for me right away. We need a way to do it quick! 🔥

tcrowe commented 4 years ago
Screen Shot 2020-02-01 at 8 53 43 PM

If you view the network console it shows only partial network saturation so far.

tcrowe commented 4 years ago

@gitcoinbot We're just on the last steps talking about CI/CD.

tcrowe commented 4 years ago

@gitcoinbot We're putting on the finishing touches. 💅

tcrowe commented 4 years ago

We're going over a few last touches on this and coordinating with other devs on their PRs. I'll see about making another update before this evening. (MST)

tcrowe commented 4 years ago

We're just scaling back the PR and then we can roll some of the extra goodies into future PRs: https://github.com/MyBitFoundation/MyBit-Go.app/pull/543

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Cancelled


The funding of 1000.0 DAI (1000.0 USD @ $1.0/DAI) attached to this issue has been cancelled by the bounty submitter