Wes Modes
Wes Modes

Reputation: 2136

Dynamically add images in deployed Meteor app

I have a deployed Meteor app that allows my admin users to upload images, audio, and video. I use meteor-uploads to upload the files, optimize the media, and place into public/images, public/video, etc.

However, though the media files are placed in the correct location, the app doesn't see them -- though it does see other files in public/images that were deployed.

root@doc# pwd
/home/secrethistory/bundle/programs/web.browser/app
root@doc# ls images/menuburger.png  images/add.png
images/add.png  images/menuburger.png

Apparently, in order to hot deploy these images, I need to register them with Meteor. How do I do that?

Upvotes: 1

Views: 144

Answers (1)

Wes Modes
Wes Modes

Reputation: 2136

This is not a new challenge, and I stumbled across a few workarounds.

Apparently, Meteor will not let you add assets on the fly since they have to be in meteor's manifest for it to serve them.

The most straightforward solution is to serve your "public" files separately. With nginx, for instance, in /etc/nginx/sites-enabled/yourwebsite we configure node to serve media files outside of meteor.

location /audio/ {
    root /home/secrethistory/bundle/programs/web.browser/app;
}
location /video/ {
    root /home/secrethistory/bundle/programs/web.browser/app;
}
location /images/ {
    root /home/secrethistory/bundle/programs/web.browser/app;
}

Upvotes: 1

Related Questions