-
Notifications
You must be signed in to change notification settings - Fork 30
/
example.js
41 lines (36 loc) · 1.13 KB
/
example.js
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
var HaProxy = require("github.com/quilt/haproxy").Haproxy;
var Mongo = require("github.com/quilt/mongo");
var Node = require("github.com/NetSys/quilt/specs/node/node");
// AWS
var namespace = createDeployment({
namespace: "CHANGE_ME",
adminACL: ["local"],
});
var baseMachine = new Machine({
provider: "Amazon",
cpu: new Range(2),
ram: new Range(2),
sshKeys: githubKeys("ejj"),
});
namespace.deploy(baseMachine.asMaster());
namespace.deploy(baseMachine.asWorker().replicate(3));
var mongo = new Mongo(3);
var app = new Node({
nWorker: 3,
image: "quilt/mean-service",
env: {
PORT: "80",
MONGO_URI: mongo.uri("mean-example")
}
});
var haproxy = new HaProxy(3, app.services());
// Places all haproxy containers on separate Worker VMs.
// This is just for convenience for the example instructions, as it allows us to
// access the web application by using the IP address of any Worker VM.
haproxy.service.place(new LabelRule(true, haproxy.service));
mongo.connect(mongo.port(), app);
app.connect(mongo.port(), mongo);
haproxy.public();
namespace.deploy(app);
namespace.deploy(mongo);
namespace.deploy(haproxy);