Explain how to set/use `Accounts_AvatarStoreType`
When running through docker-compose, I can't upload an image as an avatar. I'm not sure how to ssh into the docker vm to see if that directory exists but happy to help debug. I do get a notification that the upload and image change was successful, however.
Changing the type to FileSystem works now. Could this be documented on why this works / maybe a dropdown menu to choose between options:
When running through docker-compose, I can't upload an image as an avatar. I'm not sure how to ssh into the docker vm to see if that directory exists but happy to help debug. I do get a notification that the upload and image change was successful, however.
So using the docker-compose setup out of the box i'd for sure not recommend using fileSystem storage at all.
If it actually works it'll be in the container. When you goto upgrade the rocket.chat container for a new version your files will be gone.
You need to add a volume in your docker-compose file and map a folder inside the container to outside.
Something like:
volumes:
- ./files:/var/www/uploads
As far as the types of storage used I agree these do need documented or a dropdown.
Got it. Is using GridFS what you would recommend? Does that route require any additional configuration?
I just want to echo that out of the box the GridFS setup for avatars and docker does not work for me either.
Running out-of-the box with docker-compose I don't see avatar changes with GridFS (default) or with FileSystem. Is there anything else you changed mhkeller?
after updating the latest neither are working for me either.
On Sun, Oct 11, 2015 at 5:51 PM, Andrew M. C. Dawes < [email protected]> wrote:
Running out-of-the box with docker-compose I don't see avatar changes with GridFS (default) or with FileSystem. Is there anything else you changed mhkeller?
— Reply to this email directly or view it on GitHub https://github.com/RocketChat/Rocket.Chat/issues/978#issuecomment-147249331 .
@mhkeller mhkeller.com
after updating the latest neither are working for me either.
Confirmed.
Upload appears to have worked, Rocket.Chat renders the balloon notification stating the avatar change was successful, and I can see the changed avatar. However, the change doesn't survive a page refresh, logout, nor a reboot of the server.
Before (I can see the avatar):
<div class="avatar-image" style="background-image:url(/avatar/admin.jpg?_dc=478);">
After (I cannot see the avatar image, only the initials):
<div class="avatar-image" style="background-image:url(/avatar/admin.jpg?_dc=0);">
Running default docker-compose out of the box, auto-starting on boot with init script.
EDIT: I tried adding the volume definition to docker-compose.yml. No joy.
rocketchat:
image: rocketchat/rocket.chat
environment:
- MONGO_URL=mongodb://mongodb/rocketchat
- ROOT_URL=https://chat.mydomain.com
links:
- mongodb
ports:
- 80:80
volumes:
- ./files:/var/www/rocket.chat/uploads/
We also noticed the exact same problem with avatars today. (using docker, too) Avatar settings in RocketChat are configured like this: Accounts_AvatarStorePath: /var/www/rocket.chat/uploads/avatar/ Accounts_AvatarStoreType: GridFS (we tried FileSystem also)
Then I mounted "/var/www/rocket.chat/uploads/avatar/" to the host system (also because this default path did not exist in the docker container) and checked the if the avatars are uploaded there (container and host). There were not.
I had to change the path that RocketChat uses, current I am mounting $PWD/avatarstore:/avatarstore and using /avatarstore inside rocketchat for the avatar storage path.
~~I saw a commit related to avatars yesterday (or was it two days ago), and launched a new instance of the docker Rocket Chat image, which seems to have fixed the issue for me.~~
~~Avatars are sticking now, and surviving reboots, logouts, etc.~~
Correction: I was mistaken. The problem persists under v0.7.1891. If I enable resizing, any operation with avatars causes a hard fault / crashes the server. Avatars are not surviving through to a new session.
That didn't fix it for me. Now when I upload an avatar the App crashes with this.
[methods] setAvatarFromService -> userId: P4FdQnrRgn7bt8FRm contentType: image/jpeg service: upload
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1011:11)
at Process.ChildProcess._handle.onexit (child_process.js:802:34)
EDIT: After setting the Storage Type to "FileSystem" also the error does not occur again but avatars are not persisted. :/
EDIT 2: I changed it back to GridFS and it seems to work again. Only the Desktop App does not pick up the new avatar.
EDIT 3: Some users still have issues adding avatars.
UPDATE / WORK-AROUND:
In the chat admin panel, click on Accounts. Find "Accounts_AvatarStorePath" and remove any path in the field. Save it as a blank field. Currently, rocketchat looks for any string in this field, and sets it as the avatar store path. Since we now know that the pre-populated path in that field is buggy due to permissions, by removing all content and saving it as empty field causes rocketchat to use by default ~/uploads path in the container, which does indeed have proper permissions.
@MuhClaren Thanks for investigating! :) I played around with that a bit (dev version, no docker) and see similar issues.
- AvatarResize causes the server to crash with boths store types
- with GridFS the avatars are at least persisted but not overwritable (see #1150)
- with FileSystem and a folder with correct permissions I can see the files are placed there but after a site refresh the avatar is not shown again (but laying around on the filesystem)
@Dbzman
I too had every single one of those problems, using the docker automated build image, which is basically bleeding edge code that is built into a docker image every time a repository commit is made.
After performing the steps I've illustrated above, every one of those problems are gone, including the crashing when avatar resize is on. The images display as they should now, and persist when changed by the user. I'm finishing up my guide and will have it published to the wiki in a few hours. I encourage anyone struggling with these issues to check it out.
Kind regards.
@MuhClaren
That's interesting. I even tried to empty the "Accounts_AvatarStorePath" you mentioned and had the 3 issues I described in the post above.
Some minutes ago I just tried it again with this configuration:
AvatarResize: true
AvatarStorePath:
AvatarStoreType: FileSystem
And now it seems to work correctly, so I can
- upload avatars without crashing the server
- see the current avatar on the filesystem
- see the current avatar even after a page refresh
I don't know why this works now (Maybe there were some broken caches?) but your workaround seems to be working perfectly! I'll try this on our docker environment on Monday to see if this can be fixed there as well. (probably using your guide) :)
Many thanks and best regards
@Dbzman Glad it's working for you!
Guide: https://github.com/RocketChat/Rocket.Chat/wiki/Docker-Ubuntu-14.04-%2864-bit%29-VPS-with-Nginx-SSL-and-Hubot
Has anyone been using the heroku deploy method and running into issues? I just spun one up and can't set custom avatars.
I just tried it again on our docker environment. (Using this docker image: "https://hub.docker.com/r/rocketchat/rocket.chat/") The problem is that $HOME is pointing to the none existing folder "/home/rocketchat" and I cannot find any folder which is accessible by the rocketchat user. (besides "/tmp/ufs" which also leads to crashes when I upload an avatar using this folder) If I mount a folder to the host system it is still owned by root:root. I think for now I'll fall back to GridFS and live with the issue that I cannot overwrite avatars.
EDIT: After playing around with FileSystem and GridFS I see crashes everytime. :(
EDIT 2: After re-creating the container the Avatars with GridFS work as before...
EDIT 3: Ok, GridFS is broken again. Avatars are not persisted anymore. At least not shown. When I open the image directly I can see my avatar but in the application it is still wrong. Clearing the caches also does not help. This only occurs on Safari. The app and Chrome work perfectly.
Check to make sure your root_url is set.
@mhkeller Do you see anything in the logs when you set an avatar?