Skip to content

Commit 14a00e9

Browse files
authored
Merge pull request #42 from coopdevs/restic-exporter
restic exporter
2 parents e89551a + f8bd6fc commit 14a00e9

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [Unreleased]
8-
7+
## [v1.2.7] - 2022-08-03
98
### Fixed
9+
- Activated restic exporter and exposed with Prometheus format
10+
See [#42](https://github.com/coopdevs/backups_role/pull/42)
1011
- Ensure the backups user has USAGE privilage on the database's schema. We assume it to be`public` #41.
1112

13+
1214
## [v1.2.6] - 2020-01-23
1315
### Fixed
1416
- When using default backups-prepare script, manage the case when no assets_paths are defined.

defaults/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,12 @@ backups_role_keep_daily: 3
6464
backups_role_keep_weekly: 4
6565
backups_role_keep_monthly: 0
6666
backups_role_keep_yearly: 0
67+
68+
69+
# BackupExporter
70+
monitoring_backup_exporter_enabled: true
71+
monitoring_backup_exporter_host: 127.0.0.1
72+
monitoring_backup_exporter_port: 11800
73+
monitoring_backup_exporter_docker_bind: "{{ monitoring_backup_exporter_host }}:{{ monitoring_backup_exporter_port }}:{{ monitoring_backup_exporter_port }}"
74+
monitoring_backup_exporter_container_name: backup_exporter
75+
monitoring_backup_exporter_image_version: 1.0.0

tasks/main.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,25 @@
8888
restic_cron_stderr_file: "{{ backups_role_cron_stderr_file }}"
8989
restic_repos:
9090
- "{{ backups_role_restic_repo }}"
91+
92+
93+
- name: Working directory
94+
file:
95+
state: directory
96+
path: "/home/{{ backups_role_user_name }}"
97+
owner: "{{ backups_role_user_name }}"
98+
99+
- name: Render template for the docker-compose file.
100+
template:
101+
src: backup-docker-compose.yml.j2
102+
dest: "/home/{{ backups_role_user_name }}/docker-compose.yml"
103+
owner: "{{ backups_role_user_name }}"
104+
105+
106+
- name: Bring up the containers
107+
command: docker-compose up -d # noqa: 304
108+
become: true
109+
become_user: "{{ backups_role_user_name }}"
110+
args:
111+
chdir: "/home/{{ backups_role_user_name }}"
112+
changed_when: false
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: "3.1"
2+
services:
3+
{% if monitoring_backup_exporter_enabled %}
4+
backup_exporter:
5+
image: coopdevstreball/restic-exporter:{{ monitoring_backup_exporter_image_version }}
6+
container_name: {{ monitoring_backup_exporter_container_name }}
7+
environment:
8+
RESTIC_REPOSITORY: "{{ backups_role_restic_repo_url }}"
9+
RESTIC_PASSWORD: "{{ backups_role_restic_repo_password }}"
10+
B2_ACCOUNT_ID: "{{ backups_role_b2_app_key_id }}"
11+
B2_ACCOUNT_KEY: "{{ backups_role_b2_app_key }}"
12+
restart: always
13+
ports:
14+
- {{ monitoring_backup_exporter_docker_bind }}
15+
{% endif %}

0 commit comments

Comments
 (0)