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
Add mongo-dev-server package #8853
Conversation
Only start the MongoDB server if this package is present in the project.
Turned out that the changes in #8769 was enough for this to work. There was no need to do the same for |
I'll have a look at the self tests, some might fail if they expect MongoDB without adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @zimme, this looks great! I've added a few small review comments, but I'll take another look after the tests are passing. Thanks again!
packages/mongo-dev-server/README.md
Outdated
# mongo-dev-server | ||
[Source code of released version](https://github.com/meteor/meteor/tree/master/packages/mongo-dev-server) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/mongo-dev-server) | ||
*** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind adding one or two sentences describing the package in the README?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do this.
packages/mongo-dev-server/package.js
Outdated
}); | ||
|
||
Package.onUse(function (api) { | ||
api.addFiles('info.js', 'server'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe consider using api.mainModule
here instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a look.
@@ -34,7 +34,8 @@ Package.onUse(function (api) { | |||
'diff-sequence', | |||
'mongo-id', | |||
'check', | |||
'ecmascript' | |||
'ecmascript', | |||
'mongo-dev-server', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relating to your comment:
I'm thinking we could remove mongo-dev-server as a mongo dependency and use the upgrades thing to just add this package to all current meteor projects on upgrade and add it to the default packages when creating a new project.
I like this idea - Not forcing mongo-dev-server
as a dependency, and using an upgrader
instead, gets my vote!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd need help with how to add this to the upgrader
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing - I haven't had to build one myself, but as far as I understand things, you'll be looking to add your changes in tools/upgraders.js
. The process seems to be pretty well documented in that file - you'll be adding a new upgrade name / section, and you can test things out by running meteor admin run-upgrader myupgradername
. The 1.5-add-dynamic-import-package
upgrader section in that file might be a good one to copy / start from.
tools/runners/run-all.js
Outdated
}); | ||
|
||
const packageMap = self.projectContext.packageMap; | ||
const hasMongoDevServerPackage = packageMap && packageMap.getInfo('mongo-dev-server') != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind switching to use !==
just to make sure we're matching the rest of the source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used !=
to match both null
and undefined
. But if getInfo
always returns null when not found then it shouldn't be a problem using !==
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @zimme, it's probably okay to leave it then. I personally prefer to not use lenient equality / non-equality checks on null
/ undefined
, as when going back over old code I always end up questioning whether the leniency was intended or not ... 🙂.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After talking about this in the issue triage club (including @hwillson), the team is comfortable with the dependency on the dev-only mongo-dev-server
package, rather than some other approach like an upgrader.
Just wanted to give you guys a heads up, I'm heading off on vacation this Friday for 2 weeks and I don't think I'll have time to finish this up before that. |
Nooo, you can't leave!! Seriously though, no problem at all @zimme - thanks for getting things this far. I'll aim to make the remaining small changes, over the next few days (schedule permitting of course - you might find this PR waiting for you when you get back 😉). Have a great 🏖 ! |
We should be all set here now - LGTM! |
LGTM, thanks! |
* Add mongo-dev-server package Only start the MongoDB server if this package is present in the project. * Small layout/formatting adjustments; updated README. * Allow tests using fake-mongod to start (fake) Mongo. * Adjust test stdout matching to be less sensitive to ordering. * Add `mongo-dev-server` History.md entry. * Remove mongo start check since the tested for error prevents mongo startup. * Remove README traling whitespace. * Bump mongo package version.
This reverts commit 4d37a05. After git bisecting between origin/release-1.5 and origin/release-1.5.2, I identified this commit as the culprit in recent failures of the modules test app: https://circleci.com/gh/meteor/meteor/4857#tests/containers/3 Note that the modules test app seems to be failing only on Linux, and it does pass reliably with this commit reverted. It must have something to do with Mongo failing to start, and thus the "App running at" message never appears, but I don't have a good theory why that might be. The command to run just the modules test app is meteor self-test --history 1000 'modules - test app' @zimme @hwillson @abernix any ideas?
Only start the MongoDB server if this package is present in the project. This reverts commit 565281e.
Only start the MongoDB server if this package is present in the project.
For now I've added mongo-dev-server as a dependency of mongo, do we want to do this?
A lot of packages rely on the meteor package and when using Meteor as a build system you might wanna use packages like static-html or dynamic-import but you might still not want a local mongodb instance started.
I'm thinking we could remove mongo-dev-server as a mongo dependency and use the upgrades thing to just add this package to all current meteor projects on upgrade and add it to the default packages when creating a new project.
The way this PR is now results in MONGO_URL being set to
'no-mongo-server'
ifmongo-dev-server
isn't present andMONGO_URL
hasn't been manually set. This will prevent Meteor from trying to connect to a local mongo server even ifmongo
is present in the project. I don't know if this have any other negative effects.This is a first step at resolving meteor/meteor-feature-requests#31.