Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 994 Bytes

postgresql.md

File metadata and controls

47 lines (33 loc) · 994 Bytes

docker-compose.yml - PostgreSQL

Service running PostgreSQL

docker compose up -d postgres

Envinronment variables

Name Default
POSTGRESQL_VERSION 15.5.0
POSTGRESQL_CONTAINER_NAME
POSTGRESQL_USER root
POSTGRESQL_PASSWORD root
POSTGRESQL_DB postgres
POSTGRESQL_ENABLE_TLS no
POSTGRESQL_RESTART_POLICY no

Using TLS

  1. Set POSTGRESQL_RESTART_POLICY to yes at the .env file
POSTGRESQL_RESTART_POLICY=yes
  1. Go to the certs volume of the postgres service
cd ./volumes/postgres/certs
  1. Generate certificates
openssl req -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out postgres.crt -keyout postgres.key
  1. Change de owner of these files
sudo chown 1001 postgres.*
  1. Finally, you can start the service.