bip-backup

location:

    source_directories:
        - /srv/bip.bitsathy.ac.in
        - /usr/local
        - /data/staging/bip.bitsathy.ac.in-app2

    repositories:
        - "app2@ip-address:/data/backup/app2/bip.bitsathy.ac.in-repo"

storage:

    archive_name_format: 'bip.bitsathy.ac.in-{now}'
    encryption_passphrase: ""
    ssh_command: ssh -i /root/.ssh/id_rsa
    relocated_repo_access_is_ok: true
    unknown_unencrypted_repo_access_is_ok: true

retention:

    keep_hourly: 1
    keep_daily: 7
    keep_weekly: 4
    keep_monthly: 6
    keep_yearly: 1
    prefix: 'bip.bitsathy.ac.in'

consistency:

    checks:
        - repository
        - archives

hooks:

    before_backup:
        - echo "Starting a bip.bitsathy.ac.in backup."
    # Postgres database backup
        - sudo -u postgres pg_dump -F p -f - bip >  /data/staging/bip.bitsathy.ac.in-app2/pg_dump/bip.sql

    after_backup:
        - echo "Created a bip.bitsathy.ac.in backup."
        - borg compact app2@ip-address:/data/backup/app2/bip.bitsathy.ac.in-repo
    # healthchecks
        # app1
        - wget -O /dev/null -q --no-check-certificate https://hc.bit.lan/ping/2c3b582e-dfb9-4898-8016-854a389c95c4
        # app2
        - wget -O /dev/null -q --no-check-certificate https://hc.bit.lan/ping/d143c626-76d4-4767-882f-8dc7887169b8   

    on_error:
        - echo "Error while creating a backup or running a backup hook."