8000 fix: replace `DEVELOP` mode by simonrw · Pull Request #11285 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

fix: replace DEVELOP mode #11285

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 5 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
25 changes: 25 additions & 0 deletions localstack-core/localstack/dev/debugger/plugins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import logging

from localstack import config, constants
from localstack.runtime import hooks

LOG = logging.getLogger(__name__)


def enable_debugger():
from localstack.packages.debugpy import debugpy_package

debugpy_package.install()
import debugpy # noqa: T100

LOG.info("Starting debug server at: %s:%s", constants.BIND_HOST, config.DEVELOP_PORT)
debugpy.listen((constants.BIND_HOST, config.DEVELOP_PORT)) # noqa: T100

if config.WAIT_FOR_DEBUGGER:
debugpy.wait_for_client() # noqa: T100


@hooks.on_infra_start()
def conditionally_enable_debugger():
if config.DEVELOP:
enable_debugger()
48 changes: 35 additions & 13 deletions localstack-core/localstack/dev/run/configurators.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def __init__(

def __call__(self, cfg: ContainerConfiguration):
# localstack source code if available
source = self.host_paths.localstack_project_dir / "localstack-core" / "localstack"
source = self.host_paths.aws_community_package_dir
if source.exists():
cfg.volumes.add(
# read_only=False is a temporary workaround to make the mounting of the pro source work
Expand All @@ -134,13 +134,7 @@ def __call__(self, cfg: ContainerConfiguration):

# ext source code if available
if self.pro:
source = (
self.host_paths.localstack_pro_project_dir
/ "localstack-pro-core"
/ "localstack"
/ "pro"
/ "core"
)
source = self.host_paths.aws_pro_package_dir
if source.exists():
cfg.volumes.add(
VolumeBind(
Expand Down Expand Up @@ -220,11 +214,7 @@ def __init__(
def __call__(self, cfg: ContainerConfiguration):
# special case for community code
if not self.pro:
host_path = (
self.host_paths.localstack_project_dir
/ "localstack_core.egg-info"
/ "entry_points.txt"
)
host_path = self.host_paths.aws_community_package_dir
if host_path.exists():
cfg.volumes.append(
VolumeBind(
Expand All @@ -243,6 +233,38 @@ def __call__(self, cfg: ContainerConfiguration):
dep_path = container_path.parent.name.removesuffix(".dist-info")
dep, ver = dep_path.split("-")

if dep == "localstack_core":
host_path = (
self.host_paths.localstack_project_dir
/ "localstack-core"
/ "localstack_core.egg-info"
/ "entry_points.txt"
)
if host_path.is_file():
cfg.volumes.add(
VolumeBind(
str(host_path),
str(container_path),
read_only=True,
)
)
continue
elif dep == "localstack_ext":
host_path = (
self.host_paths.localstack_pro_project_dir
/ "localstack-pro-core"
/ "localstack_ext.egg-info"
/ "entry_points.txt"
)
if host_path.is_file():
cfg.volumes.add(
VolumeBind(
str(host_path),
str(container_path),
read_only=True,
)
)
continue
for host_path in self.host_paths.workspace_dir.glob(
f"*/{dep}.egg-info/entry_points.txt"
):
Expand Down
10 changes: 10 additions & 0 deletions localstack-core/localstack/dev/run/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ def __init__(
or os.path.join(os.getcwd(), ".venv")
)

@property
def aws_community_package_dir(self) -> Path:
return self.localstack_project_dir / "localstack-core" / "localstack"

@property
def aws_pro_package_dir(self) -> Path:
return (
self.localstack_pro_project_dir / "localstack-pro-core" / "localstack" / "pro" / "core"
)


class ContainerPaths:
"""Important paths in the container"""
Expand Down
Loading
0