Skip to content

Commit

Permalink
chore: création du dossier de backup et lancement du backup
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Feb 11, 2025
1 parent 5c72a16 commit 8592733
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
16 changes: 8 additions & 8 deletions infrastructure/backup-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
- name: Populate service facts
ansible.builtin.service_facts:

- name: Print service facts
ansible.builtin.debug:
var: ansible_facts.services
- name: Create backup directory if it does not exist
ansible.builtin.file:
path: {{ mongo_backup_path }}
state: directory
mode: '0755'

- name: Copy config files
ansible.builtin.template:
Expand All @@ -20,8 +22,6 @@
loop:
- { src: "./backup.sh", dest: "~/stylo/backup.sh" }

- name: restart systemd service if it exists
service:
state: restarted
name: ntpd.service
when: ansible_facts['services']['ntpd.service']['status'] | default('not-found') != 'not-found'
- name: Run backup
ansible.builtin.command: ~/stylo/backup.sh
when: ansible_facts['services']['docker-compose-stylo.service']['status'] | default('not-found') == 'running'
1 change: 1 addition & 0 deletions infrastructure/inventories/dev
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ matomo_url={{ lookup('env', 'SNOWPACK_MATOMO_URL') or 'https://analyseweb.huma-n
matomo_site_id={{ lookup('env', 'SNOWPACK_MATOMO_SITE_ID') or 286 }}
se_graphql_token=
assets_path='./front/build'
mongo_backup_path='/home/stylo/stylo/backup'

[stylo]
node01 ansible_user=stylo ansible_host=cchum-kvm-stylo-dev.in2p3.fr
1 change: 1 addition & 0 deletions infrastructure/inventories/prod
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ matomo_url={{ lookup('env', 'SNOWPACK_MATOMO_URL') or 'https://analyseweb.huma-n
matomo_site_id={{ lookup('env', 'SNOWPACK_MATOMO_SITE_ID') or 286 }}
se_graphql_token=
assets_path='./front/build'
mongo_backup_path='/home/stylo/stylo/backup'

[stylo]
node01 ansible_user=stylo ansible_host=cchum-kvm-stylo.in2p3.fr
1 change: 1 addition & 0 deletions infrastructure/templates/backup.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/bash

docker exec mongodb-stylo sh -c 'mongodump --gzip --archive --db {{ mongo_server_db }}' > {{ mongo_backup_path }}/{{ mongo_server_db }}--{{ app_version }}.bson.gz

0 comments on commit 8592733

Please sign in to comment.