ocodista / trampar-de-casa

Apoiamos o trabalho remoto e divulgamos vagas semanalmente para inscritos.
https://trampardecasa.com.br
GNU General Public License v3.0
2.67k stars 104 forks source link

Add docker-compose to run entire env in local #85

Closed ocodista closed 6 months ago

ocodista commented 1 year ago

Currently is not that easy to setup the dev environment as you need to create your own supabase db and manually add a lot of envs to the apps/web/.env file.

The main goal of this issue is to fulfill the happy path by locally spinning up all the required containers for the app.

Happy path

OtavioSC commented 1 year ago

i'm working on it

ocodista commented 1 year ago

i'm working on it

Thank you! Assigned the issue to you

OtavioSC commented 1 year ago

Hi @ocodista, I'm not with enough time to work on this issue as I want, so I would like to allow others to try too removing the assigned (In parallel, I'll still be working on it.). Also, about the project, I'm facing some problems with Turbo running the project after the first time.

image

And seemingly is about the project turbo version. https://github.com/vercel/turbo/issues/5331

ocodista commented 1 year ago

Awesome, thank you @OtavioSC.

From what I read, it's a problem with the latest versions of turbo, apparently, setting the version to 1.10.4 solves this issue.

LucasMallmann commented 1 year ago

I'd like to take on this issue! @ocodista.

ocodista commented 1 year ago

@LucasMallmann You got it

LucasMallmann commented 1 year ago

@ocodista I have a doubt: when I try to click on "Quero Participar" in my localhost, I receive an error with status 500. When the button is clicked, it fires a request to the localhost:3000/api/subscribers, and this route does not exist. image

This comes from a direct call to a fetch call in the saveSubscriber method image

Should this route exist? Am I missing some configuration?

LucasMallmann commented 1 year ago

Never mind, I found the api route in the web/app folder. I'll try to debug here :)

ocodista commented 1 year ago

Actually the route is on the apps/web/app/api/subscribers/route.ts file.

The errors is happening on the side of the server (That's why it's returning 500).

If the route was not found the error would be a 404.

LucasMallmann commented 1 year ago

Forgot to mention, but this issue is being tracked on this branch: https://github.com/LucasMallmann/trampar-de-casa/tree/feat/dev-docker-setup

I managed to start all the supabase services locally. Now I'm creating a separate container to run the frontend application.

ocodista commented 1 year ago

@LucasMallmann Nice!

We'll take a look as soon as you open a PR for it.

LucasMallmann commented 1 year ago

Hey @ocodista I think I need some help setting up the docker to run all the yarn workspaces. I'm having a hard time figuring out how to make all the things to communicate well in a docker container.

raphaelvdossantos commented 1 year ago

Hey @ocodista I think I need some help setting up the docker to run all the yarn workspaces. I'm having a hard time figuring out how to make all the things to communicate well in a docker container.

I can try to help you with that. This task unblocks Issue #69 so it would be nice to close it off

Hit me up on Discord (siriushunter) or Twitter (complainin_dev). I would like to get involved in this task if possible.

LucasMallmann commented 1 year ago

Hello @raphaelvdossantos, thank you for your support! I have just opened a pull request describing the main issue. It might be a good idea to open a separate issue to address the Next.js setup, or we could further discuss to explore a better solution.

I have also sent you a Discord invitation so that we can communicate better about it.

omateusamaral commented 1 year ago

any news about the docker-compose?

raphaelvdossantos commented 1 year ago

any news about the docker-compose?

@LucasMallmann and I are working on it.

emanamoura commented 11 months ago

Hello ! I would like to take on this issue

ocodista commented 11 months ago

Hello @emanamoura please go ahead!

albertofp commented 11 months ago

A couple things I found while looking for a solution:

Trying to get it to work on my end, but no promises. Feel free to reach out if you want to collaborate @emanamoura

albertofp commented 11 months ago

Current progress: Got the container to run properly, but turbo devfails; got the same issue running outside the container, think it's missing some setup steps on the database side

❯ docker compose up
[+] Building 0.0s (0/0)                                                                                                        docker:desktop-linux
[+] Running 1/0
 ✔ Container trampardecasa-web  Created                                                                                                        0.0s
Attaching to trampardecasa-web
trampardecasa-web  | • Packages in scope: analytics, db, email-composer, email-pre-renderer, email-sender, eslint-config-custom, roles-assigner, roles-renderer, roles-validator, shared, web
trampardecasa-web  | • Running dev in 11 packages
trampardecasa-web  | • Remote caching disabled
trampardecasa-web  | db:dev: cache bypass, force executing 46d8ab9fb0b1e83b
trampardecasa-web  | web:dev: cache bypass, force executing 97f81df84496f6fc
trampardecasa-web  | db:dev: yarn run v1.22.19
trampardecasa-web  | web:dev: yarn run v1.22.19
trampardecasa-web  | db:dev: $ BROWSER=none prisma studio
trampardecasa-web  | web:dev: $ next dev
trampardecasa-web  | db:dev: Error: Provided schema path `prisma/schema.prisma` from `package.json` doesn't exist.
trampardecasa-web  | db:dev: error Command failed with exit code 1.
trampardecasa-web  | db:dev: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
trampardecasa-web  | db:dev: ERROR: command finished with error: command (/app/packages/db) yarn run dev exited (1)
trampardecasa-web  | web:dev:
trampardecasa-web  | db#dev: command (/app/packages/db) yarn run dev exited (1)
trampardecasa-web  |
trampardecasa-web  |  Tasks:    0 successful, 2 total
trampardecasa-web  | Cached:    0 cached, 2 total
trampardecasa-web  |   Time:    864ms
trampardecasa-web  | Failed:    db#dev
trampardecasa-web  |
trampardecasa-web  |  ERROR  run failed: command  exited (1)
trampardecasa-web exited with code 1
albertofp commented 11 months ago

@ocodista Any idea why the packages/db/prismadirectory is gone? Last commit I could find with it still in place was dc31219, and without it turbo dev fails like in the message above

jppradoleal commented 11 months ago

Sup, guys! I would love to work on this, but I'm having a lot of trouble setting up my environment. It seems that packages/db/prisma/schema.json is an autogenerated required file, but it was removed in the PR https://github.com/ocodista/trampar-de-casa/pull/141, was it an error? Or should I generate a new one?

jppradoleal commented 11 months ago

FYI

The previous error with schema.json was due to the db:start script being obsolete, removing the prisma part solved it.

About the task, I've got an almost working version of it, my main problems now are mongodb missing in packages/shared, and the Dockerfile being over 4gb. I've used the apps/auto-email-sender/email-sender/Dockerfile as a base, but surely there is room for improvement. I've never used Turbo before, but the docs seems to have some instructions for Docker.

Once I solve these main problems, I'm thinking of making a Makefile to ease the process of seeding the Supabase instance.

I am also planning to finish this today, after some sleep and work-up, if there is no one further from the point that I am, I'll gladly ask to be assigned to it.

ocodista commented 11 months ago

@jppradoleal @albertofp check my newest improvement to README on #179.

You should be able to run everything you need now (We are not using Prisma anymore).

jppradoleal commented 11 months ago

Hey @emanamoura I saw that you were assigned, but since I didn't find any commit related in your fork, I took the chance to open the PR https://github.com/ocodista/trampar-de-casa/pull/180 that closes this issue. I've also seen the @LucasMallmann closed PR. If you guys can have a look at it, and share some insights, it would be a pleasure.