Skip to content

Conversation

JaZo
Copy link
Contributor

@JaZo JaZo commented Oct 18, 2024

Change

When you're using the cache based maintenance mode, Laravel still tries to create the framework/maintenance.php file. However, this file does nothing when there's no down-file, so basically it is useless. I moved the creation of this file to the file based implementation, so it's only created when relevant.

N.B. I deliberately left the deletion in the up command to make sure it is always deleted.

Context

We're running our apps in multiple read-only containers and thus need to use the cache based maintenance mode. This works fine, but we always get an error because Laravel tries to create this framework/maintenance.php file on a read-only filesystem.

@taylorotwell
Copy link
Member

This is the file that actually handles the request though, as you can see in the default public/index.php. So, if this file doesn't exist, all of the maintenance mode features like bypass, except URIs, etc. would be broken when using the cache driver.

@JaZo
Copy link
Contributor Author

JaZo commented Oct 21, 2024

That maintenance file does nothing when there's no down-file, which is the case when you're using the cache driver. Also, when running a multi server environment, only the server where the down command is ran, will have the maintenance file and the others don't. Isn't this use case the whole point of the cache driver?

We're currently using features like bypass etc. using the cache driver on a read-only filesystem, so the maintenance file isn't present, and it is working fine. Please reconsider. I'm happy to help with another solution!

@johanrosenson
Copy link
Contributor

I don't think that file is even required for the file based maintenance driver any longer.

Since the real checks are done in Middleware/PreventRequestsDuringMaintenance.php

So maybe your PR should be to remove it completely, not only for the cache based driver.

@donnysim
Copy link
Contributor

@johanrosenson that middleware is not reach unless the standalone maintenance file allows the request to proceed to the framework with a bypass etc. as the middleware is also responsible for setting the bypass cookie, double checking everything etc..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants