vvraskin commented on a change in pull request #3853: Set erlang magic cookie 
for couchdb
URL: 
https://github.com/apache/incubator-openwhisk/pull/3853#discussion_r201713645
 
 

 ##########
 File path: ansible/roles/couchdb/tasks/deploy.yml
 ##########
 @@ -23,6 +23,35 @@
     volume_dir: "{{ instance.volume.fsmount | default( '/mnt/' + 
group_names|first, true ) }}:/usr/local/var/lib/couchdb"
   when: (block_device is defined) and (block_device in disk_status.stdout)
 
+- name: "generate erlang cookie"
+  local_action: command openssl rand -base64 32op
+  register: random_stdout
+  run_once: true
+  when: erlang_cookie is not defined
+
+- set_fact:
+    erlang_cookie: "{{ random_stdout.stdout }}"
+  when: erlang_cookie is not defined
+
+- name: "ensure config root dir exists"
+  file:
+    path: "{{ config_root_dir }}"
+    state: directory
+
+# when enable uid namespace mode, couchdb container doesn't have permission to 
change the owner of files which mounted
+# from host, so the container will be failed to start. Use a temporary 
container here to create the file erlang.cookie
+# with the correct user 'couchdb' as its owner
+- name: "create the erlang cookie file on remote"
+  vars:
+    couchdb_image: "{{ couchdb.docker_image | default('apache/couchdb:' ~ 
couchdb.version ) }}"
+  command: "docker run --rm -v /tmp:/tmp -u couchdb {{ couchdb_image }} sh -c 
'echo {{ erlang_cookie }} >> /tmp/erlang.cookie'"
 
 Review comment:
   Or maybe checking this condition would be enough as well: 
   `when: (db.instances|int >= 2)`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to