Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLSC-32] Add script for starting up a postgres database with docker #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mslwang
Copy link
Collaborator

@mslwang mslwang commented Nov 12, 2024

Notion ticket link

Add postgres docker

Implementation description

Currently docker-compose is not convenient to iterate on, so it doesn't make sense to rely on it for a database. Instead, I've created a separate Dockerfile for testing the database during development.

Steps to test

  1. run pdm run db
  2. Check docker ps | grep llsc_db_dev_local to see if it's been started up.
  3. Test adding an object into the db. (need to dig into how to do this conveniently)

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

@mslwang mslwang requested a review from Mayank808 November 12, 2024 07:28
@@ -34,13 +34,19 @@ To start the backend locally, use the following command:
pdm run dev
```

Note: If you wish to run the backend outside of Docker (e.g., for local development), you'll need to set up a PostgreSQL database. Ensure your database configuration is set properly in the environment variables before running the project. For the time being, the recommended approach for local development using the database is to use the docker compose Postgres instance with your local dev backend.
Note: If you wish to run the backend outside of Docker (e.g., for local development), you'll need to set up a PostgreSQL database. Ensure your database configuration is set properly in the environment variables before running the project.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some note about setting up the readme properly prior to running this command

CMD pg_isready -U ${POSTGRES_USER} || exit 1

# Expose PostgreSQL port
EXPOSE 5432
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question when we run pdm run dev are we currently connecting to the right db port so that we automatically connect to the db when running locally?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep 5432 is the current default db port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants