Content
Using S3 for storing attachments
Added by Alvaro Navas Peire over 8 years ago
Hi everyone,
I’m trying to set up an Openproject server for evaluation purposes and I’d like to be able to store all files and attachments in S3 in order to avoid filling up my VPS’ limited storage space, but I haven’t figured out yet how to do so.
I’m using the Docker installation method as explained in https://www.openproject.org/open-source/download/docker/ . Under Configuration it states that configuration must be done through environment variables. According to https://github.com/opf/openproject/blob/dev/doc/CONFIGURATION.md , if I understood correctly, I should change the variables under Attachments Storage to environment variables like so:
ATTACHMENTS_STORAGE=fog FOG_DIRECTORY=’my-bucket’ FOG_CREDENTIALS_PROVIDER=’AWS’ FOG_CREDENTIALS_AWS__ACCESS__KEY__ID='myKeyID' FOG_CREDENTIALS_AWS__SECRET__ACCESS__KEY__ID='mySecretKeyID' FOG_CREDENTIALS_REGION='region.goes.here'
but I can’t make it work. I’m trying different names for the variables but nothing yet. Am I understanding things correctly? What am I doing wrong?
Please excuse me if this is a stupid question; I’m new at Docker and OpenProject.
Thank you in advance for any help!
Replies (16)
Did you ever have any success with this? I am having the same problem.
If you’re overriding configuration values through ENV variables (apart from Rails SMTP settings), OpenProject requires you to prefix them with
OPENPROJECT_
I’ve added that to the config.rb documentation.
Best,
Oliver
Thank you Oliver! That did the trick. I was confused because the other entries weren’t prefixed with OPENPROJECT_ and didn’t realize I needed it.
Anyway. for anyone else that is stuck with this, here it is spelled out for you:
My install is via RPM on Centos 7 (Linode).
Edit: /etc/openproject/conf.d/other
Comment out this line:
Then I added the following lines right after it:
Then from the commandline
Thank you for your replies and the solution; we eventually switched to another solution, but this will come in handy for future reference.
Hi @ethan can you please tell me how you did this? And can you tell me what is your s3 bucket policy you have set?
Hi all (@ethan @oliver), i'm also facing a similar issue when trying to configure an external storage (DigitalOcean Spaces), in my docker-compose based setup.
This is what the relevant part of my docker-compose.yml file looks like:
Kindly advise, how to resolve this.
You need to specify the provider to AWS as that is what fog expects for S3 (or compatible APIs).
Please see https://github.com/fog/fog-digitalocean/issues/20#issuecomment-332009742 as an example for digitalocean.
Note that we officially support only the AWS flow of fog, so I'm not sure whether digitalocean is fully compatible.
Best
Oliver
@oliver Thanks for the link.
I tried it like this, in my docker-compose file:
This is still not working.
Error in browser console:
Any idea how to resolve this issue?
This is due to our content-security policy restricting available hosts to contact. It doesn't look like you can immediately fix this on your own, however I added a pull request for the next release to allow custom hosts to be set. You could apply this patch and build the OpenProject container manually with it applied:
https://github.com/opf/openproject/pull/9668
Best
Oliver
@oliver Thank you for your prompt assistance!
Would this PR also allow me to use DigitalOcean Spaces easily?
Also, any idea regarding the timeline for the release of v11.4?
Hi Dev,
as they claim to be S3 compatible, this should work and we'd be interested to support it. However please note we don't use DO ourselves so we have no option to test it.
The release of 11.4 is specified here and it's release date is scheduled for the 22nd of september.
Best
Oliver
Hi Oliver,
It does work in many other apps that i use.
I tried these environment settings in the docker-compose.yml
Still receiving this error:
The issue appears to be related to direct uploads (uploading files directly to S3 instead of OpenProject) which probably isn't supported by other hosts.
Please set
OPENPROJECT_DIRECT__UPLOADS=false
and try again.Meanwhile, https://github.com/opf/openproject/pull/9705 is going to disable this feature for non-s3 hosts
Best
Oliver
Thanks for this info. I can finally upload files.
I am still facing another issue though: I can't upload any document greater than size 1 MB.
And, i couldn't find any Environment Variable/Setting to change this either.
My current setting is:
So, it doesn't seem to make sense why i'm seeing this error:
You likely have a proxying server that restricts available upload size. The setting that you show is only for OpenProject internal validations and does not control any web server limits.
For nginx: https://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/
For Apache https://www.cyberciti.biz/faq/increase-file-upload-size-limit-in-php-apache-app/
Best
Oliver