Subida inicial con imagen en forja Helpcom.cl
This commit is contained in:
parent
47e0266ee0
commit
0aca71a1a9
6 changed files with 76 additions and 1 deletions
31
README.md
31
README.md
|
@ -1,3 +1,32 @@
|
|||
# postgresql-pruebacron
|
||||
|
||||
PostgreSQL imagen Debian con pg_cron.
|
||||
PostgreSQL imagen Debian con pg_cron.
|
||||
|
||||
## Preparación
|
||||
|
||||
Copiar el archivo ``env`` a ``.env`` y actualizar las variables necesarias.
|
||||
|
||||
A menos que se detalle lo contrario, las variables tienen los mismos significados que en la imagen oficial de PostgreSQL.
|
||||
|
||||
* En **Podman**, ``POSTGRES_UID`` debe ser ``0`` o ``1`` según el modo de userns escogido. Ver la documentación de Podman para más información.
|
||||
* En **Docker**, ``POSTGRES_UID`` debe ser un UID para el usuario de Postgres. No debe ser ``0`` o un UID del sistema.
|
||||
* En **Docker**, ``POSTGRES_INITDB_ARGS`` debe estar definido pero vacío.
|
||||
|
||||
La carpeta postgres.conf.d, contiene los archivos de configuración que se cargan al iniciar el servicio de la base de datos.
|
||||
|
||||
## Uso
|
||||
|
||||
Con ``docker compose up -d`` (asumiendo Docker 24 hacia arriba).
|
||||
|
||||
Con ``podman-compose up -d``.
|
||||
|
||||
## Chequeo
|
||||
|
||||
Para verificar que se ha cargado las configuraciones y el motor correctamente, hay dos pasos:
|
||||
|
||||
* Observar alguna de las variables de los archivos de configuración:
|
||||
|
||||
``postgres> show shared_buffers;``
|
||||
|
||||
* Observar que pg_cron aparece en la lista de extensiones disponibles en ``CREATE EXTENSION``.
|
||||
|
||||
|
|
24
docker-compose.yml
Normal file
24
docker-compose.yml
Normal file
|
@ -0,0 +1,24 @@
|
|||
version: '3.6'
|
||||
services:
|
||||
|
||||
db:
|
||||
image: ${POSTGRES_IMAGE?-noimage-}
|
||||
restart: unless-stopped
|
||||
user: ${POSTGRES_UID?-nouid-}
|
||||
environment:
|
||||
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD?-no-passwd}"
|
||||
TZ: America/Santiago
|
||||
#LANG: es_ES.utf8
|
||||
PGDATA: ./var/lib/postgresql/data/pgdata
|
||||
POSTGRES_INITDB_ARGS: "${POSTGRES_INITDB_ARGS}"
|
||||
ports:
|
||||
- "${BDD_PORT?-noport-}:5432"
|
||||
volumes:
|
||||
- ./postgres.conf.d:/etc/postgresql/conf.d
|
||||
- ${BDD_STORAGE?-no-storage}:/var/lib/postgresql/data
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: '512M'
|
||||
cpus: '0.25'
|
||||
|
10
env
Normal file
10
env
Normal file
|
@ -0,0 +1,10 @@
|
|||
POSTGRES_IMAGE=forja.helpcom.cl/helpcom/postgres-test:14-2506
|
||||
POSTGRES_UID=2000
|
||||
POSTGRES_PASSWORD=password
|
||||
BDD_PORT=60998
|
||||
BDD_STORAGE=/home/helpcom/postgres_cron/data.dir
|
||||
POSTGRES_INITDB_ARGS=
|
||||
#TZ=America/Santiago
|
||||
#POSTGRES_INITDB_ARGS=--locale-provider=icu --icu-locale=es_ES
|
||||
#POSTGRES_INITDB_ARGS=--locale=es_ES
|
||||
|
5
postgres.conf.d/10-locale.conf
Normal file
5
postgres.conf.d/10-locale.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
#locale-provider = 'icu'
|
||||
#icu_locale = 'es_ES.utf8'
|
||||
datestyle = 'iso, ymd'
|
||||
timezone = 'America/Santiago'
|
||||
|
4
postgres.conf.d/10-service.conf
Normal file
4
postgres.conf.d/10-service.conf
Normal file
|
@ -0,0 +1,4 @@
|
|||
max_connections = 120
|
||||
shared_buffers = 160MB
|
||||
|
||||
|
3
postgres.conf.d/20-cron.conf
Normal file
3
postgres.conf.d/20-cron.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
shared_preload_libraries = 'pg_cron'
|
||||
cron.database_name = postgres
|
||||
|
Loading…
Add table
Reference in a new issue