-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcomponent-haproxy.yml
More file actions
147 lines (146 loc) · 6.07 KB
/
component-haproxy.yml
File metadata and controls
147 lines (146 loc) · 6.07 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Haproxy Load Balancer
application:
configuration:
configuration.stats-user: admin
configuration.stats-pass: pa55w0rd
configuration.stats-port: 1926
configuration.stats-url: /admin?stats
configuration.recipe-url: "https://s3.amazonaws.com/qubell-starter-kit-artifacts/qubell-bazaar/component-haproxy-cookbooks-stable-64d18e1.tar.gz"
configuration.bucket_type: "roundrobin"
compute.hardwareId: "t1.micro"
compute.imageId: "ami-246ed34c"
compute.login: "ec2-user"
compute.locationId: "us-east-1"
interfaces:
configuration:
"*": "bind(workflow#input.*)"
compute:
hardwareId: "bind(compute#configuration.hardwareId)"
imageId: "bind(compute#configuration.imageId)"
login: "bind(compute#configuration.login)"
locationId: "bind(compute#configuration.locationId)"
servers:
"*": "bind(workflow#servers.*)"
haproxy:
"*": "bind(workflow#result.*)"
components:
workflow:
type: workflow.Instance
interfaces:
input:
stats-user: { type: configuration(string), name: Haproxy Statistics User }
stats-pass: { type: configuration(string), name: Haproxy Statistics Password }
stats-port: { type: configuration(int), name: Haproxy Statistics Port }
stats-url: { type: configuration(string), name: Haproxy Statistics Url }
recipe-url: { type: configuration(string), name: Chef Cookbooks Url }
bucket_type: { type: configuration(string), name: Haproxy bucket type }
compute:
networks: consume-signal(map<string, map<string, string>>)
exec: send-command(string command, int timeout => string stdOut, string stdErr => string stdOut, string stdErr, int exitCode)
put-file: send-command(string filename, bytes payload)
get-file: send-command(string filename => bytes payload)
servers:
app-uri: consume-signal(list<string>)
actions:
update: receive-command()
result:
lb-stats: { type: publish-signal(object), name: HAProxy stats }
stats-url: { type: publish-signal(string), name: Haproxy statistics }
entry-urls: { type: publish-signal(list<string>), name: Entry url }
required: [ compute ]
configuration:
configuration.triggers:
input.stats-user: update
input.stats-pass: update
input.stats-port: update
input.stats-url: update
input.recipe-url: update
input.bucket_type: update
compute.networks: update
servers.app-uri: reconfigure-servers
configuration.propagateStatus: [ update, reconfigure-servers]
configuration.workflows:
update: &update
steps:
- get-signals:
action: getSignals
output:
signals: result
- get-signals-multi:
action: getSignals
parameters:
multi: true
output:
peers: result
- lb-install:
action: "chefsolo"
precedingPhases: [ get-signals, get-signals-multi ]
phase: lb-install
parameters:
roles: [ compute ]
runList: ["recipe[haproxy]"]
recipeUrl: "{$.recipe-url}"
jattrs:
haproxy:
stats_user: "{$.stats-user}"
stats_pass: "{$.stats-pass}"
stats_port: "{$.stats-port}"
stats_url: "{$.stats-url}"
- add-servers:
action: "chefsolo"
precedingPhases: [ lb-install ]
parameters:
roles: [ compute ]
runList: [ "recipe[haproxy::add_servers]" ]
recipeUrl: "{$.recipe-url}"
jattrs:
haproxy:
host: "{$.signals.compute.networks.public.ip}"
server_uri: "{$.peers.servers.*.app-uri}"
bucket_type: "{$.bucket_type}"
output:
chefAttrs: chefState
return:
lb-stats:
value:
lb-host: "{$.signals.compute.networks.public.ip}"
lb-statistics-url: "http://{$.signals.compute.networks.public.ip}:{$.stats-port}{$.stats-url}"
stats-user: "{$.stats-user}"
stats-pass: "{$.stats-pass}"
stats-url:
value: "http://{$.stats-user}:{$.stats-pass}@{$.signals.compute.networks.public.ip}:{$.stats-port}{$.stats-url}"
entry-urls:
value: "{$.chefAttrs['*'][0]['haproxy']['entry_urls']}"
launch: *update
reconfigure-servers:
steps:
- get-signals:
action: getSignals
output:
signals: result
- get-signals-multi:
action: getSignals
parameters:
multi: true
output:
peers: result
- reconfigure-servers:
action: "chefsolo"
precedingPhases: [get-signals, get-signals-multi]
parameters:
roles: [ compute ]
runList: [ "recipe[haproxy::reconfigure]" ]
recipeUrl: "{$.recipe-url}"
jattrs:
haproxy:
server_uri: "{$.peers.servers.*.app-uri}"
bucket_type: "{$.bucket_type}"
output:
chefAttrs: chefState
return:
entry-urls:
value: "{$.chefAttrs['*'][0]['haproxy']['entry_urls']}"
compute:
type: compute.Instance
bindings:
- [workflow#compute, compute]