forked from qubell-bazaar/component-mysql-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
component-mysql-dev.yml
187 lines (171 loc) · 6.82 KB
/
component-mysql-dev.yml
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
application:
configuration:
input.db-version: "5.0"
input.db-root-password: uR1zaebah0Qu
interfaces:
input:
db-version: "bind(workflow#input.db-version)"
db-root-password: "bind(workflow#input.db-root-password)"
management:
create-db: "bind(workflow#actions.create-db)"
run-sql: "bind(workflow#actions.run-sql)"
change-grants: "bind(workflow#actions.change-grants)"
output:
dbms: "bind(workflow#result.dbms)"
db-host: "bind(workflow#result.db-host)"
db-port: "bind(workflow#result.db-port)"
bindings:
- [workflow, wfService]
- [workflow, secureStore]
components:
wfService:
type: reference.Service
interfaces:
executor:
execute-workflow: receive-command(object request => object status => object status)
execute-command: send-command(string interface, string command, map<string, object> arguments => map<string, object> response => map<string, object> response)
secureStore:
type: reference.Service
interfaces:
keypair-store:
get-keypair: receive-command(string id => object privateKey)
workflow:
type: workflow.Instance
interfaces:
input:
db-version: configuration(string)
db-root-password: configuration(string)
actions:
create-db: receive-command(string db-name)
run-sql: receive-command(string db-name, list<string> sql-url)
change-grants: receive-command(list<string> app-hosts, string db-name, string db-user, string db-password, list<string> privileges)
result:
dbms: publish-signal(object)
#for ui only
db-port: publish-signal(string)
db-host: publish-signal(list<string>)
keypair-store:
get-keypair: send-command(string id => object privateKey)
required: [keypair-store]
configuration:
configuration.workflows:
launch:
parameters:
- db-version: &db-version
description: MySQL Server version
- db-root-password:
description: Root Password
default: uR1zaebah0Qu
steps:
- provision-vm:
action: provisionAmazonVm
phase: provision
parameters:
roleName: default
hardwareId: m1.small
retryCount: 1
jcloudsProvider: aws-ec2
jcloudsEndpoint: https://ec2.us-east-1.amazonaws.com
jcloudsRegions: us-east-1
jcloudsNodeNamePrefix: component
jcloudsIdentity: "{$.identity}"
jcloudsCredential: "{$.credential}"
vmIdentity: ubuntu
imageId: us-east-1/ami-0fac7566
ec2SecurityGroup: default
output:
db-host: ips
- db-install:
action: "chefsolo"
precedingPhases: [ provision ]
phase: db-install
parameters:
roles: [ default ]
runList: ["recipe[mysql-component]"]
recipeUrl: "https://s3.amazonaws.com/qubell-starter-kit-artifacts/qubell-bazaar/component-mysql-dev-cookbooks-stable-0da3569.tar.gz"
jattrs:
mysql:
server_root_password: "{$.db-root-password}"
server_repl_password: "{$.db-root-password}"
server_debian_password: "{$.db-root-password}"
return:
db-host:
value: "{$.db-host}"
db-port:
value: "3306"
dbms:
value:
db-host: "{$.db-host}"
db-port: "3306"
root-password: "{$.db-root-password}"
create-db:
parameters:
- db-name:
description: Create database name
steps:
- db-deploy:
action: "chefsolo"
parameters:
roles: [ default ]
runList: [ "recipe[mysql-component::db_create]" ]
recipeUrl: "https://s3.amazonaws.com/qubell-starter-kit-artifacts/qubell-bazaar/component-mysql-dev-cookbooks-stable-0da3569.tar.gz"
jattrs:
mysql:
server_root_password: "{$.db-root-password}"
mysql-component:
db_name: "{$.db-name}"
return:
db:
value:
name: "{$.db-name}"
run-sql:
parameters:
- db-name:
description: Database
- sql-url:
description: SQL query urls (["url1", "url2"])
steps:
- db-deploy:
action: "chefsolo"
parameters:
roles: [ default ]
runList: [ "recipe[mysql-component::sql_query]" ]
recipeUrl: "https://s3.amazonaws.com/qubell-starter-kit-artifacts/qubell-bazaar/component-mysql-dev-cookbooks-stable-0da3569.tar.gz"
jattrs:
mysql:
server_root_password: "{$.db-root-password}"
mysql-component:
db_name: "{$.db-name}"
sql_url: "{$.sql-url}"
change-grants:
parameters:
- app-hosts:
description: "Hosts allow in MySQL ([array])"
- db-name:
description: "Database name"
- db-user:
description: "User name"
- db-password:
description: "User password"
- privileges:
description: Grant privileges
steps:
- change-grants:
action: "chefsolo"
parameters:
roles: [ default ]
runList: [ "recipe[mysql-component::user_modify]" ]
recipeUrl: "https://s3.amazonaws.com/qubell-starter-kit-artifacts/qubell-bazaar/component-mysql-dev-cookbooks-stable-0da3569.tar.gz"
jattrs:
mysql:
server_root_password: "{$.db-root-password}"
mysql-component:
host: "{$.app-hosts}"
db_name: "{$.db-name}"
db_user: "{$.db-user}"
db_pass: "{$.db-password}"
privileges: "{$.privileges}"
destroy:
steps:
- destroy:
action: undeployEnv