I noticed that if I edited the name of "mongodb-replicaset" job in containerpilot.json5, the manage.py script would break because the job name is hard coded.
Therefore, I was thinking it would be good to extract that bit out into a global variable. In fact, we could simply use the REPLICASET variable, having it default to "mongodb-replicaset".
manage.py
|
PRIMARY = 'mongodb-replicaset' |
|
#SECONDARY = 'mongodb-secondary' |
PRIMARY = get_environ('REPLICASET', 'mongodb-replicaset')
#SECONDARY = get_environ('REPLICASET_SECONDARY', 'mongodb-secondary')
containerpilot.json5
|
name: "mongodb-replicaset", |
name: "{{ .REPLICASET | default "mongodb-replicaset" }}",
|
exec: "mongod --replSet={{ if .REPLICASET }}{{ .REPLICASET }}{{ else }}joyent{{ end }}", |
exec: "mongod --replSet={{ .REPLICASET | default "mongodb-replicaset" }}",
name: "onchange-{{ .REPLICASET | default "mongodb-replicaset" }}",
|
source: "watch.mongodb-replicaset", |
source: "watch.{{ .REPLICASET | default "mongodb-replicaset" }}",
|
watches: [ |
|
{ |
|
name: "mongodb-replicaset", |
|
interval: 2 |
|
} |
|
] |
watches: [
{
name: "{{ .REPLICASET | default "mongodb-replicaset" }}",
interval: 2
}
]
local-compose.yml
mongo:
environment:
REPLICASET=awesome-replicaset
Naming conventions:
--replSet doesn't say anything about name restrictions, and the containerpilot job name is adequately restrictive, so would follow the containerpilot name rules.
I noticed that if I edited the name of "mongodb-replicaset" job in
containerpilot.json5, themanage.pyscript would break because the job name is hard coded.Therefore, I was thinking it would be good to extract that bit out into a global variable. In fact, we could simply use the
REPLICASETvariable, having it default to "mongodb-replicaset".manage.pymongodb/bin/manage.py
Lines 75 to 76 in 23f6c30
containerpilot.json5mongodb/etc/containerpilot.json5
Line 30 in 23f6c30
mongodb/etc/containerpilot.json5
Line 32 in 23f6c30
mongodb/etc/containerpilot.json5
Line 44 in 23f6c30
mongodb/etc/containerpilot.json5
Line 47 in 23f6c30
mongodb/etc/containerpilot.json5
Lines 52 to 57 in 23f6c30
local-compose.ymlNaming conventions:
--replSetdoesn't say anything about name restrictions, and the containerpilot jobnameis adequately restrictive, so would follow the containerpilotnamerules.