-
Notifications
You must be signed in to change notification settings - Fork 7
Add mirage init, update and register commands #876
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bbed327
Add mirage register command
badrogger 68d11d9
Add mirage init and update
badrogger e9ce63a
Add streamed cmd to mirage node update
badrogger b6e9f85
Merge branch 'add-mirage-register' into add-init-update
badrogger 7170907
Fix routes
badrogger 8c0aab3
Fix tests
badrogger 45927da
Remove mirage node wallet in favour of mirage wallet info
badrogger 965675b
Add wallet info support for mirage
badrogger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,11 +39,12 @@ | |
| from node_cli.migrations.mirage.from_boot import migrate_nftables_from_boot | ||
| from node_cli.mirage.record.chain_record import migrate_chain_record | ||
| from node_cli.operations.base import checked_host, turn_off | ||
| from node_cli.operations.common import unpack_backup_archive | ||
| from node_cli.operations.common import configure_filebeat, configure_flask, unpack_backup_archive | ||
| from node_cli.operations.config_repo import ( | ||
| sync_skale_node, | ||
| update_images, | ||
| ) | ||
| from node_cli.operations.volume import cleanup_volume_artifacts, prepare_block_device | ||
| from node_cli.utils.docker_utils import ( | ||
| REDIS_SERVICE_DICT, | ||
| REDIS_START_TIMEOUT, | ||
|
|
@@ -67,6 +68,81 @@ class MirageUpdateType(Enum): | |
| FROM_BOOT = 'from_boot' | ||
|
|
||
|
|
||
| @checked_host | ||
| def init(env_filepath: str, env: dict) -> bool: | ||
| sync_skale_node() | ||
| ensure_btrfs_kernel_module_autoloaded() | ||
| cleanup_volume_artifacts(env['DISK_MOUNTPOINT']) | ||
|
|
||
| if env.get('SKIP_DOCKER_CONFIG') != 'True': | ||
| configure_docker() | ||
|
|
||
| configure_nftables() | ||
| configure_filebeat() | ||
| configure_flask() | ||
| generate_nginx_config() | ||
|
|
||
| prepare_host(env_filepath, env_type=env['ENV_TYPE']) | ||
| link_env_file() | ||
|
|
||
| prepare_block_device(env['DISK_MOUNTPOINT'], force=env['ENFORCE_BTRFS'] == 'True') | ||
|
|
||
| meta_manager = MirageCliMetaManager() | ||
| meta_manager.update_meta( | ||
| VERSION, | ||
| env['CONTAINER_CONFIGS_STREAM'], | ||
| distro.id(), | ||
| distro.version(), | ||
| ) | ||
| update_images(env=env, node_type=NodeType.MIRAGE) | ||
| compose_up(env=env, node_type=NodeType.MIRAGE) | ||
| wait_for_container(REDIS_SERVICE_DICT['redis']) | ||
| time.sleep(REDIS_START_TIMEOUT) | ||
| return True | ||
|
|
||
|
|
||
| @checked_host | ||
| def update_mirage_boot(env_filepath: str, env: dict) -> bool: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. function is duplicated |
||
| compose_rm(node_type=NodeType.MIRAGE, env=env) | ||
| remove_dynamic_containers() | ||
| cleanup_volume_artifacts(env['DISK_MOUNTPOINT']) | ||
|
|
||
| sync_skale_node() | ||
| ensure_btrfs_kernel_module_autoloaded() | ||
|
|
||
| if env.get('SKIP_DOCKER_CONFIG') != 'True': | ||
| configure_docker() | ||
|
|
||
| enable_monitoring = str_to_bool(env.get('MONITORING_CONTAINERS', 'False')) | ||
| configure_nftables(enable_monitoring=enable_monitoring) | ||
|
|
||
| generate_nginx_config() | ||
| prepare_block_device(env['DISK_MOUNTPOINT'], force=env['ENFORCE_BTRFS'] == 'True') | ||
|
|
||
| prepare_host(env_filepath, env['ENV_TYPE']) | ||
|
|
||
| meta_manager = MirageCliMetaManager() | ||
| current_stream = meta_manager.get_meta_info().config_stream | ||
| skip_cleanup = env.get('SKIP_DOCKER_CLEANUP') == 'True' | ||
| if not skip_cleanup and current_stream != env['CONTAINER_CONFIGS_STREAM']: | ||
| logger.info( | ||
| 'Stream version was changed from %s to %s', | ||
| current_stream, | ||
| env['CONTAINER_CONFIGS_STREAM'], | ||
| ) | ||
| docker_cleanup() | ||
|
|
||
| meta_manager.update_meta( | ||
| VERSION, | ||
| env['CONTAINER_CONFIGS_STREAM'], | ||
| distro.id(), | ||
| distro.version(), | ||
| ) | ||
| update_images(env=env, node_type=NodeType.MIRAGE) | ||
| compose_up(env=env, node_type=NodeType.MIRAGE, is_mirage_boot=True) | ||
| return True | ||
|
|
||
|
|
||
| @checked_host | ||
| def update_mirage(env_filepath: str, env: dict, update_type: MirageUpdateType) -> bool: | ||
| compose_rm(node_type=NodeType.MIRAGE, env=env) | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this variable is useless for FAIR Node