Add Storj DCS to cloud object storage options (#21929)

* Add Storj DCS to cloud object storage options

More explanation here: https://forum.storj.io/t/object-storage-provider-for-mastodon-instance/11464/37

* more help for which command to use
shrike
JT Olio 2023-01-18 09:47:49 -07:00 committed by GitHub
parent 3588fbc766
commit a5fd2fe1cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 1 deletions

View File

@ -142,7 +142,7 @@ namespace :mastodon do
prompt.say "\n" prompt.say "\n"
if prompt.yes?('Do you want to store uploaded files on the cloud?', default: false) if prompt.yes?('Do you want to store uploaded files on the cloud?', default: false)
case prompt.select('Provider', ['DigitalOcean Spaces', 'Amazon S3', 'Wasabi', 'Minio', 'Google Cloud Storage']) case prompt.select('Provider', ['DigitalOcean Spaces', 'Amazon S3', 'Wasabi', 'Minio', 'Google Cloud Storage', 'Storj DCS'])
when 'DigitalOcean Spaces' when 'DigitalOcean Spaces'
env['S3_ENABLED'] = 'true' env['S3_ENABLED'] = 'true'
env['S3_PROTOCOL'] = 'https' env['S3_PROTOCOL'] = 'https'
@ -257,6 +257,42 @@ namespace :mastodon do
q.required true q.required true
q.modify :strip q.modify :strip
end end
when 'Storj DCS'
env['S3_ENABLED'] = 'true'
env['S3_PROTOCOL'] = 'https'
env['S3_REGION'] = 'global'
env['S3_ENDPOINT'] = prompt.ask('Storj DCS endpoint URL:') do |q|
q.required true
q.default "https://gateway.storjshare.io"
q.modify :strip
end
env['S3_PROTOCOL'] = env['S3_ENDPOINT'].start_with?('https') ? 'https' : 'http'
env['S3_HOSTNAME'] = env['S3_ENDPOINT'].gsub(/\Ahttps?:\/\//, '')
env['S3_BUCKET'] = prompt.ask('Storj DCS bucket name:') do |q|
q.required true
q.default "files.#{env['LOCAL_DOMAIN']}"
q.modify :strip
end
env['AWS_ACCESS_KEY_ID'] = prompt.ask('Storj Gateway access key (uplink share --register --readonly=false --not-after=none sj://bucket):') do |q|
q.required true
q.modify :strip
end
env['AWS_SECRET_ACCESS_KEY'] = prompt.ask('Storj Gateway secret key:') do |q|
q.required true
q.modify :strip
end
linksharing_access_key = prompt.ask('Storj Linksharing access key (uplink share --register --public --readonly=true --disallow-lists --not-after=none sj://bucket):') do |q|
q.required true
q.modify :strip
end
env['S3_ALIAS_HOST'] = "link.storjshare.io/raw/#{linksharing_access_key}/#{env['S3_BUCKET']}"
when 'Google Cloud Storage' when 'Google Cloud Storage'
env['S3_ENABLED'] = 'true' env['S3_ENABLED'] = 'true'
env['S3_PROTOCOL'] = 'https' env['S3_PROTOCOL'] = 'https'