mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-11-28 04:46:50 -08:00
Merge pull request #1293 from element-hq/gaelg/press-enter-to-continue
Press enter to continue
This commit is contained in:
3 files changed
+30
-30
No files matched your search
@@ -0,0 +1 @@
|
||||
Change artifical delays in logs to "press enter to continue" interaction.
|
||||
@@ -20,7 +20,7 @@ from .mas import MAS_STRATEGY_NAME, parse_postgres_uri
|
||||
from .models import MigrationError
|
||||
from .outputs import generate_helm_values, write_outputs
|
||||
from .synapse import SYNAPSE_STRATEGY_NAME
|
||||
from .utils import delay_next_steps, prompt_for_database_choice
|
||||
from .utils import press_enter_to_continue, prompt_for_database_choice
|
||||
|
||||
LOADING_STEP = "Loading and validating input files"
|
||||
MIGRATING_STEP = "Migrating configuration to ESS values"
|
||||
@@ -60,7 +60,7 @@ class ProgressReporter:
|
||||
self.current_step += 1
|
||||
progress = self.current_step / len(self.all_steps) * 100
|
||||
self.pretty_logger.info(f"📦 Step {self.current_step}/{len(self.all_steps)} ({progress:.0f}%): {step_name}")
|
||||
delay_next_steps(self.pretty_logger)
|
||||
press_enter_to_continue(self.pretty_logger)
|
||||
|
||||
def report_success(self, output_dir: str):
|
||||
"""Report successful completion."""
|
||||
@@ -281,7 +281,7 @@ Examples:
|
||||
)
|
||||
|
||||
# Display migration summary
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
pretty_logger.info("\n📊 MIGRATION SUMMARY")
|
||||
pretty_logger.info("=" * 60)
|
||||
|
||||
@@ -308,7 +308,7 @@ Examples:
|
||||
pretty_logger.info("✅ SUCCESSFULLY MIGRATED TO ESS:")
|
||||
for source_path, (source_file, target_path) in sorted(migration_mapping.items()):
|
||||
pretty_logger.info(f" • {source_file}: {source_path} → {target_path}")
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
if engine.ess_config["synapse"].get("workers"):
|
||||
pretty_logger.info("📝 Discovered and enabled the following Synapse workers")
|
||||
@@ -319,7 +319,7 @@ Examples:
|
||||
else:
|
||||
pretty_logger.info(" ✅ No workers found, using a single main Synapse process")
|
||||
if engine.discovered_secrets:
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
pretty_logger.info("🔐 MIGRATED SECRETS:")
|
||||
for discovered_secret in engine.discovered_secrets:
|
||||
pretty_logger.info(
|
||||
@@ -328,7 +328,7 @@ Examples:
|
||||
)
|
||||
|
||||
if engine.init_by_ess_secrets:
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
pretty_logger.info("\n⚠️ ESS-INITIALIZED SECRETS:")
|
||||
pretty_logger.info("The following Synapse secrets will be auto-generated by ESS:")
|
||||
for secret in engine.init_by_ess_secrets:
|
||||
@@ -336,47 +336,47 @@ Examples:
|
||||
pretty_logger.info(
|
||||
"These secrets are not required for migration but will be created automatically during deployment."
|
||||
)
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
# Show override warnings within the migration summary
|
||||
if engine.override_warnings:
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
pretty_logger.info("\n⚠️ ESS-MANAGED OVERRIDES FOUND:")
|
||||
pretty_logger.info(" These settings are managed by ESS and your values may be ignored:")
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
for warning in engine.override_warnings:
|
||||
pretty_logger.info(f" • {warning}")
|
||||
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
pretty_logger.info("❗ ACTION REQUIRED:")
|
||||
pretty_logger.info(" Remove these settings from your additional configuration to avoid conflicts.")
|
||||
pretty_logger.info(" They are now automatically managed by the ESS Helm chart.")
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
# Show underride warnings within the migration summary
|
||||
if engine.underride_warnings:
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
pretty_logger.info("\nℹ️ ESS DEFAULT CONFIGURATIONS FOUND:")
|
||||
pretty_logger.info(" These settings have ESS defaults that your values will override:")
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
for warning in engine.underride_warnings:
|
||||
pretty_logger.info(f" • {warning}")
|
||||
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
# Show clean migration message
|
||||
if not engine.override_warnings and not engine.underride_warnings:
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
pretty_logger.info("🎉 CLEAN MIGRATION: No unexpected overrides detected!")
|
||||
pretty_logger.info(" All configurations have been properly migrated to ESS.")
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
# Show next steps for deployment
|
||||
pretty_logger.info("🚀 NEXT STEPS TO DEPLOY ELEMENT SERVER SUITE:")
|
||||
pretty_logger.info("=" * 60)
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
# Use incremental step numbering
|
||||
step_number = 1
|
||||
@@ -406,7 +406,7 @@ Examples:
|
||||
f' helm upgrade --install --namespace "ess" ess '
|
||||
f"oci://ghcr.io/element-hq/ess-helm/matrix-stack -f {values_path} --wait"
|
||||
)
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
# Get the original media path from Synapse configuration
|
||||
synapse_input = engine.input_processor.input_for_strategy(SYNAPSE_STRATEGY_NAME)
|
||||
@@ -417,10 +417,10 @@ Examples:
|
||||
if original_media_path:
|
||||
pretty_logger.info(f"{step_number}. Copy media from your existing setup to ESS persistent volume:")
|
||||
pretty_logger.info(f" kubectl cp {original_media_path} ess-synapse-0:/media/media_store -n ess")
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
pretty_logger.info("📚 For more details on deployment and data migration, refer to the ESS documentation.")
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
# Add database-specific instructions
|
||||
if not engine.global_options.use_existing_database:
|
||||
@@ -428,7 +428,7 @@ Examples:
|
||||
pretty_logger.info("=" * 60)
|
||||
pretty_logger.info("Since you chose to use ESS-managed Postgres, you'll need to import your")
|
||||
pretty_logger.info("existing database schema after deployment. Here are the steps:")
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
# Get source database configuration from input files
|
||||
synapse_input = engine.input_processor.input_for_strategy(SYNAPSE_STRATEGY_NAME)
|
||||
@@ -465,7 +465,7 @@ Examples:
|
||||
pretty_logger.info(
|
||||
' kubectl scale deploy -l "app.kubernetes.io/component=matrix-authentication" -n ess --replicas=0'
|
||||
)
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
step_number += 1
|
||||
|
||||
@@ -477,7 +477,7 @@ Examples:
|
||||
if mas_input:
|
||||
pretty_logger.info(f" pg_dump -C -U {source_mas_user} -d {source_mas_db} > mas.sql")
|
||||
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
step_number += 1
|
||||
|
||||
# Step 3: Transform the dumps (only show if transformations are needed)
|
||||
@@ -511,7 +511,7 @@ Examples:
|
||||
if mas_input and source_mas_user != target_mas_user:
|
||||
pretty_logger.info(f" sed -i 's/OWNER TO.*{source_mas_user}/OWNER TO {target_mas_user}/' mas.sql")
|
||||
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
step_number += 1
|
||||
|
||||
# Step: Copy the dumps
|
||||
@@ -522,7 +522,7 @@ Examples:
|
||||
if mas_input:
|
||||
pretty_logger.info(" kubectl cp mas.sql ess-postgres-0:/tmp -n ess")
|
||||
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
step_number += 1
|
||||
|
||||
# Step: Import the dumps
|
||||
@@ -553,7 +553,7 @@ Examples:
|
||||
' kubectl scale deploy -l "app.kubernetes.io/component=matrix-authentication" -n ess --replicas=1'
|
||||
)
|
||||
|
||||
delay_next_steps(pretty_logger)
|
||||
press_enter_to_continue(pretty_logger)
|
||||
|
||||
pretty_logger.info("=" * 60)
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import time
|
||||
import urllib.parse
|
||||
from collections import defaultdict
|
||||
from collections.abc import Callable
|
||||
@@ -487,9 +485,10 @@ def prompt_for_database_choice(pretty_logger: logging.Logger) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def delay_next_steps(pretty_logger: logging.Logger) -> None:
|
||||
def press_enter_to_continue(pretty_logger: logging.Logger) -> None:
|
||||
if not is_quiet_mode(pretty_logger) and not os.environ.get("PYTEST_CURRENT_TEST"):
|
||||
time.sleep(random.uniform(0.2, 1.5))
|
||||
pretty_logger.info(" Press Enter to continue...")
|
||||
input()
|
||||
pretty_logger.info("")
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user