Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Add ability to increase Max Size of file uploads without building custom image #2164

Open
Brian-Myers-Bose opened this issue Jan 29, 2020 · 7 comments
Assignees
Labels
docker Related to the Docker setup

Comments

@Brian-Myers-Bose
Copy link

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.

@WoLfulus WoLfulus self-assigned this Jan 29, 2020
@nachogarcia
Copy link

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'"]

@Brian-Myers-Bose
Copy link
Author

We've been editing the images/apache/Dockerfile

Search for Port

And before that section, we paste in

Add max upload file soze

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

@apiraino
Copy link
Contributor

apiraino commented Mar 2, 2020

@nachogarcia
Copy link

nachogarcia commented Mar 2, 2020

Haven't tried that approach but it should work.

@Brian-Myers-Bose
Copy link
Author

btw We use the approach Nacho previously posted. It has worked flawlessly for over a month.

@marcosdiez
Copy link

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"
      ],

@benhaynes benhaynes transferred this issue from another repository Nov 18, 2020
@benhaynes benhaynes added the docker Related to the Docker setup label Nov 18, 2020
@MichaelEPope
Copy link

Marc's answer worked for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docker Related to the Docker setup
Projects
None yet
Development

No branches or pull requests

7 participants