Deploy Meteor on CDN or S3

Is there a way to get static assets created by a Meteor application deployed on a CDN or a static hosting solution like S3 to increase download speed and lower hosting costs?

+4
source share
3 answers

If deployed via demeteorizer , it is pretty easy to load the static_cacheable contents into a CDN and change the links in app.html and app.json .

This process can probably be automated in a custom deployment / capistrano script.

0
source

Cloudfront

I detailed how we did this at Edthena in this post . TL; DR:

Add this line somewhere in your server code:

 WebAppInternals.setBundledJsCssPrefix(CDN_URL); 

Where CDN_URL is your CloudFront URL (e.g. https://a27n0s89ik4xb3.cloudfront.net ).

We kept the default values ​​when creating the CloudFront distribution, except for the following:

 Origin Domain Name: myapp.example.com Origin ID: myapp.example.com Viewer Protocol Policy: HTTPS Only Compress Objects Automatically: yes 

If you serve your own fonts, you may get cross-origin errors (if you don't use the font data URL). Josh Owens describes how to handle this in his post .

Cloudflare

Check out Cloudflare meets Meteor on the meteorhacks blog. If you are a CloudFlare user, this is a fairly simple solution, but you need to disable WebSockets (either pay a lot or use a sophisticated workaround).

+1
source

If you are using a meteorite, you can use this package: https://github.com/nate-strauser/meteor-aws-sdk

0
source

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


All Articles