Deployment and Monitoring

There’s an issue with this code. The regex doesn’t compile:

WebApp.rawConnectHandlers.use(function(req, res, next) {
  // this is the problematic line:
  if (req._parsedUrl.pathname.match(/\.(ttf|ttc|otf|eot|woff|font\.css|css)$/) {
    res.setHeader('Access-Control-Allow-Origin', /* your hostname, or just '*' */);
  }
  next();
});

Sadly my regex is not strong and I’m not sure what the issue is.

The if line is missing a closing brace! No issues with regex. I’ll make a pull request to fix this!

Another thing worth adding might be a mention of using cdn for local development. It should be disabled locally, right? Unless I’m missing something

Another issue I’ve just run into while using the CDN is the option to have a fallback to the regular site if the CDN doesn’t load the file properly.

If you have a site with 25 servers and you do an update, it will take a while to update all of them. If someone then comes to the site during the update and Amazon tries to fetch the JS for the site from your domain it might not be able to retrieve it. It depends on what Meteor instance Cloudfront connects to as to which files will be available.

This also happens if you only try to update the code for some servers, but not all of them. I think I’ll post this in its own topic now.

Can we get some new monitoring recommendations with Kadira closing? Should at least consider removing Kadira from the guide.

4 Likes

Any idea what has changed in deploying apps in meteor 1.4? I recently updated my app from 1.2.1 to latest meteor and all JS files are not bundled to together after deployment.

  1. meteor deploy --architecture os.linux.x86_64
  2. copy bundle to server
  3. meteor npm install in /programs/server folder
  4. node main.js

Before I got nicely bundled CSS and JS files but now I have JS file for every package.

I guess this would answer your question: https://github.com/meteor/meteor/pull/7572. And as to why minifying for the server isn’t that important: Meteor Server Side - Minification?

Thanks for the reply. I noticed they are talking about minifying server side code. In my case all the client side code is not bundled together. I have verified that other meteor sites are serving single js and css file to browser so there must be something wrong with the way I deployed my app.

I assume you meant meteor build here?

Oops. Yes meteor build not deploy.

1 Like

I see. I haven’t seen this happening. I’m afraid I can’t help with this one other than by suggesting to reinstall Meteor. Though it would be good to trace back to the real cause in case it’s a bug.

I think a good option would be to create a new app, and see if it still happens. If it works well for a new app, then there is probably something about that specific application. I would try to make the application simpler and simpler until the issue doesn’t happen anymore, that will help isolate the cause. Reinstalling Meteor is unlikely to help.

That’s a very sensible suggestion, @sashko . Actually the best course of action. @jarski mentions updating the app from 1.2.1 to 1.4, without saying anything about changing the app code. My rationale was that, in this case the nuclear option would be best to try first, as it only takes a few minutes and there’s a slight chance it might save you all the tedious steps. I’ve seen meteor-tool getting corrupted once or twice in the past, after botched download attempts.

And now that I looked twice: why meteor npm install and not npm install?

There was actually simple solution: the standard minifiers got removed for some reason during the update. Problem was solved by adding the package. Thanks for the help!

1 Like

Hi, I am trying to follow the deployment guide at https://guide.meteor.com/deployment.html#custom-deployment

Everything is good until the last command:

MONGO_URL=mongodb://localhost:27017/myapp ROOT_URL=http://my-app.com node main.js

# result:
/home/meteor/deploy/server/bundle/programs/server/node_modules/fibers/fibers.js:16
	throw new Error('`'+ modPath+ '.node` is missing. Try reinstalling `node-fibers`?');

Shouldn’t the npm install have installed all dependencies?

UPDATE: Found this solution: https://stackoverflow.com/questions/13327088/meteor-bundle-fails-because-fibers-node-is-missing. Perhaps the deployment guide should be updated to include the fiber reinstall?

Kadira is to be removed, there’s some other service that offers kadira.

Kadira links are broken, that section should be removed / updated.

1 Like

It’s a bit tricky to deduce which Node version to use when deploying a Meteor app on a custom server. This guide article only say:

Node 4.6.2 for Meteor 1.4.x
Node 0.10.43 for Meteor 1.3.x and earlier

I’d love a canonical table, listing the recommended production Node version for each Meteor release :heart_eyes:

When you come to build your app, just run meteor node -v (and meteor npm -v).

I would recommend to include a section in the documentation of Galaxy that explains how to handle file uploads. It will help out developers coming from a typical MAMP environment.