1
// Copyright 2013 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
10
"launchpad.net/juju-core/utils"
18
// MongoUpstartService returns the upstart config for the mongo state service.
19
func MongoUpstartService(name, dataDir, dbDir string, port int) *Conf {
20
keyFile := filepath.Join(dataDir, "server.pem")
21
svc := NewService(name)
24
Desc: "juju state database",
25
Limit: map[string]string{
26
"nofile": fmt.Sprintf("%d %d", maxMongoFiles, maxMongoFiles),
27
"nproc": fmt.Sprintf("%d %d", maxAgentFiles, maxAgentFiles),
29
Cmd: "/usr/bin/mongod" +
31
" --dbpath=" + dbDir +
32
" --sslOnNormalPorts" +
33
" --sslPEMKeyFile " + utils.ShQuote(keyFile) +
34
" --sslPEMKeyPassword ignored" +
35
" --bind_ip 0.0.0.0" +
36
" --port " + fmt.Sprint(port) +
43
// MachineAgentUpstartService returns the upstart config for a machine agent
44
// based on the tag and machineId passed in.
45
func MachineAgentUpstartService(name, toolsDir, dataDir, logDir, tag, machineId, logConfig, providerType string) *Conf {
46
svc := NewService(name)
47
logFile := filepath.Join(logDir, tag+".log")
50
Desc: fmt.Sprintf("juju %s agent", tag),
51
Limit: map[string]string{
52
"nofile": fmt.Sprintf("%d %d", maxAgentFiles, maxAgentFiles),
54
Cmd: filepath.Join(toolsDir, "jujud") +
56
" --log-file " + utils.ShQuote(logFile) +
57
" --data-dir " + utils.ShQuote(dataDir) +
58
" --machine-id " + machineId +
61
Env: map[string]string{
62
"JUJU_PROVIDER_TYPE": providerType,