Skip to content

Conversation

@weisd
Copy link
Contributor

@weisd weisd commented Oct 22, 2025

Pull Request: Refactor Console Server Architecture

Summary

This PR refactors the console server architecture by consolidating console-related functionality from the server module into the admin module, improving code organization and maintainability.

The console interface can be started independently, separate from the S3 API. #419

Port 9000 no longer serves the console; the console web server is now run on port 9001, use config

 /// Enable console server
    #[arg(long, default_value_t = rustfs_config::DEFAULT_CONSOLE_ENABLE, env = "RUSTFS_CONSOLE_ENABLE")]
    pub console_enable: bool,

    /// Console server bind address
    #[arg(long, default_value_t = rustfs_config::DEFAULT_CONSOLE_ADDRESS.to_string(), env = "RUSTFS_CONSOLE_ADDRESS")]
    pub console_address: String,

Changes Made

🔄 Architecture Refactoring

  • Moved console server logic from rustfs/src/server/console.rs to rustfs/src/admin/console.rs
  • Consolidated console functionality under the admin module for better organization
  • Updated module structure to reflect the new console server location

📁 File Changes

  • Deleted: rustfs/src/server/console.rs (410 lines removed)
  • Enhanced: rustfs/src/admin/console.rs (424 lines modified, +344 additions, -683 deletions)
  • Moved: console_test.rs from server/ to admin/ directory
  • Updated: Module imports and references across affected files

🛠 Code Improvements

  • Simplified main.rs: Removed complex console server startup logic, now uses unified HTTP server approach
  • Enhanced router.rs: Updated console path handling and routing logic
  • Improved http.rs: Better integration of console functionality with main HTTP server
  • Updated mod.rs: Removed console module from server, added test module to admin

🔧 Technical Details

  • Unified server approach: Console now runs on the same HTTP server as the main API when enabled
  • Better separation of concerns: Console functionality properly grouped under admin module
  • Maintained functionality: All existing console features preserved during refactoring
  • Improved maintainability: Cleaner code structure and reduced duplication

Impact

  • Code organization: Better separation between server infrastructure and admin functionality
  • Maintainability: Easier to locate and modify console-related code
  • Consistency: Aligns with the project's module organization principles
  • No breaking changes: All existing functionality preserved

Files Modified

  • rustfs/src/admin/console.rs - Enhanced with consolidated console logic
  • rustfs/src/admin/mod.rs - Added console test module
  • rustfs/src/admin/router.rs - Updated console routing
  • rustfs/src/main.rs - Simplified console server startup
  • rustfs/src/server/http.rs - Improved console integration
  • rustfs/src/server/mod.rs - Removed console module
  • rustfs/src/admin/console_test.rs - Moved from server directory

Testing

  • All existing tests updated to reflect new module structure
  • Console functionality verified to work as expected
  • No regressions introduced during refactoring

Type: Refactoring
Scope: Console Server Architecture
Breaking Changes: Port 9000 no longer serves the console; the console web server is now run on port 9001, use config
Dependencies: None

@weisd weisd requested review from Copilot and houseme October 22, 2025 15:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the console server architecture by consolidating console functionality from a separate standalone server into the main HTTP server infrastructure. The console now runs on the same HTTP server as the S3 API when enabled, simplifying the architecture and improving code organization.

Key Changes:

  • Removed the standalone console server implementation and integrated console functionality into the main HTTP server
  • Moved console-related code from server module to admin module for better organization
  • Updated main.rs to use a unified HTTP server approach, eliminating the need for separate console server startup logic

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
rustfs/src/server/console.rs Deleted - entire standalone console server implementation removed (410 lines)
rustfs/src/admin/console.rs Enhanced with consolidated console logic including middleware, routing, and utility functions moved from deleted server/console.rs
rustfs/src/server/mod.rs Removed console module exports and test module references
rustfs/src/server/http.rs Integrated console initialization and routing logic into main HTTP server, added conditional console path handling
rustfs/src/main.rs Simplified to use unified start_http_server approach for both S3 and console instead of separate console server
rustfs/src/admin/router.rs Updated to use consolidated console functions and moved CONSOLE_PREFIX constant to admin/console.rs
rustfs/src/admin/mod.rs Added console_test module reference
rustfs/src/admin/console_test.rs Updated import paths to reference admin::console instead of server::console

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@houseme houseme merged commit f30698e into main Oct 22, 2025
14 checks passed
@houseme houseme deleted the refactor/console-server branch October 22, 2025 16:06
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.

2 participants