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

Feature Idea: Maintenance On/Off via craft cli #14

Open
sergeifilippov opened this issue Oct 27, 2018 · 6 comments
Open

Feature Idea: Maintenance On/Off via craft cli #14

sergeifilippov opened this issue Oct 27, 2018 · 6 comments

Comments

@sergeifilippov
Copy link

I use automated deployments that run tasks via cli before deploying an atomic release of a given craft build.

Would be great if you can put the site into maintenance via cli. Like this:

./craft patrol/maintenance-mode/enable
./craft patrol/maintenance-mode/disable

Thank you for making this plugin. 👍🏻

@selvinortiz
Copy link
Contributor

@sergeifilippov I'm currently working on this and came across a bit of a dilemma. Because Patrol supports turning maintenance mode on/off via the CP (stored in db) or the config file (config/patrol.php), I'm not sure what the best way implement this would be.

File configs take precedence over CP settings.

I suppose enabling/disabling maintenance mode through the command line could update the settings in the db and somehow signal that it should take priority over file configs.

Another option might be to write to the .env file but is not as cross-platform.

Finally, if this change was for deployments only, we could create a simple text file on enable and delete it on disable.

Lot's of ideas, just need to clear my thoughts and figure out what I'm not thinking of. There may be a much simpler solution here.

I'd love your thoughts on this?

@sergeifilippov
Copy link
Author

Hmm to make things even more interesting there is a 3rd possible option.

Get the module to check for an existence of a .maintenance file in the project root. If it exists, site is in maintenance.

Then the cli command is just checking/adding/removing an empty file vs hitting a database on each request.

Just an idea.

@selvinortiz
Copy link
Contributor

@sergeifilippov I like the idea of the .maintenance file check because I think it could work well as an advanced feature for CI stuff without changing the behavior of config checks significantly.

@adamskyle
Copy link

I think @sergeifilippov is spot on when it comes to this feature. That is how the php artisan down / php artisan up commands work in the Laravel framework. I think it just checks for a down file in the storage directory.

@sergeifilippov
Copy link
Author

@sergeifilippov Bump 👍

@engram-design
Copy link
Member

Good thinking with the .maintenance file, as this is especially more of an issue these days modifying plugin settings with project config, and that getting out of sync.

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

No branches or pull requests

4 participants