redwoodjs / redwoodjs.com

redwoodjs.com redesign for 1.0
21 stars 22 forks source link

Adding docker-compose #14

Closed jeliasson closed 2 years ago

jeliasson commented 2 years ago
realStandal commented 2 years ago

Thanks @jeliasson! Wasn't sure if I was going to be the only Docker user or not lol

I just had one question (mainly for my own knowing) and then the one review I'll leave on the code. Are two containers needed/beneficial? I'm usually able to get by with one and then two databases in it, for testing and development.

jeliasson commented 2 years ago

Thanks @jeliasson! Wasn't sure if I was going to be the only Docker user or not lol

Sometimes I think that too 😅

Are two containers needed/beneficial? I'm usually able to get by with one and then two databases in it, for testing and development.

You can definitely get away with one container but, to my knowledge, you have to manually create the 2nd database one before you can use it. Me adding two containers is just the lazy version of not manually need to do that. 😊

I however realize that the configuration is wrong. Not sure why I set POSTGRES_DB to yes. I will update that.

POSTGRES_DB

This optional environment variable can be used to define a different name for the default database that is created when the image is first started. If it is not specified, then the value of POSTGRESUSER will be used. https://hub.docker.com//postgres

netlify[bot] commented 2 years ago

Deploy Preview for redwood-sprout failed.

Name Link
Latest commit 1ad4d4a4ecdcdfc7ac0a23caf2a2ef7af50eaf86
Latest deploy log https://app.netlify.com/sites/redwood-sprout/deploys/623e003d4ec9840009d24cb0
jeliasson commented 2 years ago

We usually leave .env.defaults as the sqlite database path (lowest common denominator for new apps) and then override it with your local settings in .env

@cannikin As this project has enums, I just assumed postgres was the way to go in this repo/project.

realStandal commented 2 years ago

You can definitely get away with one container but, to my knowledge, you have to manually create the 2nd database one before you can use it. Me adding two containers is just the lazy version of not manually need to do that. 😊

fwiw, I think Prisma handles that as long as you migrate/db push before running the app and provide it with a user with CREATEDB or that is a superuser; that's done for you with yarn rw test api, so the test DB will get created. Either that, or I have magic to uncover in my setup.

jeliasson commented 2 years ago

fwiw, I think Prisma handles that as long as you migrate/db push before running the app and provide it with a user with CREATEDB or that is a superuser; that's done for you with yarn rw test api, so the test DB will get created.

TIL. 🙂

I'm waiting for a comment from @cannikin in regards what database to use, and I update the docker-compose and get rid of the testing-instance. ty :)

cannikin commented 2 years ago

It's fine, leave that update in .env.defaults, and then can you add a note to the README that you'll need to override DATABASE_URL in .env with your own connection string if you're not using Docker.