Skip to content

Proposal: namespace separation by concern + repository structure cleanup #3

Description

@jravani

Background

The Simulation interface in simulations/simulation.go was designed from the start as a deployment boundary, each implementation was intended to run as an independently deployable service. A team change introduced the current monolith, wiring all handlers into a single binary without respecting that boundary. This proposal restores the original design intent.


Problem 1: Repository structure

The folder naming has drifted and no longer reflects the contents or the intended architecture.

Current Problem
webservice.docker/ Dot in directory name; not idiomatic
webservice.docker/servicehub/ Vague name for the Calliope/PyPSA runner
techs/ Vague; contains tech service dockerfiles
webservice.docker/webservice/convertion/ Misspelled (conversion)
docker-compose.photovoltaik.yaml German mixed into an English codebase
.gitlab-ci-.yml Broken filename
servicehub/data/ + servicehub/data_new/ Duplicate data directories
temp_c2p_pkg/, tmp/webservice Build artifacts committed to git
c2p.py, export.py, generate_slp_profiles.py Loose scripts at repo root

Proposed rename (no logic changes, standalone PR):

simulation-engine/
├── engine/               # was webservice.docker/ as Go simulation gateway
│   ├── webservice/       # Go source (unchanged)
│   ├── calliope-runner/  # was servicehub/ as Calliope/PyPSA Python runner
│   └── *.dockerfile
├── services/             # was techs/ as per-tech service dockerfiles
└── docker-compose/       # unchanged

Problem 2: Restoring namespace separation

The original design intent: each Simulation implementation is a separately deployable service, grouped by concern into its own Docker network.

Namespace Services
building-model ignis-sim-api, ignis, buem-sim-api, buem
renewables pv-sim-api, pv, wind-sim-api, wind, biomass-sim-api, biomass, geothermal-sim-api, geothermal
optimiser calliope-sim-api, calliope
grid-simulator pypsa-sim-api, pypsa
grid-generator pylovo-sim-api, pylovo

All namespaces share a single shared_sim_data Docker volume for simulation outputs.


Implementation: restoring the original intent

The Simulation interface is already the correct abstraction:

type Simulation interface {
    Path() string
    Configure() http.HandlerFunc
    Generate() http.HandlerFunc
    Start() http.HandlerFunc
    Show() http.HandlerFunc
    Log() http.HandlerFunc
    Finish() http.HandlerFunc
}

Every handler already implements it. The required change is small: add an ENABLED_SIMS env var that filters which implementations are registered at startup.

// routes.go
all := []Simulation{NewCalliope(), NewPyPSA(), NewBUEM(), NewIgnis(), ...}
enabled := filterByEnv(all, os.Getenv("ENABLED_SIMS"))
for _, sim := range enabled { ... }

Deploy the same binary with different env configs per namespace:

# building-model namespace
environment:
  - ENABLED_SIMS=ignis,buem

# optimiser namespace
environment:
  - ENABLED_SIMS=calliope

No code split. No new repos. No new images. One binary, multiple deployment profiles, which is what the interface was designed to enable.

Splitting into separate binaries per namespace is explicitly out of scope. It multiplies CI pipelines and images for no benefit over the env-var approach.


Decision needed

  • Confirm this approach in team meeting
  • Agree on ENABLED_SIMS env var name and format
  • Decide whether the folder rename (Problem 1) proceeds as a standalone PR first

Activity

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

Metadata

Metadata

Labels

proposalDesign proposal — needs team discussion before implementation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions