Meteor in Production - Frontend Assets


#1

I’m tinkering with Meteor & building it for a custom deployment. I’ve read through the deployment section of the guide and I’m not seeing how or where my frontend assets are hosted. Initially, I thought that once everything was built with meteor build, a Node server would host the frontend assets as well as the backend api’s.

I’m running my Meteor app with Node from the build assets however all that is visible are my APIs. Are the fontend assets expected to be served up via a web server such as Nginx? If so, where did I miss these instructions in the Meteor guide?


#2

You might want to check out this section of the guide about the ‘public’ directory. Although it is a good idea to really limit the amount of files you have there as it will bloat the bundle. Large assets are better served from a separate external source.


#3

Ok, it turns out that my frontend stuff was being served up, however not on port 80 like I was expecting. It seems that a port is chosen when the app starts. First time it was 42137, then it was 37441. So if I hit my site at http://localhost:37441/, I see the front end.

Again, I’m not seeing anything in the docs explaining this. Do I have my app misconfigured or something?


#4

I was able to manually set the port using the PORT environment variable. I’ve triple checked the deployment section of the guide and there is no talk of this at all.


#5

The port is a fixed point in a meteor build. You can choose whatever port you like by setting the environment variable PORT when you start meteor. In a deployed bundled node app, you still set port exactly the same way.

If you want to run it on a port less than 1024 you will need root access to be able to use these ports. This is a Linux requirement and nothing to do with node or meteor.

As mentioned above, use a public folder if you want to serve up images or other asst files. These will be acceptable from the root url address. As stated don’t add lots of files or big files otherwise your meteor builds will take forever to rebuild.