open-sauced / pizza

This is an engine that sources git commits and turns them to insights
Apache License 2.0
31 stars 13 forks source link

Feature: Add docker image suggestion for local postgresql database setup #25

Closed k1nho closed 1 year ago

k1nho commented 1 year ago

Type of feature

🍕 Feature

Current behavior

We can provide a suggestion for setting up a basic postgres database configured with SSL connections using the self-signed certs included in ubuntu image.

Suggested solution

Add the following command as suggestion to the README.md

docker run \
  -d \
  -p 5432:5432 \
  --name postgres_ssl \
  -e POSTGRES_PASSWORD=password \
  postgres:12 \
  -c ssl=on \
  -c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem \
  -c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

Additional context

No response

Code of Conduct

Contributing Docs

jpmcb commented 1 year ago

Yes, this would be a great feature add!! Someone recently did something similar with in the repository API:

https://github.com/open-sauced/api/pull/205

We can provide a suggestion for setting up a basic postgres database configured with SSL connections using the self-signed certs included in ubuntu image.

We'd want something abit more platform agnostic that would also work with macos, fedora, or any other platform. I.e., we should add instructions for the user to generate their own self signed certs like was done in the API pull request.


In the meantime, the ./hack/setup.sh script deploys a postgres cluster to a local kind cluster and works if the port is forwarded to that cluster:

kubectl port-forward opensauced-pizza-postgres-cluster-0 5432:5432 -n default
k1nho commented 1 year ago

Interesting, yeah I was just curious if there was a simpler way for setting up the SSL postgresql locally. Currently, that is how I have it setup, I spawn up a container with the docker CLI like above and use the certs within the container, then I ran the migrations, and its working (macOS). I don't know much Kubernetes (plan to learn more!), but that is the way I've set it up with Docker CLI only.

jpmcb commented 1 year ago

This has more or less been solved since we're now integrating this service with the rest of the OpenSauced API: https://github.com/open-sauced/pizza#local-postgres-database-setup

So now, to get a local development database up, people should run the local workstation steps there