Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pounced-on.me
mastodon
Commits
172eaeba
Commit
172eaeba
authored
5 years ago
by
Yamagishi Kazutoshi
Committed by
Eugen Rochko
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Add config of multipart threshold for S3 (#11924)
parent
637cc7bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.env.production.sample
+14
-0
.env.production.sample
config/initializers/paperclip.rb
+1
-0
config/initializers/paperclip.rb
lib/tasks/mastodon.rake
+29
-1
lib/tasks/mastodon.rake
with
44 additions
and
1 deletion
+44
-1
.env.production.sample
+
14
-
0
View file @
172eaeba
...
...
@@ -115,6 +115,20 @@ SMTP_FROM_ADDRESS=notifications@example.com
# S3_ENDPOINT=
# S3_SIGNATURE_VERSION=
# Google Cloud Storage (optional)
# Use S3 compatible API. Since GCS does not support Multipart Upload,
# increase the value of S3_MULTIPART_THRESHOLD to disable Multipart Upload.
# The attachment host must allow cross origin request - see the description
# above.
# S3_ENABLED=true
# AWS_ACCESS_KEY_ID=
# AWS_SECRET_ACCESS_KEY=
# S3_REGION=
# S3_PROTOCOL=https
# S3_HOSTNAME=storage.googleapis.com
# S3_ENDPOINT=https://storage.googleapis.com
# S3_MULTIPART_THRESHOLD=52428801 # 50.megabytes
# Swift (optional)
# The attachment host must allow cross origin request - see the description
# above.
...
...
This diff is collapsed.
Click to expand it.
config/initializers/paperclip.rb
+
1
-
0
View file @
172eaeba
...
...
@@ -25,6 +25,7 @@ if ENV['S3_ENABLED'] == 'true'
s3_protocol:
s3_protocol
,
s3_host_name:
s3_hostname
,
s3_headers:
{
'X-Amz-Multipart-Threshold'
=>
ENV
.
fetch
(
'S3_MULTIPART_THRESHOLD'
)
{
15
.
megabytes
},
'Cache-Control'
=>
'public, max-age=315576000, immutable'
,
},
s3_permissions:
ENV
.
fetch
(
'S3_PERMISSION'
)
{
'public-read'
},
...
...
This diff is collapsed.
Click to expand it.
lib/tasks/mastodon.rake
+
29
-
1
View file @
172eaeba
...
...
@@ -135,7 +135,7 @@ namespace :mastodon do
prompt
.
say
"
\n
"
if
prompt
.
yes?
(
'Do you want to store uploaded files on the cloud?'
,
default:
false
)
case
prompt
.
select
(
'Provider'
,
[
'Amazon S3'
,
'Wasabi'
,
'Minio'
])
case
prompt
.
select
(
'Provider'
,
[
'Amazon S3'
,
'Wasabi'
,
'Minio'
,
'Google Cloud Storage'
])
when
'Amazon S3'
env
[
'S3_ENABLED'
]
=
'true'
env
[
'S3_PROTOCOL'
]
=
'https'
...
...
@@ -217,6 +217,34 @@ namespace :mastodon do
q
.
required
true
q
.
modify
:strip
end
when
'Google Cloud Storage'
env
[
'S3_ENABLED'
]
=
'true'
env
[
'S3_PROTOCOL'
]
=
'https'
env
[
'S3_HOSTNAME'
]
=
'storage.googleapis.com'
env
[
'S3_ENDPOINT'
]
=
'https://storage.googleapis.com'
env
[
'S3_MULTIPART_THRESHOLD'
]
=
50
.
megabytes
env
[
'S3_BUCKET'
]
=
prompt
.
ask
(
'GCS bucket name:'
)
do
|
q
|
q
.
required
true
q
.
default
"files.
#{
env
[
'LOCAL_DOMAIN'
]
}
"
q
.
modify
:strip
end
env
[
'S3_REGION'
]
=
prompt
.
ask
(
'GCS region:'
)
do
|
q
|
q
.
required
true
q
.
default
'us-west1'
q
.
modify
:strip
end
env
[
'AWS_ACCESS_KEY_ID'
]
=
prompt
.
ask
(
'GCS access key:'
)
do
|
q
|
q
.
required
true
q
.
modify
:strip
end
env
[
'AWS_SECRET_ACCESS_KEY'
]
=
prompt
.
ask
(
'GCS secret key:'
)
do
|
q
|
q
.
required
true
q
.
modify
:strip
end
end
if
prompt
.
yes?
(
'Do you want to access the uploaded files from your own domain?'
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help