Skip to content

Commit

Permalink
Merge pull request #174 from rtCamp/minor-fixes
Browse files Browse the repository at this point in the history
Fix `code` command force start flag and `create` command template flag
  • Loading branch information
Xieyt authored May 10, 2024
2 parents 273eda2 + f289135 commit 41079d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion frappe_manager/migration_manager/migration_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def bench_db_backup(
bench_db_info = bench.get_db_connection_info()
bench_db_name = bench_db_info["name"]

richprint.change_head(f'Commencing db [blue]{bench.name}[/blue] backup')
richprint.change_head(f'Commencing db {bench.name} backup')

mariadb_manager = MariaDBManager(server_db_info, services_manager.compose_project)

Expand Down
28 changes: 7 additions & 21 deletions frappe_manager/site_manager/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from frappe_manager.migration_manager.backup_manager import BackupManager
from frappe_manager.services_manager.services import ServicesManager
from frappe_manager.site_manager import VSCODE_LAUNCH_JSON, VSCODE_SETTINGS_JSON, VSCODE_TASKS_JSON
from frappe_manager.site_manager import bench_config
from frappe_manager.site_manager.admin_tools import AdminTools
from frappe_manager.site_manager.bench_config import BenchConfig, FMBenchEnvType
from frappe_manager.site_manager.site_exceptions import (
Expand Down Expand Up @@ -193,7 +192,11 @@ def create(self, is_template_bench: bool = False):

if is_template_bench:
self.remove_attached_secrets()
richprint.exit(f"Created template bench: {self.name}", emoji_code=":white_check_mark:")
global_db_info = self.services.database_manager.database_server_info
self.sync_bench_common_site_config(global_db_info.host, global_db_info.port)
self.save_bench_config()
richprint.print(f"Created template bench: {self.name}", emoji_code=":white_check_mark:")
return

richprint.change_head(f"Starting bench services")
self.compose_project.start_service(force_recreate=True)
Expand All @@ -220,20 +223,8 @@ def create(self, is_template_bench: bool = False):

self.logger.info(f"{self.name}: Bench site is active and responding.")

# self.create_certificate()

# richprint.change_head("Configuring bench admin tools.")

# if self.bench_config.admin_tools:
# self.sync_admin_tools_compose()
# self.restart_frappe_server()

# richprint.print("Cofigured bench admin tools.")

self.info()

# self.save_bench_config()

if not ".localhost" in self.name:
richprint.print(
f"Please note that You will have to add a host entry to your system's hosts file to access the bench locally."
Expand Down Expand Up @@ -415,6 +406,7 @@ def start(self, force: bool = False):
self.sync_bench_common_site_config(global_db_info.host, global_db_info.port)

richprint.change_head("Starting bench services")
self.admin_tools.remove_nginx_location_config()
self.compose_project.start_service(force_recreate=force)
self.sync_bench_config_configuration()
self.save_bench_config()
Expand All @@ -426,12 +418,6 @@ def start(self, force: bool = False):
self.workers.compose_project.start_service(force_recreate=force)
richprint.print("Started bench workers services.")

# # start admin_tools if exists
# if self.admin_tools.compose_project.compose_file_manager.exists():
# richprint.change_head("Starting bench admin tools services")
# self.admin_tools.compose_project.start_service(force_recreate=force)
# richprint.print("Started bench admin tools services.")

richprint.change_head('Starting frappe server')
self.frappe_logs_till_start()
richprint.print('Started frappe server.')
Expand Down Expand Up @@ -966,7 +952,7 @@ def attach_to_bench(self, user: str, extensions: List[str], workdir: str, debugg
self.compose_project.compose_file_manager.set_labels("frappe", labels)
self.compose_project.compose_file_manager.write_to_file()
richprint.print(f"Regenerated bench compose.")
self.start()
self.compose_project.start_service(['frappe'])

# sync debugger files
if debugger:
Expand Down

0 comments on commit 41079d5

Please sign in to comment.