mastodon / mastodon

Your self-hosted, globally interconnected microblogging community
https://joinmastodon.org
GNU Affero General Public License v3.0
46.38k stars 6.8k forks source link

Support Alibaba OSS #5619

Open didi7 opened 6 years ago

didi7 commented 6 years ago

Alibaba Cloud Object Storage Service (OSS) is an easy-to-use service that enables you to store, backup and archive large amounts of data on the cloud. OSS acts as an encrypted central repository from where files can be securely accessed from around the globe. Just like Amazon S3.

Alibaba OSS is widely used in China and other country. As we know, Amazon S3 Service has poor experience in China. OSS API is similar to S3, while not all the same. I suggest to add OSS support, to make mastodon more friendly for Chinese users.

Besides, Some cloud storage service in China support image service. For example, the Alibaba Cloud OSS Image Service (IMG) can securely and reliably process a massive numbers of images in a cost-effective manner. Uploading and storing source images on OSS allows you to process images anywhere, anytime, and on any connected device through a simple RESTful interface.

The Image Service offers the following functions:

Mastodon now resize the image in our server, while Alibaba OSS supports resize the image in their server, if mastodon support OSS, users can upload their attachment directly to OSS server. That may reduce the load of the server.

Forgive my poor English, I hope you can understand my meaning.

OSS API: https://www.alibabacloud.com/help/doc-detail/31947.htm?spm=a3c0i.o31948en.b99.277.521aea7dq2Opih

ykzts commented 6 years ago

Mastodon uses Fog to upload media. Fog is a Ruby library that abstracts various cloud services.

Since Fog is compatible with Aliyun (Alibaba Cloud), I think it is easy to add OSS correspondence to Mastodon (889ada5...761acfc). But I do not know Aliyun. I have never used it. Even if it can be implemented, it can not be confirmed.

Looking at my code, I pray that you can be helped.

didi7 commented 6 years ago

@ykzts I add my OSS info in .env.production file, and build new codes successfully, but there is something wrong, attachments can not upload to Aliyun. image