The Max Size of file uploads is set to 2MB by default. This is a PHP setting. To overcome this in the past, we have needed to build custom images and define our own configuration variables.
Talk has been ongoing for at least the past couple of years about how to handle this and similar cases. For instance, https://github.com/directus/docker/pull/30
Obviously, 2MB isn't going to work for many installations, so I would think now that api and app have been integrated and the Docker solution is more mature, we should address this. Not handling this defeats the value of having Docker images available.
As a workaround, if it's for kubernetes, we use this lifecycle
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "php-ini-add 'upload_max_filesize=20M' && php-ini-add 'post_max_size=20M'"]
We've been editing the images/apache/Dockerfile
Search for Port
And before that section, we paste in
#
#
RUN php-ini-add "memory_limit=512M" && \
php-ini-add "post_max_size=64M" && \
php-ini-add "upload_max_filesize=64M"
Then just rebuild, tag with ECR value, push to ECR, and redeploy.
I'm going to look into your suggestion. Thanks
hey guys how about https://github.com/directus/docker/issues/103#issuecomment-593375413 ?
And also https://github.com/directus/docker/pull/30#issuecomment-471780967
Does it make sense?
Haven't tried that approach but it should work.
btw We use the approach Nacho previously posted. It has worked flawlessly for over a month.
There is a way to change this on both docker-compose.yml and AWS/ECS without having to recreate the container.
Here is what one should do on docker-compose.yml:
directus:
image: directus/directus:v8.7.2-apache
entrypoint:
- "bash"
- "-c"
- "/usr/local/bin/directus-entrypoint pwd;php-ini-add 'post_max_size=32M';php-ini-add 'upload_max_filesize=32M';apache2-foreground"
And here is the equivalent syntax on ECS:
"entryPoint": [
"bash",
"-c",
"/usr/local/bin/directus-entrypoint pwd;php-ini-add 'post_max_size=32M';php-ini-add 'upload_max_filesize=32M';apache2-foreground"
],
Marc's answer worked for me.
Most helpful comment
There is a way to change this on both
docker-compose.ymlandAWS/ECSwithout having to recreate the container.Here is what one should do on
docker-compose.yml:And here is the equivalent syntax on ECS: