Skip to content

Instantly share code, notes, and snippets.

@mkeen
Last active March 31, 2020 19:06
Show Gist options
  • Save mkeen/3855e030dea055cdfb4d21ceed5088f7 to your computer and use it in GitHub Desktop.
Save mkeen/3855e030dea055cdfb4d21ceed5088f7 to your computer and use it in GitHub Desktop.
{% set couchdb_nodes = salt['mine.get']('G@roles:couchdb and not G@roles:haproxy', 'private_ip', tgt_type='compound').items() | sort(attribute=0) %}{% if grains['id'] != 'couchdb-a' %}{% set couch_uuids = salt['mine.get']('roles:couchdb', 'uuid', tgt_type='grain') %}{% if couch_uuids['couchdb-a'] %}[couchdb]
uuid = {{ couch_uuids['couchdb-a'] }}{% endif %}{% endif %}
[couchdb]
database_dir = /mnt/storage
[log]
file = /var/log/couchdb2/couch.log
level = error
writer = file
[httpd]
enable_cors = true
changes_timeout = 3600000
[chttpd]
bind_address = {{ salt['network.interface_ip']('vtnet1') }}
[couch_httpd_auth]
allow_persistent_cookies = true
auth_cache_size = 200
iterations = 10
min_iterations = 2
max_iterations = 10
require_valid_user = true
users_db_public = false
timeout = 600
secret = {{ grains['couch_user'] + grains['couch_pass'] }}
[cors]
origins = *
credentials = true
{% if couchdb_nodes|length > 1 %}[cluster]
q = 8
n = 2
seedlist = {% for peer in couchdb_nodes %}{% if grains['id'] != peer[0] %}couchdb@{{ peer[1] }}{{ "," if not loop.index == couchdb_nodes|length else "" }}{% endif %}{% endfor %}{% endif %}
# Security Document - 0.1
[admins]
{{ grains['couch_user'] }} = {{ grains['couch_pass'] }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment