v2.2.0 64d39bf

network-groups.md RawHistoryFolder

Network Groups

Group multiple applications into shared networks for inter-service communication.

Configuration

[network_groups]
"backend" = ["app.mydomain.com", "api.mydomain.com"]
"monitoring" = ["grafana.mydomain.com", "prometheus.mydomain.com"]

Syntax

[network_groups]
"<group-name>" = ["<domain>", "<domain>", ...]
Component Description
group-name Name for the shared network
domains List of routes that share this network

How It Works

Network groups create shared Docker networks for multiple applications:

[network_groups]
"backend" = ["app.mydomain.com", "api.mydomain.com"]

Creates a shared network: gordon-backend

┌────────────────────────────────────────────────────┐
│ gordon-backend                                      │
│                                                    │
│  ┌──────────┐    ┌──────────┐    ┌──────────┐    │
│  │   App    │←──→│   API    │←──→│ Postgres │    │
│  │  :3000   │    │  :8080   │    │  :5432   │    │
│  └──────────┘    └──────────┘    └──────────┘    │
│                                                    │
└────────────────────────────────────────────────────┘

Service Discovery

Applications in the same group can communicate using container names:

[routes]
"app.mydomain.com" = "frontend:latest"
"api.mydomain.com" = "backend:latest"

[network_groups]
"services" = ["app.mydomain.com", "api.mydomain.com"]

The frontend can reach the backend:

// In frontend app
const response = await fetch("http://backend:8080/api/data");

Shared Attachments

Combine network groups with attachments for shared services:

[network_groups]
"backend" = ["app.mydomain.com", "api.mydomain.com"]

[attachments]
"backend" = ["postgres:latest", "redis:latest"]

Both app.mydomain.com and api.mydomain.com can access:

  • postgres:5432
  • redis:6379

Multiple Groups

An application can only be in one network group:

# Each app belongs to one group
[network_groups]
"customer-facing" = ["app.mydomain.com", "api.mydomain.com"]
"internal" = ["admin.mydomain.com", "metrics.mydomain.com"]

Mixed Isolation

Combine network groups with per-app attachments:

[network_groups]
"backend" = ["app.mydomain.com", "api.mydomain.com"]

[attachments]
# Shared by both apps
"backend" = ["redis:latest", "rabbitmq:latest"]

# App-specific databases
"app.mydomain.com" = ["app-postgres:latest"]
"api.mydomain.com" = ["api-postgres:latest"]

Result:

  • Shared: Redis and RabbitMQ
  • Isolated: Each app has its own Postgres

Examples

Microservices Architecture

[routes]
"orders.mydomain.com" = "orders-service:latest"
"inventory.mydomain.com" = "inventory-service:latest"
"shipping.mydomain.com" = "shipping-service:latest"
"payments.mydomain.com" = "payments-service:latest"

[network_groups]
"order-processing" = ["orders.mydomain.com", "inventory.mydomain.com", "shipping.mydomain.com"]
"payment-processing" = ["payments.mydomain.com"]

[attachments]
"order-processing" = ["rabbitmq:latest"]
"payments.mydomain.com" = ["payments-db:latest"]

Monitoring Stack

[routes]
"grafana.mydomain.com" = "grafana/grafana:latest"
"prometheus.mydomain.com" = "prom/prometheus:latest"
"alertmanager.mydomain.com" = "prom/alertmanager:latest"

[network_groups]
"monitoring" = ["grafana.mydomain.com", "prometheus.mydomain.com", "alertmanager.mydomain.com"]

[attachments]
"monitoring" = ["prometheus-data:latest"]

Multi-Tenant SaaS

[routes]
"app.saas.com" = "saas-app:latest"
"api.saas.com" = "saas-api:latest"
"admin.saas.com" = "saas-admin:latest"

# API and App share backend services
[network_groups]
"platform" = ["app.saas.com", "api.saas.com"]

# Admin is isolated
[attachments]
"platform" = ["postgres:latest", "redis:latest", "elasticsearch:latest"]
"admin.saas.com" = ["admin-db:latest"]

Network Naming

Group networks are named: {network_prefix}-{group-name}

Group Network Name
backend gordon-backend
monitoring gordon-monitoring
order-processing gordon-order-processing
source
1# Network Groups
2
3Group multiple applications into shared networks for inter-service communication.
4
5## Configuration
6
7```toml
8[network_groups]
9"backend" = ["app.mydomain.com", "api.mydomain.com"]
10"monitoring" = ["grafana.mydomain.com", "prometheus.mydomain.com"]
11```
12
13## Syntax
14
15```toml
16[network_groups]
17"<group-name>" = ["<domain>", "<domain>", ...]
18```
19
20| Component | Description |
21|-----------|-------------|
22| `group-name` | Name for the shared network |
23| `domains` | List of routes that share this network |
24
25## How It Works
26
27Network groups create shared Docker networks for multiple applications:
28
29```toml
30[network_groups]
31"backend" = ["app.mydomain.com", "api.mydomain.com"]
32```
33
34Creates a shared network: `gordon-backend`
35
36```
37┌────────────────────────────────────────────────────┐
38│ gordon-backend                                      │
39│                                                    │
40│  ┌──────────┐    ┌──────────┐    ┌──────────┐    │
41│  │   App    │←──→│   API    │←──→│ Postgres │    │
42│  │  :3000   │    │  :8080   │    │  :5432   │    │
43│  └──────────┘    └──────────┘    └──────────┘    │
44│                                                    │
45└────────────────────────────────────────────────────┘
46```
47
48## Service Discovery
49
50Applications in the same group can communicate using container names:
51
52```toml
53[routes]
54"app.mydomain.com" = "frontend:latest"
55"api.mydomain.com" = "backend:latest"
56
57[network_groups]
58"services" = ["app.mydomain.com", "api.mydomain.com"]
59```
60
61The frontend can reach the backend:
62```javascript
63// In frontend app
64const response = await fetch("http://backend:8080/api/data");
65```
66
67## Shared Attachments
68
69Combine network groups with attachments for shared services:
70
71```toml
72[network_groups]
73"backend" = ["app.mydomain.com", "api.mydomain.com"]
74
75[attachments]
76"backend" = ["postgres:latest", "redis:latest"]
77```
78
79Both `app.mydomain.com` and `api.mydomain.com` can access:
80- `postgres:5432`
81- `redis:6379`
82
83## Multiple Groups
84
85An application can only be in one network group:
86
87```toml
88# Each app belongs to one group
89[network_groups]
90"customer-facing" = ["app.mydomain.com", "api.mydomain.com"]
91"internal" = ["admin.mydomain.com", "metrics.mydomain.com"]
92```
93
94## Mixed Isolation
95
96Combine network groups with per-app attachments:
97
98```toml
99[network_groups]
100"backend" = ["app.mydomain.com", "api.mydomain.com"]
101
102[attachments]
103# Shared by both apps
104"backend" = ["redis:latest", "rabbitmq:latest"]
105
106# App-specific databases
107"app.mydomain.com" = ["app-postgres:latest"]
108"api.mydomain.com" = ["api-postgres:latest"]
109```
110
111Result:
112- Shared: Redis and RabbitMQ
113- Isolated: Each app has its own Postgres
114
115## Examples
116
117### Microservices Architecture
118
119```toml
120[routes]
121"orders.mydomain.com" = "orders-service:latest"
122"inventory.mydomain.com" = "inventory-service:latest"
123"shipping.mydomain.com" = "shipping-service:latest"
124"payments.mydomain.com" = "payments-service:latest"
125
126[network_groups]
127"order-processing" = ["orders.mydomain.com", "inventory.mydomain.com", "shipping.mydomain.com"]
128"payment-processing" = ["payments.mydomain.com"]
129
130[attachments]
131"order-processing" = ["rabbitmq:latest"]
132"payments.mydomain.com" = ["payments-db:latest"]
133```
134
135### Monitoring Stack
136
137```toml
138[routes]
139"grafana.mydomain.com" = "grafana/grafana:latest"
140"prometheus.mydomain.com" = "prom/prometheus:latest"
141"alertmanager.mydomain.com" = "prom/alertmanager:latest"
142
143[network_groups]
144"monitoring" = ["grafana.mydomain.com", "prometheus.mydomain.com", "alertmanager.mydomain.com"]
145
146[attachments]
147"monitoring" = ["prometheus-data:latest"]
148```
149
150### Multi-Tenant SaaS
151
152```toml
153[routes]
154"app.saas.com" = "saas-app:latest"
155"api.saas.com" = "saas-api:latest"
156"admin.saas.com" = "saas-admin:latest"
157
158# API and App share backend services
159[network_groups]
160"platform" = ["app.saas.com", "api.saas.com"]
161
162# Admin is isolated
163[attachments]
164"platform" = ["postgres:latest", "redis:latest", "elasticsearch:latest"]
165"admin.saas.com" = ["admin-db:latest"]
166```
167
168## Network Naming
169
170Group networks are named: `{network_prefix}-{group-name}`
171
172| Group | Network Name |
173|-------|--------------|
174| `backend` | `gordon-backend` |
175| `monitoring` | `gordon-monitoring` |
176| `order-processing` | `gordon-order-processing` |
177
178## Related
179
180- [Network Isolation](./network-isolation.md)
181- [Attachments](./attachments.md)
182- [Routes](./routes.md)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close