openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rab...@apache.org
Subject [incubator-openwhisk] branch master updated: Allow persisted couchdb directory mount. (#4250)
Date Tue, 12 Feb 2019 00:47:42 GMT
This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new bebb772  Allow persisted couchdb directory mount. (#4250)
bebb772 is described below

commit bebb772d7586b8987dc277b2f82eb3f6c2203b7a
Author: rodric rabbah <rodric@gmail.com>
AuthorDate: Mon Feb 11 19:47:35 2019 -0500

    Allow persisted couchdb directory mount. (#4250)
    
    For example:
      wskdev couchdb -d -e"db_persist_path=/home/couchd/openwhisk"
---
 ansible/group_vars/all                 |  1 +
 ansible/roles/couchdb/tasks/deploy.yml | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/ansible/group_vars/all b/ansible/group_vars/all
index 077945e..821d875 100755
--- a/ansible/group_vars/all
+++ b/ansible/group_vars/all
@@ -234,6 +234,7 @@ db:
   protocol: "{{ db_protocol | default(lookup('ini', 'db_protocol section=db_creds file={{
playbook_dir }}/db_local.ini')) }}"
   port: "{{ db_port | default(lookup('ini', 'db_port section=db_creds file={{ playbook_dir
}}/db_local.ini')) }}"
   host: "{{ db_host | default(lookup('ini', 'db_host section=db_creds file={{ playbook_dir
}}/db_local.ini')) }}"
+  persist_path: "{{ db_persist_path | default(false) }}"
   instances: "{{ groups['db'] | length }}"
   authkeys:
   - guest
diff --git a/ansible/roles/couchdb/tasks/deploy.yml b/ansible/roles/couchdb/tasks/deploy.yml
index 229c8ef..cf40cc1 100644
--- a/ansible/roles/couchdb/tasks/deploy.yml
+++ b/ansible/roles/couchdb/tasks/deploy.yml
@@ -15,6 +15,22 @@
   fail: msg="The db provider in your {{ hosts_dir }}/group_vars/all is {{ db.provider }},
it has to be CouchDB, pls double check"
   when: db.provider != "CouchDB"
 
+- name: ensure directory for persisting db exists
+  stat:
+    path: "{{ db.persist_path }}"
+  register: db_persist_path_exists
+  when: db.persist_path
+
+- name: fail if path to persist db does not exist
+  fail:
+    msg: directory for persisting db does not exist '{{ db.persist_path }}'
+  when: db.persist_path and not (db_persist_path_exists.stat.exists and db_persist_path_exists.stat.isdir)
+
+- name: "mount directory for persisting dbs"
+  set_fact:
+    volumes: "{{ volumes }} + [ '{{ db.persist_path }}:/opt/couchdb/data' ]"
+  when: db.persist_path
+
 - include_tasks: gen_erl_cookie.yml
   when: (db.instances|int >= 2)
 


Mime
View raw message