Skip to content

Consider making PRIMARY replicaset job name a variable #22

Open
@leoj3n

Description

@leoj3n

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

mongodb/bin/manage.py

Lines 75 to 76 in 23f6c30

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-mongo",

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions