-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathfoobernetes_ts.ts
105 lines (103 loc) · 3.01 KB
/
foobernetes_ts.ts
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
import {resource, serveWorkflow} from 'lyra-workflow';
import * as Foobernetes from './types/Foobernetes';
serveWorkflow({
source: __filename,
steps: {
loadbalancer: resource({
type: "Foobernetes::Loadbalancer",
returns: {
"primary_load_balancer_id": { alias: "loadBalancerID" }
},
state: (webServer1Id: string, webServer2Id: string): Foobernetes.LoadBalancer => new Foobernetes.LoadBalancer({
loadBalancerIP: "10.0.0.1",
location: "eu1",
replica: false,
webServerIDs: [webServer1Id, webServer2Id],
tags: {
team: "lyra team",
role: "primary"
}
})
}),
secondaryloadbalancer: resource({
type: "Foobernetes::Loadbalancer",
returns: {
"secondary_load_balancer_id": { alias: "loadBalancerID" }
},
state: (webServer1Id: string, webServer2Id: string): Foobernetes.LoadBalancer => new Foobernetes.LoadBalancer({
loadBalancerIP: "10.0.0.2",
location: "eu2",
replica: true,
webServerIDs: [webServer1Id, webServer2Id],
tags: {
team: "lyra team",
role: "secondary"
}
})
}),
webserver1: resource({
type: "Foobernetes::Webserver",
returns: {
webServer1Id: { alias: "webServerID" }
},
state: (appServer1Id: string, appServer2Id: string): Foobernetes.WebServer => new Foobernetes.WebServer({
port: 8080,
appServers: [appServer1Id, appServer2Id]
})
}),
webserver2: resource({
type: "Foobernetes::Webserver",
returns: {
webServer2Id: { alias: "webServerID" }
},
state: (appServer1Id: string, appServer2Id: string): Foobernetes.WebServer => new Foobernetes.WebServer({
port: 8080,
appServers: [appServer1Id, appServer2Id]
})
}),
appserver1: resource({
type: "Foobernetes::Instance",
returns: {
"appServer1Id": { alias: "instanceID" }
},
state: (databaseId: string): Foobernetes.Instance => new Foobernetes.Instance({
location: "eu1",
image: "lyra::application",
config: {
name: "appserver1xxx",
databaseID: databaseId
},
cpus: 4,
memory: "8G",
})
}),
appserver2: resource({
type: "Foobernetes::Instance",
returns: {
appServer2Id: { alias: "instanceID" }
},
state: (databaseId: string): Foobernetes.Instance => new Foobernetes.Instance({
location: "eu2",
image: "lyra::application",
config: {
name: "appserver2xxx",
databaseID: databaseId
},
cpus: 4,
memory: "8G",
})
}),
database: resource({
type: "Foobernetes::Instance",
returns: {
databaseId: { alias: "instanceID" }
},
state: (): Foobernetes.Instance => new Foobernetes.Instance({
location: "eu1",
image: "lyra::database",
cpus: 16,
memory: "64G",
})
}),
}
});