Mupx: Run static website on same server?

Because Meteor takes some time to load, I would like to host a small landing page on the same server, using a standard HTTP server. The idea is that the Meteor server operates under the sub-domain app.mydomain.com, whereas the landing page serves the core domains www.mydomain.com and mydomain.com.

As I read in the mupx doc, mupx does not support serving static files (yet). So I am wondering if there is a way to configure the nginx server mupx uses so it can handle the domains as described above. I’m totally new to both mupx, nginx and Docker, so I am a bit lost in hyperspace.

Does anyone know a blob / tutorial / whatsoever explaining how to set-up such a scenario (if it is possible)? Thanks in advance.

I wouldn’t recommend modifying any of the core components that mupx relies on, since it could change how it works with these components at any point. Mupx is designed to be in full control of the docker container it creates. Also, mupx is being replaced shortly with a new version, so any time you spend on this could be wasted. That being said, getting a small static site setup on a server is really quite straight forward, and doesn’t need to be tied into your Meteor app (and its deployment process) in any way. Also - by keeping your main meteor app separate from your static site, you’ll make it easier to scale your app later on (since the scaling requirements for your Meteor app will be quite a bit different than your static site).

But … if you really want to keep everything together and are bothered by Meteor load times, have you considered creating 2 separate Meteor apps? One would be your main app with its larger dependency graph (and larger load times), but the other would be used as your “landing page” app, would be really small with a minimal amount of dependencies, and would have faster load times. You could manage both of these with mupx using its “Multiple Deployment Targets” capabilities.

So basically, you’d put two configs in /etc/nginx/sites-enabled. One for the Meteor app which would look something like this:

server {
  listen                80;

  server_name           app.mysite.com;

  access_log            /var/log/nginx/app.mysite.access.log;
  error_log             /var/log/nginx/app.mysite.error.log;

  location / {
    proxy_pass http://127.0.0.1:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Real-IP $remote_addr;
  }
}

Then you’d have a second nginx conf file where server_name is set to just mysite.com, and the location points to where your static files are.

1 Like

I recently did a bunch of research on this when I made my meteor alternative & found this to be the best blog (plus the guys are big meteor fans, too!) http://blog.percolatestudio.com/engineering/architecting-better-landing-pages/

Also highly recommend “Building Scalable Apps with Redis & Node” and “Deploying Node”. It helped me get through the initial WTF dev ops hurdle.

1 Like

The resources in this Quora answer should help: https://www.quora.com/Can-I-have-a-static-site-using-Jekyll-and-have-meteor-as-a-sub-domain

Thanks guys for your replies, will dig deeper into this tomorrow!

Did anyone one try using separate hosts for landing page and main meteor app? I am having the same issue as @waldgeist and doing research, but the difference is I am trying to use Amazon AWS S3 to host my landing page to use its CDN network and main app on Digital Ocean using Mupx.

I am reading the documentation but kind of getting overwhelmed at the first go, not being a dev ops and all. Did anyone try to use both AWS S3 and Digital Ocean? Any resources that you can point to? Is it a good set up to aim for or is it easier to run the two on the same host (Digital Ocean).

Thanks in advance