too me a long time to figure this one out (if its the issue I suspect it is):
A quick test here:
cd to your apps root dir (one containing .meteor) and run this command: du -sh ./.meteor. (bonus: learn about du)
I got this sent back by the terminal
796M ./
This quick test is kind of cryptic… but that’s the size of your .meteor.
How big is yours?*your directory that is… How much ram does your VPS have?
I found that du -sh ./.meteor/local/db/* was the culpertate. It had multi GB file that mongo was trying load into memory, which was causing my problem.
if you’re also seeing huge files. Then read my comment here:
It includes explaination why this is happening and how I fixed it.
you can ignore the rest of the comments from the Issue I link to, those turned out to be unrelated to my issue.
for me it wasn’t CentOS, but the settings in default installation in mongodb. Really simple fix. No issues since then.
Something else to bear in mind is type of hypervisor. OpenVZ memory management collides horribly with Java memory management (or used to anyway). This may also be an issue with MongoDB memory management.
Rozzzly, it’s 65M and I know about du as I have experience running PHP CentOS servers. It’s the starter site! I haven’t actually done any coding yet!
Warehouseman, I think it may be memory related, which is why I asked the question about my VPS.
I have since, reinstalled mongodb npm and nodejs to see if that makes a difference. Unfortunately it made no difference and I get the same message.
I do notice that selinux is installed on this server. Do you think that might be part of the problem?
The bit you describe I’ve pretty much found out on my own. What I’m struggling with is finding a nice guide to get my VPS ready to host a build/bundled meteor site.
I was going to try the following pages to see if they helped:
Use mupx - it will take care of a lot of the production server config for you via Docker (makes sure the proper versions of Node, nginx, Mongo, etc. are installed, configured for Meteor, and ready to use). Follow the instructions on the mupx site for details.
The above being said mupx is really only supported on Ubuntu, but you can probably get it working with CentOS.
I wrote a tool for deploying to CentOS called meteor-please. However, it is for CentOS 7 and uses systemd for process monitoring/daemonising. You can look through the scripts directory to get an idea of how to get your VPS ready for your meteor bundle.
I know I’ve only just gotten around to replying, but, could I ask a few questions about your 8 steps below?
STEP 1 - Provision a new VM with Ubuntu
Are you meaning the VM will be the production server?
STEP 2 - Security harden7 the new VM.
STEP 3 - Install mupx6 to handle deployments (let it take care of node, mongodb and nginx installs via docker).
Install mupx6 on the production server? In my case my CentOS7 VPS?
STEP 4 - Make sure the SSH user that will be used with mupx is in the sudo group and has NOPASSWD (see Additional Setup/Deploy Information1).
STEP 5 - “mupx init” in local project; adjust mup.json as needed.
STEP 6 “mupx setup” in local project.
STEP 7 “mupx deploy” in local project.
When you refer to local project, what is your local set up?
For me I have a VPS ready that needs configuration for use as PRODUCTION. I then have a local VM on my WIndows10 box for development.
What I am mostly struggling with is what commands I need to carry out on the production server to make it ready to host my meteor product in a LIVE state.
By local project I mean your local development project. All mupx commands are run locally, within your project.
The great thing about mupx is that it takes care of all of this for you. It uses Docker to self contain everything it needs to run your meteor app, so you really don’t have to do much (again, check the docs - they explain all of this pretty well).
All of the above being said, the instructions I listed were for getting up and running with Linode and Ubuntu, not CentOS. CentOS is not supported by mupx. For CentOS 7 you’re probably better off using meteor-please or something similar. For CentOS 6 it’s possible to use mup, but you have to jump through a bunch of hoops.
Actually, for completeness - if anyone is interested in a really quick summary of the steps needed to get mup running on CentOS 6, here are my notes:
Awesome! I’ve actually been running through the bundle approach and am damn close now! The only thing I am stuck on is installing NPM with a version of NodeJS that meteor supports!
You’ve hit my current troubles bang on the head!
I am experiencing the fibers NPM error. I get the following when trying to “npm install” on bundle/programs/server. I have tried all kinds of Node/NPM version combinations and I still get it no matter what. I am currently on Node 10.41 from nodesource (Meteor list this as current tested version of Node here).
I have also tried the “npm uninstall fibers” then reinstall work around people have suggested on various forums.
Nothing works. I am this close to having the VPS wiped and ubuntu put on!
However, it feels like I am almost there with CentOS 7 so I don’t want to give up just yet.
The error:
module.js:340
throw err;
^
Error: Cannot find module '/home/meteor/bundle/programs/server/node_modules/fibers/build.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:935:3
npm ERR! fibers@1.0.5 install: `node ./build.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the fibers@1.0.5 install script.
npm ERR! This is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls fibers
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.10.0-327.10.1.el7.x86_64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /home/meteor/bundle/programs/server
npm ERR! node -v v0.10.41
npm ERR! npm -v 1.4.29
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
It’s been a while since I’ve worked on deployment stuff, but I have some suggestions. If fibers doesn’t install/build correctly then you might need to install some devtools: yum install make gcc-c++
Then try rm -rf node_modules/fibers && npm install again. (Also check permissions maybe? try chown -R your directory)
Just to let anyone reading this know, I am up and running now.
My final solution was to switch to Ubuntu 14.04 and use Passenger to deal with running nginx and meteor. They have a tutorial tailored to Meteor set up and this got me going.
I did experience issues with bcrypt failing but found that deleting the npm/npm-bcrypt folder inside /bundle/programs/server then npn install bcrypt resolved the issue.
I even wrote a script that applies this work as well as uncompressing the tarball and updating the live site. So it’s all fairly slick now.
Which means I can finally get on with coding in Meteor!
I will happily share my set-up notes if anyone wants them but they need editing first. So reply if you want them and I’ll put the effort in