New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force Meteor not to watch file change for public/.uploads~ directory #9773

Closed
MartiniHenry1988 opened this Issue Mar 27, 2018 · 9 comments

Comments

Projects
None yet
4 participants
@MartiniHenry1988

MartiniHenry1988 commented Mar 27, 2018

I am trying to keep my uploads directory in public. But whenever I upload an image or pdf, it refresh the client, and the page reloads. How can I stop file change watcher for my public/.uploads~ driectory?

I have used the . & ~ with folder name as well, it still watch for file change. Is there any proper solution to this?

@axelvaindal

This comment has been minimized.

axelvaindal commented Mar 27, 2018

@MartiniHenry1988
I haven't been using this myself, but I guess you're looking for something like .meteorignore.

It was originally requested in this FR.
It has been supported since the v1.5.2.1 of Meteor (see this changelog).

Based on the way it has been implemented, I would say putting things like this inside this file (as in a .gitignore) would do the trick :

public/uploads
public/legacy
whateverfile.txt

Please, let me know if this is working for you.

@hwillson

This comment has been minimized.

Member

hwillson commented Mar 27, 2018

@MartiniHenry1988 Just to add, do you mean your application allows files to be uploaded into the /public directory? If so, this approach is not recommended as your /public directory is considered to be part of your application bundle. When you redeploy, you'll be blowing away that directory and replacing it with the contents of your new app bundle (which means application uploaded files will be removed). I would highly recommend finding another way to store uploaded files, either by storing them in a directory outside of your application, using a database, using a cloud hosted file storage solution (e.g. S3), etc.

@hwillson hwillson closed this Mar 27, 2018

@axelvaindal

This comment has been minimized.

axelvaindal commented Mar 27, 2018

@hwillson I've noticed there is a lack of documentation about .meteorignore in the docs and in the guide.
Perhaps some lines should be dropped inside both of these resources to make things more clear and prevent issues to be opened about this topic ? For instance, here ?

At least, should we open an issue in the Meteor docs repository to keep track of this ? 🙂

@hwillson

This comment has been minimized.

Member

hwillson commented Mar 27, 2018

At least, should we open an issue in the Meteor docs repository to keep track of this ?

Definitely yes! 🙂 Would you mind opening an issue in https://github.com/meteor/docs? Thanks!

@MartiniHenry1988

This comment has been minimized.

MartiniHenry1988 commented Mar 28, 2018

@hwillson Yes you are right, I should keep my uploads outside the Meteor App directory, but one question here, how do I access those files inside my application? For example, I want to provide a url of profile image to one of my ios application, what would be the best approach to achieve this?

@axelvaindal

This comment has been minimized.

axelvaindal commented Mar 28, 2018

@MartiniHenry1988 In order to avoid notifications and long discussion on the issue tracker on Github, I advise you to ask your question on the Meteor forums, you will likely find some help there, and I would be happy to help you as well in order to achieve whatever you're trying to do relating to your uploads on Meteor.
The Meteor Development Team (@hwillson included) uses this repository to track issue and may not have the time to answer everyone particular question about each external developers use case when it comes to solve external company design issue.

I'll pass by the forums today (Central European Time) and have a look if you post your question there 🙂

@felixb101

This comment has been minimized.

felixb101 commented Dec 4, 2018

Could not get the .meteorignore file to work at all. Is there something preventing it from working int he public/ directory?

@axelvaindal

This comment has been minimized.

axelvaindal commented Dec 4, 2018

Yes, I assume files in the public directory are available in the client without being parsed, which is why it doesn't work when you put the file inside it.
Leave the file on the root of your meteor project, and everything should work fine.

By the way, as I stated before, issue tracking is not the place to ask for help, as it would generate a lot of notifications for the meteor team, and they are pretty busy. You have already asked on the forum, and @coagmano just answered to you, this is the place you should be waiting for help 🙂

@felixb101

This comment has been minimized.

felixb101 commented Dec 6, 2018

Quick note to mention that my solution was to setup nginx on the same server with reverse proxy for meteor and a different setting location for the uploaded images. Works like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment