Sign in

Most of the time, if you want to work with cookies, you will stumble across the same set of problems, and start to fight with CORS, headers policies and browser securities features.

Stop. That’s why I shall have told myself after spending 4 hours reading about these topics, while I…

If you are working with PSQL in local development, most of the time it will be easier to host your database with docker. The main benefit I find in this solution is that it allows my co-developers and myself to launch my db in one command.

You will usually create it with something like it:

postgres:
container_name: postgres
restart: always
image: postgres:latest
volumes:
- ./postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: "password"
POSTGRES_USER: "postgres"

The volumes linking allows you to keep the state of your PSQL db saved even after terminating your docker container.

To connect in local you just have to type the following command:

psql -h localhost -p 5432 -U postgres -W

Warning: hosting your database in a container is, at the time I write this article, not recommended for production environments.

Steve

no bio

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store