publish docker ports only when needed
This commit is contained in:
parent
58bc87380d
commit
560f4f5485
|
|
@ -74,6 +74,7 @@ def generate_module_analysis(ctx, step, database, modules):
|
||||||
database=initial_database,
|
database=initial_database,
|
||||||
execution_context="openupgrade",
|
execution_context="openupgrade",
|
||||||
detached_container=True,
|
detached_container=True,
|
||||||
|
publish_ports=True,
|
||||||
)
|
)
|
||||||
# INITIAL : install modules to analyse and generate records
|
# INITIAL : install modules to analyse and generate records
|
||||||
initial_instance = OdooInstance(ctx, initial_database)
|
initial_instance = OdooInstance(ctx, initial_database)
|
||||||
|
|
@ -94,7 +95,6 @@ def generate_module_analysis(ctx, step, database, modules):
|
||||||
stop_after_init=True,
|
stop_after_init=True,
|
||||||
init=get_upgrade_analysis_module(final_step),
|
init=get_upgrade_analysis_module(final_step),
|
||||||
execution_context="openupgrade",
|
execution_context="openupgrade",
|
||||||
alternative_xml_rpc_port=alternative_xml_rpc_port,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# name of the first odoo instance inside the second odoo instance
|
# name of the first odoo instance inside the second odoo instance
|
||||||
|
|
@ -109,6 +109,7 @@ def generate_module_analysis(ctx, step, database, modules):
|
||||||
alternative_xml_rpc_port=alternative_xml_rpc_port,
|
alternative_xml_rpc_port=alternative_xml_rpc_port,
|
||||||
execution_context="openupgrade",
|
execution_context="openupgrade",
|
||||||
links={initial_container.name: odoo_initial_host_name},
|
links={initial_container.name: odoo_initial_host_name},
|
||||||
|
publish_ports=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# FINAL : install modules to analyse and generate records
|
# FINAL : install modules to analyse and generate records
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ def install_from_csv(ctx, database, with_demo):
|
||||||
detached_container=True,
|
detached_container=True,
|
||||||
init="base",
|
init="base",
|
||||||
demo=with_demo,
|
demo=with_demo,
|
||||||
|
publish_ports=True,
|
||||||
)
|
)
|
||||||
odoo_instance = OdooInstance(ctx, database)
|
odoo_instance = OdooInstance(ctx, database)
|
||||||
odoo_default_company = ctx.obj["config"].get(
|
odoo_default_company = ctx.obj["config"].get(
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ def run(
|
||||||
stop_after_init=stop_after_init,
|
stop_after_init=stop_after_init,
|
||||||
demo=with_demo,
|
demo=with_demo,
|
||||||
execution_context=execution_context,
|
execution_context=execution_context,
|
||||||
|
publish_ports=True,
|
||||||
)
|
)
|
||||||
if not stop_after_init:
|
if not stop_after_init:
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ from odoo_openupgrade_wizard.tools.tools_docker import (
|
||||||
from odoo_openupgrade_wizard.tools.tools_postgres import get_postgres_container
|
from odoo_openupgrade_wizard.tools.tools_postgres import get_postgres_container
|
||||||
from odoo_openupgrade_wizard.tools.tools_system import get_script_folder
|
from odoo_openupgrade_wizard.tools.tools_system import get_script_folder
|
||||||
|
|
||||||
|
DEFAULT_ODOO_HTTP_PORT = 8069
|
||||||
|
|
||||||
|
|
||||||
def get_repo_file_path(ctx, odoo_version: float) -> Path:
|
def get_repo_file_path(ctx, odoo_version: float) -> Path:
|
||||||
"""return the relative path of the repos.yml file
|
"""return the relative path of the repos.yml file
|
||||||
|
|
@ -217,6 +219,7 @@ def run_odoo(
|
||||||
execution_context: str = False,
|
execution_context: str = False,
|
||||||
alternative_xml_rpc_port: int = False,
|
alternative_xml_rpc_port: int = False,
|
||||||
links: dict = {},
|
links: dict = {},
|
||||||
|
publish_ports: bool = False,
|
||||||
):
|
):
|
||||||
# Ensure that Postgres container exist
|
# Ensure that Postgres container exist
|
||||||
get_postgres_container(ctx)
|
get_postgres_container(ctx)
|
||||||
|
|
@ -256,6 +259,7 @@ def run_odoo(
|
||||||
execution_context=execution_context,
|
execution_context=execution_context,
|
||||||
alternative_xml_rpc_port=alternative_xml_rpc_port,
|
alternative_xml_rpc_port=alternative_xml_rpc_port,
|
||||||
links=links,
|
links=links,
|
||||||
|
publish_ports=publish_ports,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -268,6 +272,7 @@ def run_container_odoo(
|
||||||
alternative_xml_rpc_port: int = False,
|
alternative_xml_rpc_port: int = False,
|
||||||
execution_context: str = False,
|
execution_context: str = False,
|
||||||
links: dict = {},
|
links: dict = {},
|
||||||
|
publish_ports: bool = False,
|
||||||
):
|
):
|
||||||
env_path = ctx.obj["env_folder_path"]
|
env_path = ctx.obj["env_folder_path"]
|
||||||
odoo_env_path = get_odoo_env_path(ctx, migration_step["version"])
|
odoo_env_path = get_odoo_env_path(ctx, migration_step["version"])
|
||||||
|
|
@ -280,13 +285,16 @@ def run_container_odoo(
|
||||||
|
|
||||||
links.update({ctx.obj["config"]["postgres_container_name"]: "db"})
|
links.update({ctx.obj["config"]["postgres_container_name"]: "db"})
|
||||||
|
|
||||||
|
if publish_ports:
|
||||||
|
ports = {host_xmlrpc_port: DEFAULT_ODOO_HTTP_PORT}
|
||||||
|
else:
|
||||||
|
ports = {}
|
||||||
|
|
||||||
return run_container(
|
return run_container(
|
||||||
get_docker_image_tag(ctx, migration_step["version"]),
|
get_docker_image_tag(ctx, migration_step["version"]),
|
||||||
get_docker_container_name(ctx, database, migration_step),
|
get_docker_container_name(ctx, database, migration_step),
|
||||||
command=command,
|
command=command,
|
||||||
ports={
|
ports=ports,
|
||||||
host_xmlrpc_port: 8069,
|
|
||||||
},
|
|
||||||
volumes={
|
volumes={
|
||||||
env_path: "/env/",
|
env_path: "/env/",
|
||||||
odoo_env_path: "/odoo_env/",
|
odoo_env_path: "/odoo_env/",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user