This repository was archived by the owner on Jul 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathsynapse.rb
More file actions
79 lines (69 loc) · 2.54 KB
/
Copy pathsynapse.rb
File metadata and controls
79 lines (69 loc) · 2.54 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
include_attribute "smartstack::default"
default.synapse.home = File.join(node.smartstack.home, 'synapse')
default.synapse.install_dir = File.join(node.synapse.home,'src')
default.synapse.config_file = File.join(node.synapse.home,'config.json')
default.synapse.repository = 'https://github.com/airbnb/synapse.git'
default.synapse.reference = 'v0.10.0'
default.synapse.jarname = nil
default.synapse.jvmopts = '-Xmx64m -XX:PermSize=64m'
# override this in your role file or wrapper cookbook
default.synapse.enabled_services = []
default.synapse.haproxy.sock_dir = '/var/haproxy'
default.synapse.haproxy.sock_file = File.join(node.synapse.haproxy.sock_dir, 'stats.sock')
default.synapse.haproxy.channel = 'local1'
# Cookbook in which the runit_service LWRP will look for an sv-synapse-run.erb
# template:
default.synapse.runit_cookbook = 'smartstack'
default.synapse.config = {
'services' => {},
'haproxy' => {
'reload_command' => "sudo service haproxy reload",
'config_file_path' => '/etc/haproxy/haproxy.cfg',
'socket_file_path' => node.synapse.haproxy.sock_file,
'do_writes' => true,
'do_reloads'=> true,
'do_socket' => true,
'global' => [
'daemon',
'spread-checks 2',
'user haproxy',
'group haproxy',
'maxconn 8192',
"log 127.0.0.1 #{node.synapse.haproxy.channel}",
"stats socket #{node.synapse.haproxy.sock_file} group #{node.smartstack.user} mode 660 level admin",
],
'defaults' => [
# we log all services by default
# services that are too high-volume should get an
# option dontlog-normal
# to avoid logging normal successful connections
'log global',
'option dontlognull',
'option log-separate-errors',
# default timeouts; these should be overriden per service
'maxconn 2000',
'timeout connect 5s',
'timeout check 5s',
'timeout client 50s',
'timeout server 50s',
# we re-try the request if a backend dies mid-connection
'option redispatch',
'retries 3',
# default sane balancing between backends
'balance roundrobin',
],
'extra_sections' => {
'listen stats :3212' => [
'mode http',
'stats enable',
'stats uri /',
],
},
}
}
# add localhost aliases for each enabled service
# at airbnb, this is handled by our infrastructure common cookbook,
# which owns generating /etc/hosts from a template
node.synapse.enabled_services.each do |service_name|
default.common.localhost_aliases << "#{service_name}.synapse"
end