-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
Use AUTRORUN_LARAVEL_OPTIMIZE
to run Laravel's artisan optimize
command.
#511
base: release/v3.6
Are you sure you want to change the base?
Use AUTRORUN_LARAVEL_OPTIMIZE
to run Laravel's artisan optimize
command.
#511
Conversation
Huh, found out The optimize function has a new argument that'll be useful here from. v11.38. You can use Caveat here is using older versions of Laravel, they wouldn't support this. |
I think this might be ready for review / discussion now. I've added this into the script so that the I will mention, I'm not too well-versed in I'd say a future development of this could be that the optimization skips can be specified by a single environment variable, such as |
Thanks! I will take a peek once I get a moment. The challenging part is we cannot use Bash (/bin/bash), we must use Shell (/bin/sh) 🙃 I'll review and see what we have going on. I want to make sure the user experience is great for existing users (especally ones before Laravel 11) and the upgrade is seamless. I'll keep you posted! |
Made a few changes to make sure it has better compatibility with Shell (it does use POSIX right?), and with the script getting a bit bigger from adding the extra logic I decided to refactor the artisan calls into their own functions. I can reverse the refactoring if preferred. |
Co-authored-by: Paul <[email protected]>
Thanks! Yes, it should be /bin/sh and POSIX compliant. I'll review sometime (likely next week) as this week has been a busy client week. I greatly appreciate you tackling this! I also just approved the workflow, so hopefully it will build some preliminary images to test with on DockerHub |
docs/content/docs/7.reference/1.environment-variable-specification.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Erik Gaal <[email protected]>
Co-authored-by: Erik Gaal <[email protected]>
Co-authored-by: Erik Gaal <[email protected]>
- Update entrypoint script to use subshell for script execution - Enhance logging and error reporting for initialization scripts - Remove "Don't use exit 0" section from documentation - Modify exit handling in initialization scripts to preserve environment
Clarify shell script compatibility requirements for different Linux distributions and operating systems, specifying separate guidelines for /bin/sh and /bin/bash scripts
- Improve welcome message layout and readability - Add memory and upload limit information - Include Docker CMD in runtime section - Replace `return 0` with `exit 0` for script termination - Update links and formatting for better user experience
- Add DOCKER_CMD environment variable to capture the original Docker command - Enable easier access to the original command in subsequent initialization scripts
- Add `AUTORUN_DEBUG` environment variable for detailed Laravel automation logging - Implement comprehensive Laravel version detection and compatibility checks - Improve optimization and migration scripts with granular control - Update documentation to reflect new automation features
@aSeriousDeveloper: Thank you SO MUCH for this PR. It wasn't until I saw your PR is when I realized how UGLY my Laravel automations script has become. I took what you had and added a lot more flexibility, sanity checks, modularity, etc. I feel pretty good where this is at so far in my firsts tests, but I have some things to double check before I merge this into 3.6. Feel free to take a look at what I have going so far and let me know your thoughts. |
The automation script really did receieve an overhaul 😸 EDIT: whoops, forgot that it would reset the test suite :z apologies |
As discussed in #510 .
This draft PR will allow for an additional, optional environment variable that will run
php artisan optimize
instead of the usual separate cache commands.The purpose of this is that other dependencies hook into this command which cannot be easily accounted for in the autorun. However, the fact that the individual cache functions can be configured to be enabled or disabled means we can't simply switch to
optimize
.Instead, we can check if the new environment variable
AUTRORUN_LARAVEL_OPTIMIZE
is set to true. If it is, we simply runartisan optimize
. If the variable is not set (or is set to false), then call thecache_laravel
function, which performs the same logic as always.By default,
AUTRORUN_LARAVEL_OPTIMIZE
will be resolved to false if not specified, so the original & default configuration for the Dockerfile will be preserved.