Add MONGODB_OPLOG_URL for apps that require oplog access

remove the replicaSet arg (it causes problems in tests but not in apps).
it causes some issues because of hostname not being set properly/docker network.
this only prevents the client from using replicaSet features which doesn't apply
to us since it is single instance.
This commit is contained in:
Girish Ramakrishnan
2019-06-26 21:49:25 -07:00
parent 455f597543
commit e3d288ef7d
3 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -1642,6 +1642,6 @@
[4.1.6]
* Fix issue where CLOUDRON_APP_HOSTNAME was incorrectly set
* Add MONGODB_REPLICA_SET env var for mongo addon
* Remove chat link from the footer of login screen
* Add support for oplog tailing in mongodb
+8 -4
View File
@@ -1437,7 +1437,8 @@ function setupMongoDb(app, options, callback) {
const data = {
database: app.id,
username: app.id,
password: error ? hat(4 * 128) : existingPassword
password: error ? hat(4 * 128) : existingPassword,
oplog: !!options.oplog
};
getServiceDetails('mongodb', 'CLOUDRON_MONGODB_TOKEN', function (error, result) {
@@ -1450,15 +1451,18 @@ function setupMongoDb(app, options, callback) {
const envPrefix = app.manifest.manifestVersion <= 1 ? '' : 'CLOUDRON_';
var env = [
{ name: `${envPrefix}MONGODB_URL`, value : `mongodb://${data.username}:${data.password}@mongodb/${data.database}` },
{ name: `${envPrefix}MONGODB_URL`, value : `mongodb://${data.username}:${data.password}@mongodb:27017/${data.database}` },
{ name: `${envPrefix}MONGODB_USERNAME`, value : data.username },
{ name: `${envPrefix}MONGODB_PASSWORD`, value: data.password },
{ name: `${envPrefix}MONGODB_HOST`, value : 'mongodb' },
{ name: `${envPrefix}MONGODB_PORT`, value : '27017' },
{ name: `${envPrefix}MONGODB_DATABASE`, value : data.database },
{ name: `${envPrefix}MONGODB_REPLICA_SET`, value : 'rs0' }, // only needed if client wants to use rs features
{ name: `${envPrefix}MONGODB_DATABASE`, value : data.database }
];
if (options.oplog) {
env.push({ name: `${envPrefix}MONGODB_OPLOG_URL`, value : `mongodb://${data.username}:${data.password}@mongodb:27017/local?authSource=${data.database}` });
}
debugApp(app, 'Setting mongodb addon config to %j', env);
appdb.setAddonConfig(app.id, 'mongodb', env, callback);
});
+1 -1
View File
@@ -17,7 +17,7 @@ exports = module.exports = {
'images': {
'mysql': { repo: 'cloudron/mysql', tag: 'cloudron/mysql:2.0.2@sha256:a28320f313785816be60e3f865e09065504170a3d20ed37de675c719b32b01eb' },
'postgresql': { repo: 'cloudron/postgresql', tag: 'cloudron/postgresql:2.0.2@sha256:6dcee0731dfb9b013ed94d56205eee219040ee806c7e251db3b3886eaa4947ff' },
'mongodb': { repo: 'cloudron/mongodb', tag: 'cloudron/mongodb:2.1.0@sha256:5725e01e868529237065bd70c7ae50d1f5576cf66cc2c159b59e7ec922748931' },
'mongodb': { repo: 'cloudron/mongodb', tag: 'cloudron/mongodb:2.1.0@sha256:6d1bf221cfe6124957e2c58b57c0a47214353496009296acb16adf56df1da9d5' },
'redis': { repo: 'cloudron/redis', tag: 'cloudron/redis:2.0.0@sha256:8a88dd334b62b578530a014ca1a2425a54cb9df1e475f5d3a36806e5cfa22121' },
'mail': { repo: 'cloudron/mail', tag: 'cloudron/mail:2.3.1@sha256:9693e3ae42a12a7ac8cf5df94d828d46f5b22b4e2e1c7d1bc614d6ee2a22c365' },
'graphite': { repo: 'cloudron/graphite', tag: 'cloudron/graphite:2.0.2@sha256:454f035d60b768153d4f31210380271b5ba1c09367c9d95c7fa37f9e39d2f59c' },