FeatureRecipe
compose-bridge-fr
Network bridge for compose, between the networks of one compose file (each boundary's aggrega.ai/namespace, else the file's own network). Runs once per boundary attachment (executionScope: boundary) and renders one nginx-stream gateway named "aggrega-gw" into the boundary's own compose file. Its templates compute everything from the boundary's uses edges, so no address is hand-authored: an edge is bridged when both of its ends are assembled into the gateway's own file and sit on different networks there. Each bridged edge gets a `server { listen <port>; proxy_pass <target> }` block, the gateway joins the networks of every bridged end, and each consumer's variables delivered from the target's address are rewritten to reach it through the gateway.
Происхождение
- Дайджест содержимого
- sha256:5bc7cdb28e1b67707600e7aad52ad8aaf84bc95791511fa480f3f13abfc8a8f5
- Опубликовано
- 2026-11-10T10:14:38Z
- Идентичность подписи
- https://token.actions.githubusercontent.com/https://github.com/aggrega-ai/aggrega-hub/.github/workflows/catalog-publish-sign.yml@refs/heads/main
Подпись
- Официальныйapplication/vnd.dev.sigstore.bundle.v0.3+json
https://token.actions.githubusercontent.com/https://github.com/aggrega-ai/aggrega-hub/.github/workflows/catalog-publish-sign.yml@refs/heads/main
sha256:3f7f613d05ea1ddb450e6141d45b28314497fc5d3c0f27d80f2dd7595d6df4d8
Ссылка на эту версию
oci://hub.aggrega.ai/featurerecipe/compose/compose-bridge-fr:1.0.0- Цель
- —
- Реализует
- core/compose-bridge:1.0.0
Предоставляет
Детерминированные шаблоны указателей, которые этот рецепт связывает для потребителей.
| Имя | Шаблон |
|---|---|
| servers | {{ .locals.servers }} |
| rewrites | {{ .locals.rewrites }} |
Сопоставление внедрения
{{- $rewrites := fromJson (index .features .attachment_name).provides.rewrites -}} {{- with get $rewrites .context.instance_id -}}{{ toJson . }}{{- end -}}Workload
Шаблон рабочей нагрузки не объявлен.
Локальные значения
| Имя | Шаблон |
|---|---|
| servers | {{- $hostField := .infra.providesField -}} {{- $portBase := int .infra.portBase -}} {{- $own := .boundary.assembly_path -}} {{- $byKey := dict -}} {{- $keys := list -}} {{- range $e := .boundary.internal_uses_edges -}} {{- $srcPath := toString (get $e "source_assembly_path") -}} {{- $tgtPath := toString (get $e "target_assembly_path") -}} {{- $srcNet := or (toString (get $e "source_namespace")) $srcPath -}} {{- $tgtNet := or (toString (get $e "target_namespace")) $tgtPath -}} {{- if and (eq $srcPath $own) (eq $tgtPath $own) (ne $srcNet $tgtNet) -}} {{- $key := printf "%s\x00%s\x00%s" (toString (get $e "source")) (toString (get $e "target")) (toString (get $e "socket")) -}} {{- $keys = append $keys $key -}} {{- $_ := set $byKey $key $e -}} {{- end -}} {{- end -}} {{- $keys = sortAlpha $keys -}} {{- $used := dict -}} {{- $rows := list -}} {{- range $key := $keys -}} {{- $e := get $byKey $key -}} {{- $provides := get $e "provides" | default dict -}} {{- $targetPort := atoi (toString (get $provides "port")) -}} {{- $listen := $targetPort -}} {{- if hasKey $used (toString $listen) -}} {{- $listen = $portBase -}} {{- range $keys -}} {{- if hasKey $used (toString $listen) -}} {{- $listen = add $listen 1 -}} {{- end -}} {{- end -}} {{- end -}} {{- $_ := set $used (toString $listen) true -}} {{- $env := get (get $e "inject" | default dict) "env" | default dict -}} {{- $hostVars := list -}} {{- $portVars := list -}} {{- range $in, $from := $env -}} {{- if eq (toString $from) $hostField -}} {{- $hostVars = append $hostVars $in -}} {{- else if eq (toString $from) "port" -}} {{- $portVars = append $portVars $in -}} {{- end -}} {{- end -}} {{- $consumer := get (get $.boundary.components (toString (get $e "source"))) "instance_id" -}} {{- $rows = append $rows (dict "source" (get $e "source") "target" (get $e "target") "consumer" $consumer "upstream" (printf "%s:%d" (toString (get $provides $hostField)) $targetPort) "listen" $listen "host_variables" $hostVars "port_variables" $portVars) -}} {{- end -}} {{- toJson $rows -}} |
| rewrites | {{- $out := dict -}} {{- range $row := fromJson .locals.servers -}} {{- if $row.host_variables -}} {{- $consumer := get $out $row.consumer | default dict -}} {{- if $row.port_variables -}} {{- range $row.host_variables -}} {{- $_ := set $consumer . "aggrega-gw" -}} {{- end -}} {{- range $row.port_variables -}} {{- $_ := set $consumer . (printf "%d" (int $row.listen)) -}} {{- end -}} {{- else -}} {{- range $row.host_variables -}} {{- $_ := set $consumer . (printf "aggrega-gw:%d" (int $row.listen)) -}} {{- end -}} {{- end -}} {{- $_ := set $out $row.consumer $consumer -}} {{- end -}} {{- end -}} {{- toJson $out -}} |
Сопоставление values
Сопоставление values не объявлено.
Связи
Типизированные рёбра к другим опубликованным сущностям и от них. Ссылка без опубликованной цели отображается как разорванное ребро, а не как ссылка.
Использует
- реализуетреализует
core/compose-bridge:1.0.0
Используется в
Ничто в каталоге не зависит от этой сущности.