service/services/postgresql.spec

29 lines
1.1 KiB
Plaintext

name: postgresql
user: postgres
command: postgres -D ${SERVICE_ROOT}/db -k /tmp/postgresql-${ENVIRONMENT}
#stop-command: kill -HUP ${PID}
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
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
# 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
command: mkdir -p /tmp/${SERVICE_NAME}-${ENVIRONMENT} && chown postgres:postgres /tmp/${SERVICE_NAME}-${ENVIRONMENT}
# FIXME: add postgresql-pre-start-db-dir around here