-
Notifications
You must be signed in to change notification settings - Fork 11
/
db.yaml
60 lines (50 loc) · 1.97 KB
/
db.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{%- from 'init.yaml' import env, event_name, event_year, private_ip %}
{%- set sqlalchemy_pool_sizes = __salt__['saltutil.runner']('mine.get',
tgt='G@roles:reggie and P@roles:(web|worker|scheduler) and G@env:' ~ env ~ ' and G@event_name:' ~ event_name ~ ' and G@event_year:' ~ event_year,
fun='sqlalchemy_pool_size',
tgt_type='compound').values() %}
{%- set sqlalchemy_max_overflows = __salt__['saltutil.runner']('mine.get',
tgt='G@roles:reggie and P@roles:(web|worker|scheduler) and G@env:' ~ env ~ ' and G@event_name:' ~ event_name ~ ' and G@event_year:' ~ event_year,
fun='sqlalchemy_max_overflow',
tgt_type='compound').values() %}
{%- set total_pool_size = sqlalchemy_pool_sizes|sum if sqlalchemy_pool_sizes else 0 %}
{%- set total_overflow = sqlalchemy_max_overflows|sum if sqlalchemy_max_overflows else 0 %}
{%- set total_connections = total_pool_size + total_overflow %}
ufw:
applications:
Postgresql:
to_addr: {{ private_ip }}
comment: Private network PostgreSQL
postgres:
use_upstream_repo: False
pkgs_extra: ['postgresql-contrib']
manage_force_reload_modules: False
postgresconf: |
listen_addresses = '127.0.0.1,{{ private_ip }}'
max_connections = {{ total_connections + 20 }}
{{ stack.get('postgres', {}).get('postgresconf', '')|indent(4) }}
cluster:
locale: en_US.UTF-8
acls:
- ['local', 'all', 'all']
- ['host', 'all', 'all', '127.0.0.1/32', 'md5']
- ['hostssl', 'all', 'all', 'samehost', 'md5']
- ['hostssl', 'all', 'all', 'samenet', 'md5']
users:
{{ stack['reggie']['db']['username'] }}:
ensure: present
password: "{{ stack['reggie']['db']['password'] }}"
createdb: False
createroles: False
encrypted: True
login: True
superuser: False
replication: True
runas: postgres
databases:
{{ stack['reggie']['db']['name'] }}:
runas: postgres
template: template0
encoding: UTF8
lc_ctype: en_US.UTF-8
lc_collate: en_US.UTF-8