Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Docker environment settings: implement PHP_UPLOAD_LIMIT for Alpine images #15115

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

r-xyz
Copy link
Contributor

@r-xyz r-xyz commented Jul 18, 2024

Description

PHP_UPLOAD_LIMIT settings as Docker variable is not implemented in official Alpine Docker image .
Alpine version uses docker/entrypoint_alpine.sh instead of docker/startup.sh, but the relevant PHP fix is not ported to Alpine entrypoint.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested on a running instance, patching the /entrypoint.sh.

  • Reproduce the existing issue:
    • Setup a minimal setup using docker compose and snipe/snipe-it:latest-alpine image.
    • Add PHP_UPLOAD_LIMIT=100 as environment variable for snipeit service, in Docker compose file.
    • After setup, login and try to upload a file bigger than 8MB. --> upload will fail.
    • Inside the container, run:
      $grep  _max_.*size /etc/php81/php.ini
      post_max_size = 8M
      upload_max_filesize = 2M
  • Test fixed version:
    • Copy docker/entrypoint_alpine.sh from this PR and mount it as /entrypoint.sh inside the container. Check permissions to be 750.
    • Run docker compose down. && docker compose up -d && docker compose logs -f: no new warnings appear
    • Login and try to upload a file bigger than 8MB. --> upload will succeed.
    • Inside the container, run:
      $grep  _max_.*size /etc/php81/php.ini
      post_max_size = 100M
      upload_max_filesize = 100M

Test Configuration:

  • PHP version: Docker Alpine Image
  • MySQL version: Docker image
  • Webserver version: Docker Alpine Image
  • OS version: Docker Alpine Image

Checklist:

@r-xyz r-xyz requested a review from uberbrady as a code owner July 18, 2024 10:21
Copy link

welcome bot commented Jul 18, 2024

💖 Thanks for this pull request! 💖

We use semantic commit messages to streamline the release process and easily generate changelogs between versions. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix if it doesn't have one already.

Examples of commit messages with semantic prefixes:

  • Fixed #<issue number>: don't overwrite prevent_default if default wasn't prevented
  • Added #<issue number>: add checkout functionality to assets
  • Improved Asset Checkout: use new notification method for checkout

Things that will help get your PR across the finish line:

  • Document any user-facing changes you've made.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

Copy link

what-the-diff bot commented Jul 18, 2024

PR Summary

  • Enhancement of PHP Upload Settings
    The team added a code block that makes the upload limit in PHP more flexible. If there is an environment variable called PHP_UPLOAD_LIMIT, the software will now check for it and modify the PHP settings based on its value. This update enhances the user's ability to control data upload limits and makes the system more adaptable to different usage requirements.

@r-xyz r-xyz changed the title Implement PHP_UPLOAD_LIMIT for Alpine images Improved Docker environment settings: implement PHP_UPLOAD_LIMIT for Alpine images Jul 18, 2024
@snipe
Copy link
Owner

snipe commented Jul 18, 2024

Thanks!!

@snipe snipe merged commit 94e0739 into snipe:develop Jul 18, 2024
9 checks passed
Copy link

welcome bot commented Jul 18, 2024

Congrats on merging your first pull request! 🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants