Skip to content

feat: [#546] artisan command up and down to set website Maintenance mode#1198

Merged
hwbrzzl merged 35 commits intogoravel:masterfrom
praem90:feat-546-artisan-command-up-and-down
Mar 3, 2026
Merged

feat: [#546] artisan command up and down to set website Maintenance mode#1198
hwbrzzl merged 35 commits intogoravel:masterfrom
praem90:feat-546-artisan-command-up-and-down

Conversation

@praem90
Copy link
Contributor

@praem90 praem90 commented Sep 14, 2025

📑 Description

This PR adds two Artisan commands

  1. Up
  2. Down
go run . artisan down
go run . artisan up

The down commands creates a temporary file in the framework storage folder
The up commands removes that file if exists

There is an another middleware CheckForMaintenance, that checks for the file.
It returns the request with 503 status code if the file exists else allow the request to passthrough.

Closes goravel/goravel#546

✅ Checks

  • [ x ] Added test cases for my code

@praem90 praem90 requested a review from a team as a code owner September 14, 2025 15:52
@codecov
Copy link

codecov bot commented Sep 14, 2025

Codecov Report

❌ Patch coverage is 75.38462% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.84%. Comparing base (f028efa) to head (619619e).

Files with missing lines Patch % Lines
foundation/console/down_command.go 77.02% 10 Missing and 7 partials ⚠️
http/middleware/check_for_maintenance_mode.go 70.27% 7 Missing and 4 partials ⚠️
foundation/application.go 0.00% 2 Missing ⚠️
foundation/console/up_command.go 88.23% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1198      +/-   ##
==========================================
+ Coverage   68.80%   68.84%   +0.03%     
==========================================
  Files         287      290       +3     
  Lines       18118    18248     +130     
==========================================
+ Hits        12466    12562      +96     
- Misses       5115     5136      +21     
- Partials      537      550      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@almas-x
Copy link
Contributor

almas-x commented Sep 14, 2025

This is a fantastic PR with a very useful addition to the framework! 🎉

I have a suggestion: how about allowing an optional reason flag for the down command? This could record the reason or announcement for the maintenance, and store it in the framework/down file. The middleware could then read this reason and return it, making it available for APIsor views to display. This would enhance the user experience by providing more context during maintenance mode.

@hwbrzzl
Copy link
Contributor

hwbrzzl commented Sep 15, 2025

Please fix the windows CI.

@hwbrzzl
Copy link
Contributor

hwbrzzl commented Sep 15, 2025

Thanks, great job 👍 Could add some related screenshots in the PR description?

@praem90 praem90 force-pushed the feat-546-artisan-command-up-and-down branch from 3479a4b to b70c346 Compare September 18, 2025 08:16
@praem90 praem90 force-pushed the feat-546-artisan-command-up-and-down branch from e635bf5 to 07bc616 Compare January 4, 2026 15:58
@hwbrzzl hwbrzzl force-pushed the feat-546-artisan-command-up-and-down branch from a224b58 to 63f223a Compare January 11, 2026 13:42
@hwbrzzl
Copy link
Contributor

hwbrzzl commented Jan 13, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces up and down artisan commands to manage maintenance mode, along with a middleware to enforce it. The implementation is a good start, but there are several areas for improvement. My review focuses on enhancing error handling within the new commands to provide clearer feedback for scripting and automation, and on improving the test coverage for the new maintenance middleware to ensure all its features are working as expected. I've also identified a few issues in a test helper function that could lead to flaky tests.

Copy link
Contributor

@hwbrzzl hwbrzzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, great PR! Just left a few questions.

@praem90 praem90 force-pushed the feat-546-artisan-command-up-and-down branch from 80004df to 2be2fa0 Compare February 28, 2026 16:22
@praem90 praem90 force-pushed the feat-546-artisan-command-up-and-down branch from dbadd5e to 619619e Compare February 28, 2026 17:35
@praem90 praem90 requested review from almas-x and hwbrzzl February 28, 2026 17:40
@hwbrzzl
Copy link
Contributor

hwbrzzl commented Mar 1, 2026

@praem90 Thanks, checking

hwbrzzl

This comment was marked as duplicate.

hwbrzzl

This comment was marked as duplicate.

Copy link
Contributor

@hwbrzzl hwbrzzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, great job! I tested this feature locally, pretty good.

@hwbrzzl hwbrzzl merged commit f1e4fc4 into goravel:master Mar 3, 2026
23 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ [Feature] artisan command up and down to set website Maintenance mode

3 participants