d0x2f/retro.tools

Contributing guides

Closed this issue ยท 12 comments

Hello Dylan! @d0x2f

I'd like to contribute more to this project. How can I get started? Thanks in advance!

d0x2f commented

Hey Ricardo,

That's great!

I like your idea of ice breaker prompts, you could put something together for that if you like? I'll add some thoughts to that card #162

Best way to get started would be to get a local copy up and running where you can make changes and try them out.
For that you'll need to create a firebase db in google which I think is free with some usage limits. When I have time I'll see if I can put togother a doc with steps to get it running, but for now here's the brief process:

env FIRESTORE_PROJECT=<your-firebase-project> GCP_SERVICE_ACCOUNT_JSON=<your-gcp-credentials> ALLOWED_ORIGIN='http://localhost:5000' cargo run

Alternatively if you don't want to set up an entire rust toolchain you can use docker like so:

docker run -p8000:8000 -e PORT=8000 -e ENVIRONMENT=development -e FIRESTORE_PROJECT=<your-firebase-project> -e GCP_SERVICE_ACCOUNT_JSON=<your-gcp-credentials> -e ALLOWED_ORIGIN='http://localhost:5000' gcr.io/retrotools-284402/retrograde:latest
  • checkout retrograde.js build it with npm i npm run build
  • run it with npm run dev

Now you can make changes to either project and try them out before submitting pull requests.
Let me know if you need any help getting things working.

First, a big thank you!! I'm very glad about this opportunity. Second, I should get started very soon. <o/

This is my first time working with Google Cloud. After digging a little bit, I was able to create a project, an app, and set up a user for this. Sadly I don't have any contact with the rust lang, so I'm going with docker based option. And for the retrograde.js build, I could get it up and running with node 14.15.4.

I'll let you know from now on. Thanks a lot!!

I'm having some issues filling out the GCP_SERVICE_ACCOUNT_JSON env var. Sometimes I get No available authentication method was discovered or then Failed to parse GCP_SERVICE_ACCOUNT_JSON. If you could send me more info about this variable content, I'll appreciate it! Thanks in advance ;-)

d0x2f commented

Glad to hear you're making progress!
The json needs to be base64 encoded, sorry I should have mentioned that.

-e GCP_SERVICE_ACCOUNT_JSON=$(base64 -w0 /path/to/credentials.json)

relevent parsing code: https://github.com/d0x2f/retrograde.rs/blob/d61da69b69531568e4d75ba977b03c7a2a1107b1/src/main.rs#L30

If you need to make a change to the rust side, let me know and I can add it. I'd guess the "isPinned/isPrompt" flag is all that's needed.

Hello, @d0x2f sorry for my delay! Now I got it. I also was trying with the wrong project name. That brings the next question. I'm really new to Google Cloud. I was trying a Firebase project, but it should be a Firestore instead. I found the free trial Firestore section, but I need to put my credit card number to enable and test it. Even for development. Is that correct? Or I'm missing something? Thanks.

Hey @d0x2f. I think we're almost there. After creating the Firestore project, and creating a service user, I could run it. However, I'm getting Permission denied on resource project RetroOpen. This project is brand new. Shou I create a database or something? Thanks.

I already tried a new service account. I already checked the IAM roles. Everything seems correct. And I'm still getting http://localhost:5000/null when I create a new retro. Having Internal Server Error: Other("status: PermissionDenied, message: \"Permission denied on resource project RetroOpen.\" and a bunch of numbers in the details.

d0x2f commented

Hey,

So they way firebase is integrated with google cloud is a bit strange, you can either create a project from firebase and it'll make one in gcp as well, or you can make a project in gcp and then later add it to firebase.

Either way works, as long as you end up with a firebase project. Then in that project you can create a firestore database if there isn't one already, that should be all you need to do.

Regarding credit card info, I think you're right that they require it even for the free version which is frustrating. Don't worry about runaway costs though, the full hosting cost of retro.tools is on average is less than 10c per day.

Also make sure you're setting the project id in the env var rather than the name, maybe you found that already though.

image

Great great news!! It's working!! Thank you so much!

d0x2f commented

I've made some changes in an effort to make it a bit easier to contribute. There's a backend hosted at https://retrotools-dev-7kiihsiuqq-nw.a.run.app which uses it's own firestore db. The project will use it by default when you use npm run dev. This way you don't need to run the rust backend yourself or host your own firestore db.

I plan on writting a CONTRIBUTING.md doc soon too.

d0x2f commented

CONTRIBUTING.md added! Closing this issue for now.