service/services/postgresql.spec

31 lines
1.2 KiB
Plaintext

name: postgresql
user: postgres
command: postgres -D ${SERVICE_ROOT}/db -k /tmp/postgresql-${ENVIRONMENT}
#stop-command: kill -HUP ${PID}
readiness-check-command: pg_isready -p ${PORT_POSTGRESQL} -h localhost -q
environment-variables:
- PGROOT=${SERVICE_ROOT}
provides: postgresql
ports: postgresql
#%file db
# name: database directory
# command: mkdir -p db && chown postgres:postgres db
%file db
name: database
creation-command: mkdir db && chown postgres:postgres db && su - postgres -c "initdb --locale en_US.UTF-8 -D '${SERVICE_ROOT}/db'" && rm db/postgresql.conf
#export-command: FIXME
%configuration db/postgresql.conf
name: database configuration
# gen-config inherits its parameters from the environment
creation-command: gen-config postgresql.conf ${SERVICE_ROOT}/postgresql.conf && chown postgres:postgres ${SERVICE_ROOT}/postgresql.conf
%file /tmp/${SERVICE_NAME}-${ENVIRONMENT}
name: sockets directory
unless-directory: /tmp/${SERVICE_NAME}-${ENVIRONMENT}
# FIXME: impose permissions
creation-command: mkdir -p /tmp/${SERVICE_NAME}-${ENVIRONMENT} && chown postgres:postgres /tmp/${SERVICE_NAME}-${ENVIRONMENT}
# FIXME: add postgresql-pre-start-db-dir around here