Coder Social home page Coder Social logo

Comments (26)

rin-st avatar rin-st commented on June 11, 2024 2

Thanks Shiv! ๐Ÿ™

I see in https://github.com/rin-st/multisig-backend you also added the code for pages route api, what if we add that code in this repo too and update readme with :

(Optional Section(Recommended): Your own server and DB) : I think the steps are prettry straight forward,

  1. Create and get the ENV variables from vercel KV store
  2. paste them into your newly deployed vercel projects environments
  3. Update the prod server URL and again run yarn vercel --prod

Probably, but

  1. These points doesn't work for some users including me. I needed to recreate project and storage three times and set "Promote to production" manually from my deployments list to make it work. For some reason adding environments or connecting storage (envs added automatically to the project in that case) doesn't work, env vars is not visible for my apps. Additional deployments doesn't help. Probably I did something wrong, but I don't understand what.
  2. There is only one kv storage available on free vercel plan. So if user already use that storage, he can't complete this section. Or in case he delete/change storage in future, his testnet app won't work anymore.
  3. It's not so closely related to challenge (multisig)

So for me it not so recommended :). I think we can add it and test if it works for most of the people, but we need to be ready to answer why it won't work)

cc @Pabl0cks
I think this thread is interesting to Pablo too

from se-2-challenges.

carletex avatar carletex commented on June 11, 2024 2

Good stuff @rin-st Thanks!

Decided to copy Rinat's work to https://github.com/scaffold-eth/se-2-challenges/tree/multisig-backend. We could do it in another repo too, but since we already have this branch model (each branch is independent, not meant to be merged to main) I thought it made sense.

Could you add a simple README to it? Just explain what it's and how to run it (even if it's simple, future Carlos will thank you :P)

As I understand we'll not have that problem on bg boxes. But I don't know for sure what are that boxes and how they work

Yep. They are EC2 instances so no issues with the file storage.

from se-2-challenges.

carletex avatar carletex commented on June 11, 2024 2

Amazing! I use ChatGPT a lot for that stuff too :D

Thanks @rin-st !

I spent some time this morning with Shiv making some tweaks to the code (Basically https support) and deploying it to the BG EC2 instance. Austin still needs to configure some port stuff.

I'll post it here when is live and we can close this.

from se-2-challenges.

rin-st avatar rin-st commented on June 11, 2024 1

I experimented spent countless hours fighting with cors, next api (new) bugs, vercel env vars bugs and built that mega app ๐Ÿคฆโ€โ™‚๏ธ (see only app folder, underscoreds are for old pages api).

BE: https://github.com/rin-st/multisig-backend

changes needed to do in the challenge-6. https://github.com/scaffold-eth/se-2-challenges/compare/challenge-6-multisig...ch6-update-api?expand=1

I didn't create this pr since I think app should be deployed from some more official account ๐Ÿ™‚ . Or for now it's ok?

KV hobby plan includes 30 000 requests per month and 3 000 per day and I think it's probably enough for now. https://vercel.com/docs/storage/vercel-kv/usage-and-pricing . But if someone forget to close pool page it will send request every second. What do you think? Do we need pro plan?

from se-2-challenges.

technophile-04 avatar technophile-04 commented on June 11, 2024 1

I experimented spent countless hours fighting with cors, next api (new) bugs, vercel env vars bugs and built that mega app ๐Ÿคฆโ€โ™‚๏ธ (see only app folder, underscoreds are for old pages api).

Thanks so much Rinat for giving it a shot !!! Just tested it out and works great !!


KV hobby plan includes 30 000 requests per month and 3 000 per day and I think it's probably enough for now. https://vercel.com/docs/storage/vercel-kv/usage-and-pricing . But if someone forget to close pool page it will send request every second. What do you think? Do we need pro plan?

Just a thought :

I see in https://github.com/rin-st/multisig-backend you also added the code for pages route api, what if we add that code in this repo too and update readme with :

(Optional Section(Recommended): Your own server and DB) :
I think the steps are prettry straight forward,

  1. Create and get the ENV variables from vercel KV store
  2. paste them into your newly deployed vercel projects environments
  3. Update the prod server URL and again run yarn vercel --prod

from se-2-challenges.

Pabl0cks avatar Pabl0cks commented on June 11, 2024 1

Awesome job @rin-st!! I've tried your deployed backend and it's working great, TYSM! ๐Ÿ™Œ

So for me it not so recommended :). I think we can add it and test if it works for most of the people, but we need to be ready to answer why it won't work)

Without testing it and considering @rin-st's points, I tend to agree with him that it's probably not a good idea to recommend. However, I can give it a try tomorrow and check how many problems I encounter myself.

If we finally decide to just use our deployed backend, we can have the self-deployed backend as a plan B in case we start encountering problems due to reaching Vercel limits.

from se-2-challenges.

technophile-04 avatar technophile-04 commented on June 11, 2024 1

Oh I see, totally agree with you all !! I think it's not at all worth it since it's not too straightforward and also sometimes even if you do each step correctly things might still not work, so let's drop it ๐Ÿ™Œ

from se-2-challenges.

carletex avatar carletex commented on June 11, 2024 1

Thanks @rin-st for working on this. CORS errors are painful haha. And thanks all for testing and giving your take on it.

I initially thought that we were going to have a simple nodejs server deployed in the BG boxes (like the autograder), but having it like this will work too.

Merge Rinat's _pages/api into Multsig chall branch and host it on vercel from BG account ?

I'd do this only if we suggest (as extra) to people to set their own server/db (as Shiv suggested). If not, I don't see the value in polluting the challenge branch... and I'll go with:

Or a clone/fork of Rinat's repo into new repo under Scaffold-eth organization and then connecting it to vercel ?

What do you all think?

from se-2-challenges.

rin-st avatar rin-st commented on June 11, 2024 1

Vercel / NextJS option only makes sense to me if we want to share it with people, and suggest them to use it. If not, why have a whole NextJS set up just for a simple backend thing (is it a bit overkill, no?). The only thing I like is the automatic deployment stuff (but I don't think we'd change this a lot)

Yes, it's overkill for sure. I used it because we started to discuss about Next and also you mentioned Vercel storage. So I forgot about original post ๐Ÿ˜„ ๐Ÿคฆโ€โ™‚๏ธ .

NodeJS/Express server: it could be a single file, and instead of using a variable storage (a bit hacky) we could use the "json database" (Shiv mentioned some of them in the OP) which is still hacky haha but a bit better and nothing happens if the server resets.

Agree, it's better and easier. Let's implement it

from se-2-challenges.

carletex avatar carletex commented on June 11, 2024 1

This is live on: https://backend.multisig.holdings:49832/

Could you guys test? I guess we'd also need to add that URL to the challenge readme/.env.example, right?

from se-2-challenges.

Pabl0cks avatar Pabl0cks commented on June 11, 2024 1

Feel free to close this when you test it.

It's working great to me also, will add a reference in Readme ๐Ÿ™Œ

Closing!

from se-2-challenges.

rin-st avatar rin-st commented on June 11, 2024

If these libs works well with next api, we don't even need prod server, isn't it? Every app will have separate db. Or am I wrong?
I'll check it next days

from se-2-challenges.

technophile-04 avatar technophile-04 commented on June 11, 2024

I actually tried using lowdb 2months ago with next api route but vercel don't allow write operation to file when you deploy to vercel :(

from se-2-challenges.

carletex avatar carletex commented on June 11, 2024

Yes, nextjs server functions on Vercel doesn't give you FS access. I think you'll have to do it with any kind of vercel storage (database, blob).
https://vercel.com/docs/storage

I'm happy to deploy it to one of our boxes if that makes things easier for people.

you'all tell me!

from se-2-challenges.

rin-st avatar rin-st commented on June 11, 2024

Added env example to BE repo. You can use your storage vars to test it locally or pm me for my

from se-2-challenges.

technophile-04 avatar technophile-04 commented on June 11, 2024

So just thinking of deploying our api to prod how are we going about it ?

Merge Rinat's _pages/api into Multsig chall branch and host it on vercel from BG account ?

Or a clone/fork of Rinat's repo into new repo under Scaffold-eth organization and then connecting it to vercel ?

It will be very hard to host Next api on our custom box right, so we need to host it on vercel only right ?

from se-2-challenges.

rin-st avatar rin-st commented on June 11, 2024

I think we need to create separate repo since imho users don't need to deploy their db and hence don't that code. We can give them link to that repo if they want to play with db too.

Regarding express server with saving to variable (like in backend-local) I think it should work too, since it already worked for months (or it was another version of managing data?). But vercel version seems more relevant and stable, if we'll not meet limits. I believe to meet free limit we need tens of users per month

from se-2-challenges.

carletex avatar carletex commented on June 11, 2024

Thanks Rinat! After thinking about it a bit more. My thoughts:

  • Vercel / NextJS option only makes sense to me if we want to share it with people, and suggest them to use it. If not, why have a whole NextJS set up just for a simple backend thing (is it a bit overkill, no?). The only thing I like is the automatic deployment stuff (but I don't think we'd change this a lot)

  • NodeJS/Express server: it could be a single file, and instead of using a variable storage (a bit hacky) we could use the "json database" (Shiv mentioned some of them in the OP) which is still hacky haha but a bit better and nothing happens if the server resets.

Thoughts?

from se-2-challenges.

technophile-04 avatar technophile-04 commented on June 11, 2024

Yup I agree, I think having a simple express server file is the way to go since its simple and works pretty nicely for our needs ๐Ÿ™Œ

from se-2-challenges.

rin-st avatar rin-st commented on June 11, 2024

Changed https://github.com/rin-st/multisig-backend so now it uses express and lowdb.

Deployed it to render, so you can test it - change POOL_SERVER_URL in challenge 6 to https://multisig-backend.onrender.com/ (with slash at the end)

note: https://docs.render.com/free#spinning-down-on-idle

from se-2-challenges.

Pabl0cks avatar Pabl0cks commented on June 11, 2024

Been playing a bit with your deployed POOL_SERVER_URL on render and it's working great. Will do more tests tomorrow ๐Ÿ™Œ

from se-2-challenges.

Pabl0cks avatar Pabl0cks commented on June 11, 2024

note: https://docs.render.com/free#spinning-down-on-idle

I think when render spins down the server, the old transactions disappear. When I tried to test today, after it relaunched, my Pool was empty, and only new transactions appear. My test url => https://challenge-6-multisig.vercel.app/

from se-2-challenges.

rin-st avatar rin-st commented on June 11, 2024

I think when render spins down the server, the old transactions disappear. When I tried to test today, after it relaunched, my Pool was empty, and only new transactions appear. My test url => https://challenge-6-multisig.vercel.app/

Yes, it behaves that way on render and free plans of other services. I deployed it here just for testing purposes. As I understand we'll not have that problem on bg boxes. But I don't know for sure what are that boxes and how they work

from se-2-challenges.

rin-st avatar rin-st commented on June 11, 2024

Could you add a simple README to it? Just explain what it's and how to run it (even if it's simple, future Carlos will thank you :P)

Generated simple readme using gpt and edited it a little bit ๐Ÿ™‚
https://github.com/scaffold-eth/se-2-challenges/tree/multisig-backend

If you think we need to add live-reloading for dev mode we can add it like here #122

from se-2-challenges.

rin-st avatar rin-st commented on June 11, 2024

deploying cost to sepolia is ~0.8 sep ๐Ÿ˜ฎ . I'll wait a little bit ๐Ÿ˜„

But tested it locally and works great! And looks like nothing to break here

Not sure regarding .env file, since it's already in source code. And it will require additional step for creating .env and adding that variable for every user. So it requires to add that address to readme and it will not be hidden anyway

from se-2-challenges.

carletex avatar carletex commented on June 11, 2024

Not sure regarding .env file, since it's already in source code. And it will require additional step for creating .env and adding that variable for every user. So it requires to add that address to readme and it will not be hidden anyway

Oh, perfect. Directly in the code works.

deploying cost to sepolia is ~0.8 sep ๐Ÿ˜ฎ . I'll wait a little bit ๐Ÿ˜„

Feel free to close this when you test it.

Thanks!

from se-2-challenges.

Related Issues (20)

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.