Skip to content

stabilize docker compose orchestration and networking logic#545

Merged
pradeeban merged 4 commits intoControlCore-Project:devfrom
GREENRAT-K405:fix/network-docker-compose
Apr 14, 2026
Merged

stabilize docker compose orchestration and networking logic#545
pradeeban merged 4 commits intoControlCore-Project:devfrom
GREENRAT-K405:fix/network-docker-compose

Conversation

@GREENRAT-K405
Copy link
Copy Markdown
Contributor

I have fixed the primary networking disconnect preventing docker-compose generated workflows from functioning out of the box.

While fixing this network isolation, I have also fixed three secondary problems (startup race conditions, missing volume declarations, and missing Python contexts) entirely from within the new CLI wrapper (concore_cli/commands/build.py).

I have avoided modifying mkconcore.py for this one!

Before:

  • No shared network defined (everything was on different localhosts of respective nodes)
  • ZeroMQ race condition (because all the nodes launched simultaneously)
  • Volumes were not listed at the compose root
  • concore build never really passed the requirements/ deps

After:

  • bridged concore-net that dynamically initialized at the root of the Compose file. Every generated container is explicitly attached to this shared network namespace, ensuring that ZeroMQ hostnames are universally resolvable and peer-to-peer pipelines connect flawlessly.
  • Added 'depends_on' chains to launch graphs structurally, and 'restart: on-failure' hooks to allow nodes to peacefully wait and auto-heal if a socket isn't ready.
  • append a safe top-level volumes: registry block.
  • natively fetch the active requirements.txt and securely inject it into the src/ directory natively.

Copilot AI review requested due to automatic review settings April 14, 2026 04:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CLI build wrapper to generate more usable Docker Compose output for mkconcore-generated Docker workflows, aiming to make multi-container networking and startup behavior work out-of-the-box.

Changes:

  • Generate a docker-compose.yml that defines and attaches all services to a shared concore-net bridge network.
  • Add restart: on-failure, a sequential depends_on chain, and emit a top-level volumes: block for detected named volumes.
  • Copy a requirements.txt into out/src/ and patch generated build scripts to include it in each Docker build context.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread concore_cli/commands/build.py Outdated
Comment on lines +97 to +117
@@ -104,10 +107,30 @@ def _write_docker_compose(output_path):
compose_lines.append(
f" container_name: {_yaml_quote(service['container_name'])}"
)
compose_lines.append(" restart: on-failure")
compose_lines.append(" networks:")
compose_lines.append(" - concore-net")

# Chain services sequentially to prevent ZMQ race conditions
if prev_service_name:
compose_lines.append(" depends_on:")
compose_lines.append(f" - {prev_service_name}")
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

service_name is emitted as an unquoted YAML key and referenced unquoted in depends_on. If a container name starts with a digit (or looks like a number, e.g. "1", "1.0"), YAML parsers can treat it as a numeric scalar, and Docker Compose unmarshalling expects string service keys. Consider quoting the service keys (and the depends_on entries) or forcing a non-numeric prefix when the first char is not a letter to ensure Compose always reads these as strings.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I've updated the logic to use .isalpha() instead of .isalnum() to strictly enforce safe string prefixes, and applied _yaml_quote directly to the top-level service definitions to prevent any numeric parser crashes.

Note: I actually ended up removing the depends_on chaining entirely. Since we are using restart: on-failure, Docker inherently handles the ZMQ readiness loop, meaning the linear depends_on overhead was just needlessly serializing our architecture's concurrent startup times!

Comment thread concore_cli/commands/build.py Outdated
Comment thread concore_cli/commands/build.py Outdated
Comment thread concore_cli/commands/build.py Outdated
Comment thread concore_cli/commands/build.py Outdated
@GREENRAT-K405
Copy link
Copy Markdown
Contributor Author

@pradeeban this should be ready for your review, if you have any suggestions please do let me know
Thanks!

@GREENRAT-K405
Copy link
Copy Markdown
Contributor Author

@pradeeban, also just a question, do we show any interest for concore implementation in scilab?

@pradeeban
Copy link
Copy Markdown
Member

We support both MATLAB and Octave. So why not? But I also think these extra implementations are going to be just research curiosity rather than a real need. So perhaps not.

@pradeeban pradeeban merged commit a850269 into ControlCore-Project:dev Apr 14, 2026
7 checks passed
@GREENRAT-K405
Copy link
Copy Markdown
Contributor Author

for the past week I was completing an assignment related to converting the 'control systems' octave functions to scilab functions for a fellowship (Academic), that just got me interested to ask!

@GREENRAT-K405
Copy link
Copy Markdown
Contributor Author

@pradeeban Also it would be cool if we can explore any possibilities of integrating machine learning with concore systems after the complete GSoC phase :) , I assume that would increase the practical applications even more.
(maybe that is already being done)

@pradeeban
Copy link
Copy Markdown
Member

@GREENRAT-K405 Actually, there were several machine learning projects that were part of the CONTROL-CORE project. If you go over @mayureshkothare's Google Scholar profile, you will come across some.

@GREENRAT-K405
Copy link
Copy Markdown
Contributor Author

@GREENRAT-K405 Actually, there were several machine learning projects that were part of the CONTROL-CORE project. If you go over @mayureshkothare's Google Scholar profile, you will come across some.

Thank you, @pradeeban! I’ll take a look at @mayureshkothare’s Google Scholar profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants