News for hackers. Stuff that matters.
Re:SQLite or PostgreSQL? It's Complicated by jayd16 on Wednesday June 29, 2022 @12:21AM (#31916474)
The official docker image seems quite good and handles a lot of the bootstrapping needs.
Re:SQLite or PostgreSQL? It's Complicated by riku_iki on Wednesday June 29, 2022 @12:34AM (#31916543)
Could you be more specific what exactly it handles from the steps above?..

Also, docker adds complexity itself.

Re:SQLite or PostgreSQL? It's Complicated by physicsguy on Wednesday June 29, 2022 @12:54AM (#31916629)
I can’t remember the exact command off top of my head but it’s something like:

docker run -it -e POSTGRES_PASSWORD -p 5432:5432 postgres:12

And bam, you have a server

Re:SQLite or PostgreSQL? It's Complicated by sixbrx on Wednesday June 29, 2022 @08:53AM (#31919460)
Another cool thing is you can initialize the Postgres db when it starts the container with your own SQL (or sh) scripts to create your schemas, tables, views etc by just copying the scripts into /docker-entrypoint-initdb.d/.

Like:

FROM postgres:14.3

COPY pg/pg-config.sql /docker-entrypoint-initdb.d/000-pg-config.sql

COPY pg/schemas.sql /docker-entrypoint-initdb.d/010-schemas.sql

COPY pg/meddra-tables.sql /docker-entrypoint-initdb.d/020-meddra-tables.sql

# ...

RUN chmod a+r /docker-entrypoint-initdb.d/*

ENV POSTGRES_USER=myapp

ENV POSTGRES_PASSWORD=xxx

ENV POSTGRES_DB=mydb

Re:SQLite or PostgreSQL? It's Complicated by physicsguy on Wednesday June 29, 2022 @09:57AM (#31920150)
I tend to do things like (after launching container):

docker exec postgres psql -h localhost -p 5432 -U ${DBADMINUSER} -c "some SQL statement"

Re:SQLite or PostgreSQL? It's Complicated by riku_iki on Wednesday June 29, 2022 @12:24PM (#31922333)
There is config change in steps above (pgsql defaults suck), and having docker now, changing them becomes harder.

Also, I usually change hba.conf file too, to disallow outside connections.

Re:SQLite or PostgreSQL? It's Complicated by jayd16 on Wednesday June 29, 2022 @02:31PM (#31923984)
Keep in mind the suggestion was a managed product in production but if you really need to customize your local image, you can mount in arbitrary initialization scripts as well.

If you need all this customization then did SQLite really fit the bill in the first place?

Re:SQLite or PostgreSQL? It's Complicated by riku_iki on Wednesday June 29, 2022 @03:11PM (#31924458)
> if you really need to customize your local image

I need to change config for prod pgsql instance, because default config performance wise is not necessary suitable for serious prod machines.

> If you need all this customization then did SQLite really fit the bill in the first place?

I am not familiar with SQLite, but somehow familiar with Java H2 DB, which has similar idea. You can embed it and all configs into self contained java jar file together with your app and no moves in host OS is needed.

Re:SQLite or PostgreSQL? It's Complicated by physicsguy on Wednesday June 29, 2022 @05:09PM (#31925738)
I only use this for local development personally, we use RDS in Prod