diff --git a/roles/appsmith/meta/main.yml b/roles/appsmith/meta/main.yml index 392092d..f387b2f 100644 --- a/roles/appsmith/meta/main.yml +++ b/roles/appsmith/meta/main.yml @@ -3,6 +3,7 @@ dependencies: - role: mkdir - role: maven + - role: repo_mongodb - role: redis_server when: appsmith_redis_url | urlsplit('hostname') in ['localhost','127.0.0.1'] - role: mongodb_server diff --git a/roles/appsmith/tasks/archive_pre.yml b/roles/appsmith/tasks/archive_pre.yml index c1f5d0e..0b87dd7 100644 --- a/roles/appsmith/tasks/archive_pre.yml +++ b/roles/appsmith/tasks/archive_pre.yml @@ -19,3 +19,6 @@ delegate_to: "{{ inventory_hostname }}" tags: appsmith +- name: Dump mongo database + command: mongodump --uri {{ appsmith_mongo_url }} --out {{ appsmith_root_dir }}/archives/{{ appsmith_current_version }}/ + tags: appsmith diff --git a/roles/appsmith/tasks/install.yml b/roles/appsmith/tasks/install.yml index bd1c3a7..67eb7f1 100644 --- a/roles/appsmith/tasks/install.yml +++ b/roles/appsmith/tasks/install.yml @@ -5,6 +5,7 @@ name: - nodejs - java-11-openjdk + - mongodb-org-tools tags: appsmith - name: Detect exact JRE version @@ -92,3 +93,10 @@ systemd: daemon_reload=True when: appsmith_units.results | selectattr('changed','equalto',True) | list | length > 0 tags: appsmith + +- name: Install pre/post backup hoooks + template: src={{ item }}-backup.sh.j2 dest=/etc/backup/{{ item }}.d/appsmith mode=700 + loop: + - pre + - post + tags: appsmith diff --git a/roles/appsmith/templates/post-backup.sh.j2 b/roles/appsmith/templates/post-backup.sh.j2 new file mode 100644 index 0000000..8ac3f4d --- /dev/null +++ b/roles/appsmith/templates/post-backup.sh.j2 @@ -0,0 +1,3 @@ +#!/bin/bash -e + +rm -rf {{ appsmith_root_dir }}/backup/* diff --git a/roles/appsmith/templates/pre-backup.sh.j2 b/roles/appsmith/templates/pre-backup.sh.j2 new file mode 100644 index 0000000..e0d1e07 --- /dev/null +++ b/roles/appsmith/templates/pre-backup.sh.j2 @@ -0,0 +1,3 @@ +#!/bin/bash -e + +mongodump --uri {{ appsmith_mongo_url }} --out {{ appsmith_root_dir }}/backup