Skip to content
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

Multi-instance custom service cannot output services #267

Open
srid opened this issue Jul 9, 2024 · 0 comments
Open

Multi-instance custom service cannot output services #267

srid opened this issue Jul 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@srid
Copy link
Member

srid commented Jul 9, 2024

This restriction is so because by design we can only output processes (via outputs.settings) not further services.

settings = lib.mkOption {
type = lib.types.lazyAttrsOf lib.types.raw;
internal = true;
description = ''
process-compose settings for the processes under the ${service} service
'';
apply = v: v // {
processes = lib.flip lib.mapAttrs v.processes (_: cfg:
{ imports = [ config.outputs.defaultProcessSettings cfg ]; }
);
};
};

https://community.flake.parts/services-flake/custom-service#multi-instance

--

Whereas, from user standpoint, it makes sense to have a hierarchy of services. Say, a infra-switch service expands to both a postgres process and a process-tracker service, which then further expands to a Haskell process and its own postgres process. Here, we can define a custom service for postgres-tracker service, but not the infra-switch service, unless we give up on it being a multi-instance service.

graph TD
    A[infra-switch service] --> B[postgres process]
    A --> C[process-tracker service]
    C --> D[Haskell process]
    C --> E[postgres process]

    style A fill:#f9f,stroke:#333,stroke-width:2px
    style C fill:#ccf,stroke:#333,stroke-width:2px
    style B fill:#cfc,stroke:#333,stroke-width:2px
    style D fill:#cfc,stroke:#333,stroke-width:2px
    style E fill:#cfc,stroke:#333,stroke-width:2px
Loading

In principle, we don't intend to run multiple instances of infra-switch ... however, making it multi-instance means we can leverage name in certain places, like namespace (cf. #258) and generally provide a consistent modular interface.

@srid srid added the enhancement New feature or request label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant