Hello,
I have a mattermost team instance that is configured to use the default file system location to store attachments. The server has been in use, and there are files in the data directory? How would I move the existing files to S3?
Hello,
I have a mattermost team instance that is configured to use the default file system location to store attachments. The server has been in use, and there are files in the data directory? How would I move the existing files to S3?
Would also be interested in a solution.
As long as you keep the folder structure of the data folder the same as the structure of the S3 bucket (for example, data/teams/12345
becomes teams/12345
in the S3 bucket), you should be able to just switch your Mattermost instance to use S3 for file storage without problems. If you use the AWS Command Line Interface, there’s an aws s3 sync
command that should be able to copy everything over for you
It really is this simple! I quickly set up Mattermost with local storage to escape from Slack. It’s been wonderful! I wanted to start uploading more files but I was concerned about space. S3 is the obvious solution. I migrated painlessly.
Here are some notes from my migration…
AWS IAM policy:
[from https://www.aaflalo.me/2017/07/aws-s3-right-policy-set/]
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetBucketLocation" ], "Resource": [ "arn:aws:s3:::BUCKET_NAME" ] }, { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject" ], "Resource": [ "arn:aws:s3:::BUCKET_NAME/*" ] } ] }
$ aws s3 sync /opt/mattermost/data/ s3://BUCKET_NAME
System Console -> Environment -> File Storage
After configuring for S3, you have to save the configuration before testing it.
Changes seemed to take effect immediately after testing. (I uploaded a photo and it saved in S3.) I did restart the server to ensure it was still working properly, though,
systemctl restart mattermost
Thanks, All!