You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-10-31 18:30:33 +03:00
Implements the initial upgrade capability across CMAPI and the CLI, including
repository setup, package operations, environment prechecks, and coordinated
cluster steps with progress reporting.
Details:
- CMAPI upgrade manager:
- Add `cmapi/cmapi_server/managers/upgrade/` modules:
- `repo.py`, `packages.py`, `preinstall.py`, `upgrade.py`, `utils.py` and `__init__.py`
- Extend endpoints and routing to expose upgrade operations and status:
- `cmapi_server/controllers/{endpoints.py, dispatcher.py, api_clients.py}`
- `cmapi_server/managers/{application.py, process.py}`
- Add improved constants and helpers for upgrade flow
- Backup/restore and safety:
- Add `cmapi_server/managers/backup_restore.py`
- Fix pre-upgrade backup regressions (due to `mcs_backup_manager.sh 3.17 changes`)
- Improve cluster version validation; add `ignore_missmatch` override
- CLI enhancements:
- Progress UI and richer feedback (`mcs_cluster_tool/tools_commands.py`, `README.md`, `mcs.1`)
- Add steps to start MDB and start MCS during/after upgrade
- Improved error surfacing for version validation
- Platform and packaging:
- Ubuntu and Rocky Linux support
- RHEL/DNF dry-run support
- Distro detection and platform-dependent logic hardened
- Logging improvements
- Updater service:
- Add `cmapi/updater/cmapi_updater.service.template` and `cmapi_updater.sh` to make CMAPI update itself
- Docs:
- Update mcs cli README and mcs.1 man file
- Add `cmapi/updater/README.md`
99 lines
3.0 KiB
Python
99 lines
3.0 KiB
Python
import logging
|
|
import subprocess
|
|
import sys
|
|
|
|
import typer
|
|
|
|
from cmapi_server.logging_management import dict_config, add_logging_level, enable_console_logging
|
|
from mcs_cluster_tool import (
|
|
cluster_app, cmapi_app, backup_commands, restore_commands, tools_commands
|
|
)
|
|
from mcs_cluster_tool.constants import MCS_CLI_LOG_CONF_PATH
|
|
|
|
|
|
# don't show --install-completion and --show-completion options in help message
|
|
app = typer.Typer(
|
|
add_completion=False,
|
|
help=(
|
|
'The MCS Command Line Interface is a unified tool to manage your '
|
|
'MCS services'
|
|
),
|
|
rich_markup_mode='rich',
|
|
)
|
|
app.add_typer(cluster_app.app)
|
|
# keep this only for potential backward compatibility and userfriendliness
|
|
app.add_typer(cluster_app.app, name='cluster', hidden=True)
|
|
app.add_typer(cmapi_app.app, name='cmapi')
|
|
app.command(
|
|
'backup', rich_help_panel='Tools commands'
|
|
)(backup_commands.backup)
|
|
app.command(
|
|
'dbrm_backup', rich_help_panel='Tools commands'
|
|
)(backup_commands.dbrm_backup)
|
|
app.command(
|
|
'restore', rich_help_panel='Tools commands'
|
|
)(restore_commands.restore)
|
|
app.command(
|
|
'dbrm_restore', rich_help_panel='Tools commands'
|
|
)(restore_commands.dbrm_restore)
|
|
app.command(
|
|
'cskeys', rich_help_panel='Tools commands',
|
|
short_help=(
|
|
'Generate a random AES encryption key and init vector and write '
|
|
'them to disk.'
|
|
)
|
|
)(tools_commands.cskeys)
|
|
app.command(
|
|
'cspasswd', rich_help_panel='Tools commands',
|
|
short_help='Encrypt a Columnstore plaintext password.'
|
|
)(tools_commands.cspasswd)
|
|
app.command(
|
|
'bootstrap-single-node', rich_help_panel='Tools commands',
|
|
)(tools_commands.bootstrap_single_node)
|
|
app.command(
|
|
'review', rich_help_panel='Tools commands',
|
|
short_help=(
|
|
'Provides useful functions to review and troubleshoot the MCS cluster.'
|
|
)
|
|
)(tools_commands.review)
|
|
app.add_typer(
|
|
tools_commands.sentry_app, name='sentry', rich_help_panel='Tools commands', hidden=True
|
|
)
|
|
app.command(
|
|
'install_es', rich_help_panel='Tools commands',
|
|
)(tools_commands.install_es)
|
|
|
|
|
|
@app.command(
|
|
name='help-all', help='Show help for all commands in man page style.',
|
|
add_help_option=False
|
|
)
|
|
def help_all():
|
|
# Open the man page in interactive mode
|
|
subprocess.run(['man', 'mcs'])
|
|
|
|
|
|
@app.callback()
|
|
def main(verbose: bool = typer.Option(False, '--verbose', '-v', help='Enable verbose logging to console')):
|
|
'''Add a -v option and setup logging in every subcommand'''
|
|
setup_logging(verbose)
|
|
|
|
|
|
def setup_logging(verbose: bool = False) -> None:
|
|
add_logging_level('TRACE', 5)
|
|
dict_config(MCS_CLI_LOG_CONF_PATH)
|
|
if verbose:
|
|
for logger_name in ("", "mcs_cli"):
|
|
current_logger = logging.getLogger(logger_name)
|
|
current_logger.setLevel(logging.DEBUG)
|
|
enable_console_logging(current_logger)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
logger = logging.getLogger('mcs_cli')
|
|
# add separator between cli commands logging
|
|
logger.debug(f'{"-":-^80}')
|
|
cl_args_line = ' '.join(sys.argv[1:])
|
|
logger.debug(f'Called "mcs {cl_args_line}"')
|
|
app(prog_name='mcs')
|