# This file is responsible of three things:
# 1/ Act as "Apache exporter"
# 2/ Act as "Postgres backup infrastructure requester"
# 3/ Act as "Apache" instance

{% import 'parts' as parts %}
{% import 'replicated' as replicated %}

[buildout]
extends = {{templateapache}}
          {{templatepbsreadyexport}}

parts +=
    {{ parts.replicate("postgres", "3") }}

# Repeating parts from instance-apache-php.
# XXX-Cedric: how to simplify this?
    certificate-authority
    ca-stunnel
    logrotate
    logrotate-entry-apache
    logrotate-entry-stunnel
    cron
    cron-entry-logrotate
    promise
    frontend-promise
    content-promise
    publish-connection-informations

{{ replicated.replicate("postgres", "3", "postgres-export", "postgres-import") }}

# Nothing to do for the exporter. This wrapper is intended
# to produce the "dump" files that have to be backed up.
# So, in case of binary DB data, we would back up the ASCII dump
# files, or a similar data format that can be restored on any machine
# (i.e. postgres 'custom')
# In the case of an httpd instance, the src/www directory can be directly
# pulled from the PBS, we don't need to prepare anything.
[exporter]
wrapper = /bin/true

# State that we want to backup srv/www directory, not srv/backup.
# XXX-Cedric: works well, but doesn't work with big data.
[rdiff-backup-server]
path = ${directory:www}

# Add "exporter" parameters to list of published connection parameters
[publish-connection-informations]
# XXX-Cedric: Long term goal: could be a recipe that requests an instance and
# bubbles ALL
# parameters of the requested instance. Requirement: aggregated publish.
<= resilient-publish-connection-parameter

# XXX-Cedric: resilient overwrites what's returned from request-postgres
# XXX-Cedric: change the request method to return everything from
#             getConnectionParameterDict()
[request-postgres]
return = ssh-public-key ssh-url notification-id ip url