Skip to content

Commit b595e67

Browse files
authored
Kubernetes deployment now requires Mongo auth (#1826)
The MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD variables, if they exist when the MongoDB container is started up, will be used to tell MongoDB to start in auth-required mode. If there is an existing database then the value of these env vars doesn't matter and the usernames and passwords from the existing database will be used instead, but if the database is empty then these two env vars are used to set up an initial administrator account that can access and change anything, and the DB setup scripts are then expected to create any other required users. Since we now have authentication defined in Mongo, we can turn this on by default and everything will continue to work. This has already been done manually (via the Rancher control panel) on staging and production; this PR simply adds the required environment variables to the depoyment file so that if anyone runs make deploy-staging or make deploy-prod in the future, the deployment will not remove those environment variables.
1 parent 6536bb5 commit b595e67

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docker/deployment/base/db-deployment.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ spec:
6969
cpu: 0.1
7070
limits:
7171
memory: 400Mi
72+
emv:
73+
- name: MONGO_INITDB_ROOT_USERNAME
74+
valueFrom:
75+
secretKeyRef:
76+
key: MONGODB_USER
77+
name: mongo-auth
78+
- name: MONGO_INITDB_ROOT_PASSWORD
79+
valueFrom:
80+
secretKeyRef:
81+
key: MONGODB_PASS
82+
name: mongo-auth
7283
volumeMounts:
7384
- mountPath: /data/db
7485
name: data

0 commit comments

Comments
 (0)