Closed bryanlimy closed 7 years ago
After reading Issue https://github.com/VeliovGroup/Meteor-Files/issues/72, I found that it has something to do with Docker.
I am using kadirahq/meteor-up, so I modified mup.js
, added volumes
module.exports = {
servers: {
one: {
host: 'myapp',
username: 'root',
// pem:
// password:
// or leave blank for authenticate from ssh-agent
}
},
meteor: {
name: 'myapp',
path: '../app',
volumes: {
'/videos':'/videos'
},
servers: {
one: {}
},
buildOptions: {
serverOnly: true,
},
env: {
ROOT_URL: 'http://myapp.com',
MONGO_URL: 'mongodb://localhost/meteor'
},
//dockerImage: 'kadirahq/meteord',
deployCheckWaitTime: 60
},
mongo: {
oplog: true,
port: 27017,
servers: {
one: {},
},
},
};
And my collections
Videos = new FilesCollection({
debug: false,
storagePath: '/videos',
permissions: 0774,
parentDirPermissions: 0774,
collectionName: 'Videos',
allowClientCode: true,
onBeforeUpload: function(file) {
if (Meteor.user()) {
if (file.size <= 2*1024*1024*1024 && /mp4/i.test(file.extension)) {
// limit size to 2GB and in mp4 format
return true
} else {
return "Please upload video in mp4 format and no larger than 200MB"
}
}
}
});
Now on server, the uploaded videos are being saved under /videos
Just FYI for anyone had the same problem
hi @bryanlimy it was very helpful , but after that can u tell me how i can access to my videos ? "path"
hi @reehamRaed, you can access your files just like how it was originally showed in the examples.
so in my case, I am storing videos.
so this is my template video.html
{{#if video}}
<div class="card">
<div class="card-content">
<div class="flex-container">
<div class="card-title">
{{video.name}}
</div>
</div>
<video controls>
<source src="{{video.link}}" type="{{video.type}}">
</video>
</div>
</div>
{{else}}
<h1>Video not found</h1>
{{/if}}
and this is my video.js
Template.Video.helpers({
video: function() {
return Videos.findOne(Router.current().params.videoId)
}
});
Hello @bryanlimy ,
Thank you for investigation. As this is frequent question - could you please send a PR to docs? This will be super helpful.
@dr-dimitru just did :) https://github.com/VeliovGroup/Meteor-Files/pull/306
Thank you @bryanlimy , published with minor changes: https://github.com/VeliovGroup/Meteor-Files/wiki/MeteorUp-(MUP)-Usage
Hi. I did the follwing config, however the images are not being stored.
After insert, the image try yo load but te following error is given:
5Ccankxy2kgug8APG.png:1 GET http://my-app.com/cdn/storage/Images/5Ccankxy2kgug8APG/original/5Ccankxy2kgug8APG.png 404 (Not Found)
mup.js file
module.exports = {
servers: {
one: {
host: '1.2.3.4',
username: 'root',
password: 'pass'
}
},
meteor: {
name: 'my-app',
path: '/home/user/my-app',
volumes: {
'/home/user/images': '/home/user/images'
},
servers: {
one: {}
},
buildOptions: {
serverOnly: true,
},
env: {
ROOT_URL: 'http://my-app.com',
MONGO_URL: 'mongodb://localhost/meteor'
},
//dockerImage: 'kadirahq/meteord'
dockerImage: 'abernix/meteord:base',
deployCheckWaitTime: 60
},
mongo: {
oplog: true,
port: 27017,
servers: {
one: {},
},
},
};
images.js file
import { FilesCollection } from 'meteor/ostrio:files';
export const Images = new FilesCollection({
debug: false,
storagePath: '/home/user/images',
permissions: 0774,
parentDirPermissions: 0774,
allowClientCode: true,
collectionName: 'Images',
onBeforeUpload: function onBeforeUpload(file) {
// Allow upload files under 10MB, and only in png/jpg/jpeg formats
if (file.size <= (1024 * 1024 * 10) && /png|jpg|jpeg/i.test(file.extension)) {
return true;
} else {
return 'Image must be <= 10MB';
}
},
});
Edit: The image is being properly inserted on mongo, however the file are not being stored into the storage path
{
"_id" : "9urSqoZKWds2Zw5kc",
"size" : 2567025,
"type" : "image/png",
"name" : "image-teste-1.png",
"meta" : {
},
"ext" : "png",
"extension" : "png",
"extensionWithDot" : ".png",
"mime" : "image/png",
"mime-type" : "image/png",
"userId" : "EDY2ZFD3rvTLQ8qg2",
"path" : "/home/user/images/9urSqoZKWds2Zw5kc.png",
"versions" : {
"original" : {
"path" : "/home/user/images/9urSqoZKWds2Zw5kc.png",
"size" : 2567025,
"type" : "image/png",
"extension" : "png"
}
},
"isVideo" : false,
"isAudio" : false,
"isImage" : true,
"isText" : false,
"isJSON" : false,
"isPDF" : false,
"_downloadRoute" : "/cdn/storage",
"_collectionName" : "Images",
"_storagePath" : "/home/user/images",
"public" : false
}
Sorry, but it's a little bit urgent, so I am really expecting a quick answer. Thank you very much!
Hey @bryanlimy ,
Could you please take a look on question by @marcuslma ?
Hi guys, any help please? :)
@marcuslma does /home/user/images
exist on your server?
if it does, if you go to /home/user/images
on your server, is the image there?
@bryanlimy yes, this directory exists, it's automatic created. No the images aren't there.
here is the log and there is something interesting, the image is being removed after upload, what????
[FilesCollection] [File Start Method] test-image.png - ccoKQcaQdevwLxhNv
[FilesCollection] [Upload] [Start Method] Got #-1/4 chunks, dst: test-image.png
[FilesCollection] [Upload] [DDP] Got #1/4 chunks, dst: test-image.png
[FilesCollection] [Upload] [DDP] Got #2/4 chunks, dst: test-image.png
[FilesCollection] [Upload] [DDP] Got #4/4 chunks, dst: test-image.png
[FilesCollection] [Upload] [DDP] Got #3/4 chunks, dst: test-image.png
[FilesCollection] [Upload] [DDP] Got #-1/4 chunks, dst: test-image.png
[FilesCollection] [Upload] [finish(ing)Upload] -> /home/user/images/ccoKQcaQdevwLxhNv.png
[FilesCollection] [Upload] [finish(ed)Upload] -> /home/user/images/ccoKQcaQdevwLxhNv.png
[FilesCollection] [_preCollectionCursor.observe] [removed]: ccoKQcaQdevwLxhNv
[FilesCollection] [_preCollectionCursor.observe] [removeUnfinishedUpload]: /home/user/images/ccoKQcaQdevwLxhNv.png
[FilesCollection] [download(/cdn/storage/Images/ccoKQcaQdevwLxhNv/original/ccoKQcaQdevwLxhNv.png, original)]
[FilesCollection] [download(/cdn/storage/Images/ccoKQcaQdevwLxhNv/original/ccoKQcaQdevwLxhNv.png)] [_404] File not found
@marcuslma that's weird. So the file got uploaded correctly and is being stored under /home/user/images
Can you share the code of how you do the upload and download?
@marcuslma check the permissions on storage directory, although library check if folder is writable and ensure proper permissions on init - something may went wrong.
Also have you updated to the latest release?
@bryanlimy the debug log looks ok, but about this line [FilesCollection] [_preCollectionCursor.observe] [removeUnfinishedUpload]: /home/user/images/ccoKQcaQdevwLxhNv.png
? Says it is removing uncompleted upload.
@dr-dimitru the version is 1.7.6, the storage directory is created automatic at mup deploy, and its owner is the root. What permissions is needed (chmod 0744 or chmod 0777)?
@bryanlimy I will upload the code soon is possible.
@marcuslma have you changed continueUploadTTL
? Could you post indexes from __pre_YourCollectionName
Mongo Collection? Use db.getCollection('__pre_YourCollectionName').getIndexes()
And one more thing - could you downgrade to previous release, to make sure it's not appeared in latest release.
@dr-dimitru I downgraded, like you said, and now the image has been uploaded properly. I will do more tests. However, this was the only thing I changed.
@marcuslma I'll be glad if you share your both Server and Client code, as well as what type of server and OS are you using, to help to investigate this issue.
@bryanlimy does latest release work well for you?
@dr-dimitru I will test it tmr and let you know
@dr-dimitru the OS is Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-53-generic x86_64)
.
This problem (with version 1.7.6) doesn't happens running local, only when publishing to production with meteor up.
Server code (main.js):
import { Meteor } from 'meteor/meteor';
import { Images } from '../imports/api/collections/images';
Meteor.startup(() => {
Meteor.publish('images.all', function () {
return Images.find({}).cursor;
});
});
Imports code (images.js):
import { FilesCollection } from 'meteor/ostrio:files';
export const Images = new FilesCollection({
debug: false,
storagePath: '/home/user/images',
permissions: 0774,
parentDirPermissions: 0774,
allowClientCode: true,
collectionName: 'Images',
onBeforeUpload: function onBeforeUpload(file) {
// Allow upload files under 10MB, and only in png/jpg/jpeg formats
if (file.size <= (1024 * 1024 * 10) && /png|jpg|jpeg/i.test(file.extension)) {
return true;
} else {
return 'Image must be <= 10MB';
}
},
});
Client code (JS):
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { sAlert } from 'meteor/juliancwirko:s-alert';
import { Images } from '../../../../../imports/api/collections/images';
import './blog-insert.html';
Template.blogInsertLayout.onCreated(function blogInsertLayoutOnCreated() {
this.currentUpload = new ReactiveVar(false);
});
Template.blogInsertLayout.onRendered(() => {});
Template.blogInsertLayout.helpers({
currentUpload() {
return Template.instance().currentUpload.get();
},
});
Template.blogInsertLayout.events({
'submit form#save_blog': (event, templateInstance) => {
event.preventDefault();
const image = event.target.image_blog.files[0];
const blog = {
title: event.target.title_blog.value.trim(),
description: event.target.description_blog.value.trim(),
status: event.target.status_blog.value,
createdAt: new Date(),
updatedAt: new Date(),
};
const callInsert = () => {
Meteor.call('blogs.insert', blog, (error, result) => {
if (error) {
sAlert.error(`Failed to publish: ${error.reason}`);
} else {
sAlert.success(`"${result.title}" was published.`);
return FlowRouter.go('/control-painel/blog/list');
}
});
};
const insertImage = () => {
const uploadInstance = Images.insert({
file: image,
streams: 'dynamic',
chunkSize: 'dynamic',
}, false);
uploadInstance.on('start', function () {
templateInstance.currentUpload.set(this);
});
uploadInstance.on('end', function (error, file) {
templateInstance.currentUpload.set(false);
if (error) {
sAlert.error(`Failed to load image: ${error.reason}`);
} else {
blog.imageId = file._id;
callInsert();
}
});
uploadInstance.start();
};
if (!image) {
sAlert.error('An image must be selected.');
} else if (!blog.title) {
sAlert.error('A title must be informed.');
} else if (!blog.description) {
sAlert.error('A description must be informed.');
}else {
insertImage();
}
},
});
Client code (HTML):
<template name="blogInsertLayout">
<h2><b>BLOG</b></h2>
<hr>
<div class="row">
<div class="col-sm-12">
<form id="save_blog" class="form-horizontal">
<div class="form-group">
<label for="title_blog" class="col-sm-2 control-label">Title</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="title_blog" name="title_blog">
</div>
</div>
<div class="form-group">
<label for="description_blog" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="description_blog" name="description_blog">
</div>
</div>
<div class="form-group">
<label for="status_blog" class="col-sm-2 control-label">Status</label>
<div class="col-sm-10">
<select class="form-control" id="status_blog" name="status_blog">
<option value="active" selected>Active</option>
<option value="inactive">Inactive</option>
</select>
</div>
</div>
<div class="form-group">
<label for="image_blog" class="col-sm-2 control-label">Image</label>
<div class="col-sm-10">
<input id="image_blog" name="image_blog" type="file">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
{{#with currentUpload}}
Uploading <b>{{file.name}}</b>: <span id="progress">{{progress.get}}%</span>
{{/with}}
<button type="submit" class="btn btn-primary pull-right">Publish</button>
</div>
</div>
</form>
</div>
</div>
</template>
Is anyone using mupx having this issue? I cant even get the dir created on deploy.. Should I delete the container and start new? Here are my logs from the container when I upload a file which is working but I can only get the files onto the container not outside of it...any help please 🙏
in the root directory of your application.
[FilesCollection.storagePath] Set to: /home/ubuntu/images
[FilesCollection] [find(undefined, undefined)]
[FilesCollection] [find(undefined, undefined)]
[FilesCollection] [find(undefined, undefined)]
[FilesCollection] [find(undefined, undefined)]
[FilesCollection] [find(undefined, undefined)]
[FilesCollection] [File Start Method] logo.png - 9Qo87SiqP9KZ5tsJv
[FilesCollection] [Upload] [Start Method] Got #-1/1 chunks, dst: logo.png
[FilesCollection] [Upload] [DDP] Got #1/1 chunks, dst: logo.png
[FilesCollection] [Upload] [DDP] Got #-1/1 chunks, dst: logo.png
[FilesCollection] [Upload] [finish(ing)Upload] -> /home/ubuntu/images/9Qo87SiqP9KZ5tsJv.png
[FilesCollection] [Upload] [finish(ed)Upload] -> /home/ubuntu/images/9Qo87SiqP9KZ5tsJv.png
[FilesCollection] [_preCollectionCursor.observeChanges] [removed]: 9Qo87SiqP9KZ5tsJv
[FilesCollection] [download(/cdn/storage/Images/9Qo87SiqP9KZ5tsJv/original/9Qo87SiqP9KZ5tsJv.png, original)]
[FilesCollection] [serve(/home/ubuntu/images/9Qo87SiqP9KZ5tsJv.png, original)] [200]
[FilesCollection] [download(/cdn/storage/Images/9Qo87SiqP9KZ5tsJv/original/9Qo87SiqP9KZ5tsJv.png, original)]
[FilesCollection] [serve(/home/ubuntu/images/9Qo87SiqP9KZ5tsJv.png, original)] [200]
[FilesCollection] [File Start Method] frog.jpeg - x4cHm9GRKesqwg295
[FilesCollection] [Upload] [Start Method] Got #-1/1 chunks, dst: frog.jpeg
[FilesCollection] [Upload] [DDP] Got #1/1 chunks, dst: frog.jpeg
[FilesCollection] [Upload] [DDP] Got #-1/1 chunks, dst: frog.jpeg
[FilesCollection] [Upload] [finish(ing)Upload] -> /home/ubuntu/images/x4cHm9GRKesqwg295.jpeg
[FilesCollection] [Upload] [finish(ed)Upload] -> /home/ubuntu/images/x4cHm9GRKesqwg295.jpeg
[FilesCollection] [_preCollectionCursor.observeChanges] [removed]: x4cHm9GRKesqwg295
[FilesCollection] [download(/cdn/storage/Images/x4cHm9GRKesqwg295/original/x4cHm9GRKesqwg295.jpeg, original)]
[FilesCollection] [serve(/home/ubuntu/images/x4cHm9GRKesqwg295.jpeg, original)] [200]
this.Images = new FilesCollection({
debug: true,
storagePath: '/home/ubuntu/images',
permissions: 0777,
parentDirPermissions: 0777,
collectionName: 'Images',
allowClientCode: false, // Disallow remove files from Client
onBeforeUpload: function(file) {
// Allow upload files under 10MB, and only in png/jpg/jpeg formats
if (file.size <= 1024*1024*10 && /png|jpg|jpeg/i.test(file.extension)) {
return true;
} else {
return 'Please upload image, with size equal or less than 10MB';
}
}
});
Hi @ivanthemeh
Is files exists at /home/ubuntu/images/
?
Line:
[FilesCollection.storagePath] Set to: /home/ubuntu/images
Tells us what directory created and writable
No, the folders are not even being created. IM using mupx and Im thinking this
"volumes": {
"/home/ubuntu/images":"/home/ubuntu/images"
},
isnt the right way to have the docker container create a dir, or maybe Im missing something or do I need to delete the container and start fresh with these changes for the new dir made?
Hi @dr-dimitru
I updated to v1.7.6
and deployed on a clean Ubuntu 16.04.1 LTS and also expericing the same probelm @marcuslma has
[FilesCollection.storagePath] Set to: /myapp/videos
[FilesCollection] [find(undefined, undefined)]
[FilesCollection] [find(undefined, undefined)]
[FilesCollection] [File Start Method] 2016_12_18_16_16_36-2.mp4 - eHgPwfLXssat6yyAc
[FilesCollection] [Upload] [Start Method] Got #-1/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #1/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #2/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #3/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #4/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #5/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #6/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #7/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #9/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #8/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #-1/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [finish(ing)Upload] -> /myapp/videos/eHgPwfLXssat6yyAc.mp4
[FilesCollection] [Upload] [finish(ed)Upload] -> /myapp/videos/eHgPwfLXssat6yyAc.mp4
[FilesCollection] [_preCollectionCursor.observe] [removed]: eHgPwfLXssat6yyAc
[FilesCollection] [_preCollectionCursor.observe] [removeUnfinishedUpload]: /tektube/videos/eHgPwfLXssat6yyAc.mp4
[FilesCollection] [download(/cdn/storage/Videos/eHgPwfLXssat6yyAc/original/eHgPwfLXssat6yyAc.mp4, original)]
[172.26.229.89][FilesCollection] [download(/cdn/storage/Videos/eHgPwfLXssat6yyAc/original/eHgPwfLXssat6yyAc.mp4)] [_404] File not found
And when I use v1.7.5
everything is fine.
@ivanthemeh I'm not experienced with MUP/X @bryanlimy could you take a look?
Hi @ivanthemeh, MUPX uses the old mup.json
, so I am not too sure where should we create the volumes. https://github.com/arunoda/meteor-up/issues/1057 seems like you have to create the volume in start.sh
?
EDIT: after reading this comment https://github.com/arunoda/meteor-up/issues/454#issuecomment-237013659, seems like for MUPX, you have to modify start.sh
in order to mount the volume. By any chance @ivanthemeh you can move to the newer/latest development version of MUP?
@bryanlimy weird... Development stage is fine?
@dr-dimitru yes development stage is fine
yes development stage is fine
Are you using MUP too? I'm running on Heroku (deploying via git, so there is no MUP/X) and everything is just fine.
Any thoughts? Remove unfinished uploads is part of #267, see changes here
Current logic is to add isFinished
property to _preCollection
after file is fully loaded, only after this we remove document form _preCollection
. At the same time _preCollection
has .observe
for removed
, if document has no isFinished
flag - it's removed by TTL and should be considered as unfinished upload, otherwise - it makes sure FS descriptor is closed and frees memory taken for upload.
So I assume isFinished
is not set for some reason... Any thoughts why?
@brianlimy working on testing that out now. Thanks for the info!
@dr-dimitru MUP is only used for deploying our site to a server, so in development state (localhost), MUP is not related. Everything on localhost seems fine
[FilesCollection] [File Start Method] 2016_12_18_16_16_36-2.mp4 - SJRc4pMB9TTfBdGnL
[FilesCollection] [Upload] [Start Method] Got #-1/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #1/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #2/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #3/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #4/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #5/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #6/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #7/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #9/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #8/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [DDP] Got #-1/9 chunks, dst: 2016_12_18_16_16_36-2.mp4
[FilesCollection] [Upload] [finish(ing)Upload] -> /myapp/videos/SJRc4pMB9TTfBdGnL.mp4
[FilesCollection] [Upload] [finish(ed)Upload] -> /myapp/videos/SJRc4pMB9TTfBdGnL.mp4
[FilesCollection] [_preCollectionCursor.observe] [removed]: SJRc4pMB9TTfBdGnL
[FilesCollection][download(/cdn/storage/Videos/SJRc4pMB9TTfBdGnL/original/SJRc4pMB9TTfBdGnL.mp4, original)]
[FilesCollection] [serve(/myapp/videos/SJRc4pMB9TTfBdGnL.mp4, original)] [206]
so somehow on product, isFinished
is not being set?
@bryanlimy @ivanthemeh What node version on production?
@dr-dimitru depends on which docker image we are using. For Meteor 1.4+, it is recommanded to use abernix/meteord/ which has node version 4.7.0.
@bryanlimy is there any chance to try v4.6.2 (which Meteor uses on dev)?
@dr-dimitru I can try, I am pretty new to these things I cannot promise anything 😂 Can we verify everything is working normally with v1.7.6 on a non-meteorup setup?
@dr-dimitru and @bryanlimy running locally, everything is working fine.
@dr-dimitru I just tried release 1.7.7, everything seems to work fine on deployment now
Hi, I did code the same as below, and it worked fine at local and default storagePath. https://github.com/VeliovGroup/Meteor-Files/wiki/React-Example
However, when I deployed to Ubuntu server with mup, the link of image was 404 (not found).
So, I changed to the config referring to the following Link, and the image was stored into the /images directory, but still the link of images was 404. https://github.com/VeliovGroup/Meteor-Files/wiki/MeteorUp-(MUP)-Usage
Could you please confirm my setting and give me an advice?
My setting
mup.js
meteor: {
name: 'meteor-app',
path: '../',
volumes: {
'/images':'/images'
},
FilesCollection storagePath
export const Images = new FilesCollection({
debug: true,
storagePath: '/images',
permissions: 0774,
parentDirPermissions: 0774,
collectionName: 'Images',
allowClientCode: false, // Disallow remove files from Client
onBeforeUpload: function (file) {
// Allow upload files under 10MB, and only in png/jpg/jpeg formats
if (file.size <= 1024*1024*10 && /png|jpg|jpeg/i.test(file.extension)) {
return true;
} else {
return 'Please upload image, with size equal or less than 10MB';
}
}
});
Command
Images.findOne({name: ‘image_name' }).link()
Problem https://my.domain.com/cdn/storage/Images/gLeqxxAB7gizSxkHD/original/gLeqxxAB7gizSxkHD.jpg is 404.
Environment
node v7.5.0 Meteor 1.4.2.6 ostrio:files@1.7.9 mup@1.2.3
Hello @moriken ,
Before changing/creating new storagePath, it has to be created on FS:
mkdir /image
# Use 777 only for tests purposes
chmod 777 /image
# Also ownership has to be properly set
# To user which is spawn node.js process
# chown user:group /image
Hi @dr-dimitru
Thank you for your reply. I did chmod 777 /image,and rebuild, but still it has a problem. An auto generated link↓ is error. https://drive.google.com/file/d/0B_hVyekr9EoObjVCMFl0MzJ3REE/view?usp=sharing
(The image files were stored into the /images directory, "e.g: /images/Wa2K4WwhNAxwg87w6.jpg" .)
@moriken if the files are stored into /images
correctly, then I don't think the problem has to do with MUP?
How are you publish and subscribe Images
?
@bryanlimy I uploaded the source code. https://github.com/moriken/Meteor-Files-Demos/blob/debug/demo-simplest-upload/lib/images.collection.js
I deployed it. http://150.95.128.226/
The image files were stored into the /images directory, but still download link has an error.
For test purposes try:
permissions: 0777,
parentDirPermissions: 0777,
then try (directory should have higher perms, as I remember):
permissions: 0774,
parentDirPermissions: 0775,
If issue will remain, turn on "debug mode" via debug: true
passed into FilesCollection constructor, and post all server logs to this thread
@moriken forgot to ask
So, I changed to the config referring to the following Link, and the image was stored into the /images directory, but still the link of images was 404.
Do you mean newly uploaded files after deploy returns 404
response code, or files which you uploaded on development?
Thank you for your response.
I tried change permission, but it doesn't work.
This is the server log.
=> Starting meteor app on port:80
[FilesCollection.storagePath] Set to: /images
[FilesCollection] [remove({})]
[FilesCollection] [unlink(qzM5j7q37TNBDEzQc, undefined)]
[FilesCollection] [find(undefined, undefined)]
[FilesCollection] [find(undefined, undefined)]
[FilesCollection] [find(undefined, undefined)]
[FilesCollection] [File Start Method] pnggrad8rgb.png - tYZRaZPGC2WyySxbS
[FilesCollection] [Upload] [DDP Start Method] Got #-1/1 chunks, dst: pnggrad8rgb.png
[FilesCollection] [Upload] [DDP] Got #1/1 chunks, dst: pnggrad8rgb.png
[FilesCollection] [Upload] [DDP] Got #-1/1 chunks, dst: pnggrad8rgb.png
[FilesCollection] [Upload] [finish(ing)Upload] -> /images/tYZRaZPGC2WyySxbS.png
[FilesCollection] [Upload] [finish(ed)Upload] -> /images/tYZRaZPGC2WyySxbS.png
[FilesCollection] [_preCollectionCursor.observe] [changed]: tYZRaZPGC2WyySxbS
[FilesCollection] [_preCollectionCursor.observe] [removed]: tYZRaZPGC2WyySxbS
Do you mean newly uploaded files after deploy returns 404 response code, or files which you uploaded on development?
I mean, the newly uploaded files. http://150.95.128.226/
Hi @moriken ,
Need more logs. Each file request should be logged too.
I have storagePath set to
/sitename/videos/
. When I am testing in localhost, the files does get stored under/sitename/videos
on my local machine. However, after I deployed usingmup deploy
, after I uploaded a video, I cannot see it under/sitename/videos
on the server.I also did
chown -R sitename:root /sitename
to set the ownerThis is my settings