We have a webinar walking you through it, but you can also refer to the steps below:
The following instructions have been tested with Mastodon 4.0.2.
The things you need here are:
- A Storj bucket
- S3 compatible credentials (access key and secret key)
- Linksharing credentials for public access
Because of the linksharing credentials part, the easiest way to generate all of the things you need is through our uplink CLI.
After downloading and installing the (so that ls, mb, cp, etc work), you can use the following steps:
To make a bucket, you can choose the bucketname, like mastodon, and do
In subsequent steps it'll be referred to as BUCKET.
To generate S3 compatible credentials Access Key ID and Secret Key, run
Along with the credientials, the output will have the AWS endpoint you'll need to set which is https://gateway.storjshare.io.
Storj doesn’t have the same sort of concept of public buckets that S3 has. We support public access, but it’s able to be more fine-grained than at the bucket level. To generate LINKSHARINGKEY you can do
You’ll get a Browser URL, but the URL is not quite right. It will be of the form https://link.storjshare.io/s/LINKSHARINGKEY/BUCKET/. To make the content embeddable, swap the /s/ for /raw/. This url should be used as the AWS alias host or AWS url.
For Mastodon to use this url we'll need to set the S3_ALIAS_HOST setting (which seems to support path prefixes crammed in there as well). Note the lack of https:// and the lack of trailing slash below.
Once you have these things, you should be able to plop this configuration in to your Mastodon’s .env.production configuration and you should be all set.
If you’re doing the rake mastodon:setup wizard and Storj isn't listed, choosing Minio as your object storage provider and telling it you do want to access the uploaded files from your own domain should allow you to set the same settings in the setup wizard.
Of course, these instructions mean all your media will be served from link.storjshare.io, and maybe you don’t like that. You can always follow our instructions for sharing a bucket via DNS settings for your own domain name. If you do that, you’d replace S3_ALIAS_HOST with your domain name backed by Storj.