instance-postgres.cfg.in 2.87 KB
[buildout]
parts =
  postgres-instance
  postgres-promise


# Define egg directories to be the one from Software Release
# (/opt/slapgrid/...)
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true




#----------------
#--
#-- Creates a Postgres cluster, configuration files, and a database.

[postgres-instance]
recipe = slapos.cookbook:postgres

# Options
ipv6 = $${instance-parameters:ipv6}
ipv4 = $${instance-parameters:ipv4}
ipv6-random = $${instance-parameters:ipv6-random}
superuser = postgres
password = $${postgres-passwd:passwd}
port = 5432
dbname = db
# pgdata_directory is created by initdb, and should not exist beforehand.
pgdata-directory = $${directories:var}/data
bin = ${postgresql91:location}/bin
services = $${directories:services}

template-postgresql-conf =
    # This configuration file is generated by a SlapOS instance profile. Manual edits will be overwritten.
    listen_addresses = '{listen_addresses}'
    port = $${:port}
    logging_collector = on
    log_rotation_size = 50MB
    max_connections = 100
    datestyle = 'iso, mdy'
    lc_messages = 'en_US.UTF-8'
    lc_monetary = 'en_US.UTF-8'
    lc_numeric = 'en_US.UTF-8'
    lc_time = 'en_US.UTF-8'
    default_text_search_config = 'pg_catalog.english'
    unix_socket_directory = '{unix_socket_directory}'
    unix_socket_permissions = 0700

template-pg-hba-conf =
    # This configuration file is generated by a SlapOS instance profile. Manual edits will be overwritten.
    # TYPE  DATABASE        USER            ADDRESS                 METHOD
    # "local" is for Unix domain socket connections only (check unix_socket_permissions!)
    local   all             all                                     trust
    host    all             all             127.0.0.1/32            md5
    host    all             all             ::1/128                 md5
    {ipv4_auth}
    {ipv6_auth}

template-hba-ipv4 =
    host    all             all             {ip}/32                   md5

template-hba-ipv6 =
    host    all             all             {ip}/128                  md5



#----------------
#--
#-- Generates a random password and stores it in the filesystem

[postgres-passwd]
recipe = slapos.cookbook:generate.password
storage-path = $${directories:srv}/postgres_passwd
bytes = 16


#----------------
#--
#-- Deploy promise scripts.

[postgres-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directories:promises}/postgres
hostname = $${instance-parameters:ipv6-random}
port = $${postgres-instance:port}


#----------------
#--
#-- Fetches parameters defined in SlapOS Master for this instance

[instance-parameters]
recipe = slapos.cookbook:slapconfiguration
computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}