Meteor Run - Production with MONGO_URL vs. Pick

My question may be a duplicate of this , but I feel that it adds some features that make it somewhat different.

Currently, I have installed the Meteor Docker installation based on the node: 0.10 image, which first binds the application and runs "node main.js" as a CMD. The image also installs Meteor and uses its command to download the environment and install the necessary packages.

It seems to me that the image will be greatly simplified if, instead of using node: 0.10, I could use a more minimal Linux image and just install curl / git / meteor. Removing the build step will simplify the situation even more, because based on my understanding of “building meteors,” there is no way to not create mobile applications if they are configured but not needed (i.e., if I usually create applications for Android / IOS, I I can’t easily not build them if I just want a bundle). In addition, my development environment already uses MONGO_URL and a container instance of MongoDB, so I don’t even use the local database during development.

So what is the difference between "meteor run --production" with the MONGO_URL set and "node main.js"? What happens in one instance that is not in another?

In particular, does the “meteor run production” detect the presence of MONGO_URL rather than deploying a separate, unused mangon? I clearly see the data in the database that MONGO_URL points to, but I'm not sure that the meteor command spins a separate one that sits around and spends CPU cycles / RAM. Based on the previous question, I understand that he was still polling the file system for changes. But is it really easy to use inotify under Linux, and do I correctly assume that the pretty slight performance is a success?

I assume that if I need every ounce of performance on my servers, assembly is the way to go. But if running "meteor run --production" with MONGO_URL installed leads to a slight performance hit, but greatly simplifies my setup, I probably should simplify my Dockerfiles and combine the dev / production settings a bit.

Thanks.

+5
source share
2 answers

It should be noted that meteor run --production ... means "run in a development environment that simulates production", and not "this is how you should run your application during production."

So process.env.NODE_ENV is set to development when you execute the command above.

https://github.com/meteor/meteor/issues/180#issuecomment-30043150

+5
source

Any meteor command uses the database specified by MONGO_URL , and only this database. I usually point MONGO_URL to an empty line when running meteor test-packages to avoid the overhead of formatting a Mongo instance unless the package does something related to the database. For peace of mind, you can double-check this by running htop in another terminal and seeing that no mongo processes have been created.

Regarding meteor run --production monitoring the file system for changes, yes, this is a minor processor overhead. Again htop may help.

"meteor build" has no means not to create mobile applications if they are configured but not needed (that is, if I usually create applications for Android / IOS, I can’t easily build them if I just want a kit)

At the pre-build stage, you can easily replace .meteor / platform to tell only server\nbrowser (remove the android and ios lines) if you don't need mobile platforms.

The advantage of grouping and then starting node main.js is that you can use pm2 (a better alternative forever ) so that your application runs instead of crashes. However, see also Meteor Up .

+1
source

Source: https://habr.com/ru/post/1212343/


All Articles