Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider making PRIMARY replicaset job name a variable #22

Open
leoj3n opened this issue Apr 25, 2019 · 1 comment · May be fixed by #25
Open

Consider making PRIMARY replicaset job name a variable #22

leoj3n opened this issue Apr 25, 2019 · 1 comment · May be fixed by #25

Comments

@leoj3n
Copy link

leoj3n commented Apr 25, 2019

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.

@leoj3n
Copy link
Author

leoj3n commented Apr 26, 2019

Also consider: Rename PRIMARY to SERVICE_NAME.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant