test

After you have installed Gitlab and reconfigured it with a Mattermost URL as well, we can additionally save mattermost data to Digitalocean Spaces S3 storage.

To do this, we have to update a Mattermost config file on our gitlab server, then restart Mattermost. It’s pretty simple, so let’s get started.

Remember, our Spaces API keys are:

The public key is: QMDLKUYLQLIPOJEYMYF4

The private key is: SGRcKLuuWdv4UI3GY4E2kFvjc1NaTJgQnSMe/D8pLSc


First, log into your Gitlab server

ssh code@code.80pxtesting.com

Now edit the gitlab mattermost config file.

sudo nano /var/opt/gitlab/mattermost/config.json

We are going to edit the FileSettings section

"FileSettings": {
    "EnableFileAttachments": true,
    "EnableMobileUpload": true,
    "EnableMobileDownload": true,
    "MaxFileSize": 52428800,
    "DriverName": "amazons3",
    "Directory": "./data/",
    "EnablePublicLink": false,
    "PublicLinkSalt": "b7sdzgmh4nm7aq7z5texjufisj9ecykx",
    "InitialFont": "nunito-bold.ttf",
    "AmazonS3AccessKeyId": "",
    "AmazonS3SecretAccessKey": ">
    "AmazonS3Bucket": "",
    "AmazonS3PathPrefix": "",
    "AmazonS3Region": "",
    "AmazonS3Endpoint": "",
    "AmazonS3SSL": true,
    "AmazonS3SignV2": false,
    "AmazonS3SSE": false,
    "AmazonS3Trace": false
},

The key’s that we want to update are below

	"DriverName": "amazons3",
	"AmazonS3AccessKeyId": "QMDLKUYLQLIPOJEYMYF4",
    "AmazonS3SecretAccessKey": "SGRcKLuuWdv4UI3GY4E2kFvjc1NaTJgQnSMe/D8pLSc",
    "AmazonS3Bucket": "80pxtesting",
    "AmazonS3PathPrefix": "mattermost-media",
    "AmazonS3Region": "sfo3",
    "AmazonS3Endpoint": "sfo3.digitaloceanspaces.com",

Exit and save.

Before we restart Mattermost, let’s go to Digitalocean spaces and create that mattermost-media folder first.

new mm folder

Now let’s restart gitlab, and our Mattermost should be ready to use S3 for data storage!

sudo gitlab-ctl reconfigure


We can test this by going to our Mattermost chat at https://chat.80pxtesting.com, and uploading a file into one of the chat channels.

upload mm

Now we can see that image uploaded to a folder in our Digitalocean Space.

upload mm day

All files throughout the day get uploaded into a folder for that day. But, if we drill down, we can see the image. We can see Mattermost does some thumbnail resizing and saves those copies as well.

spaces upload

Now we have our Mattermost using Digitalocean spaces storage.