Skip to content

Commit a08b2bb

Browse files
authored
Merge pull request #124 from deploystackio/feat/service-connections
feat(docs): add service connections configuration details and examples to deployment documentation
2 parents 2f34213 + 351f4bd commit a08b2bb

1 file changed

Lines changed: 103 additions & 0 deletions

File tree

docs/deploystack/deploystack-config-file.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,74 @@ v2-beta:
122122

123123
If no providers are excluded, templates will be generated for all supported cloud providers.
124124

125+
### Service Connections
126+
127+
You can configure service-to-service communication for multi-container applications using the `serviceConnections` property within each branch configuration. This feature is particularly useful for applications where services need to communicate with each other (e.g., web apps connecting to databases).
128+
129+
| Property | Type | Description | Constraints |
130+
|----------|------|-------------|-------------|
131+
| `mappings` | Array | Defines relationships between services for connection configuration | Required |
132+
| `mappings[].fromService` | String | Service that needs to connect to another service | Required |
133+
| `mappings[].toService` | String | Service being connected to | Required |
134+
| `mappings[].environmentVariables` | Array of Strings | Environment variable names that reference the target service | Required |
135+
136+
Example configuration for service connections:
137+
138+
```yaml
139+
deployment:
140+
branches:
141+
main:
142+
label: "Production"
143+
description: "Production release"
144+
serviceConnections:
145+
mappings:
146+
- fromService: "app"
147+
toService: "db"
148+
environmentVariables:
149+
- "DATABASE_HOST"
150+
- "DATABASE_URL"
151+
- fromService: "frontend"
152+
toService: "api"
153+
environmentVariables:
154+
- "API_URL"
155+
```
156+
157+
This configuration tells DeployStack how to properly configure communication between:
158+
159+
- The "app" service and the "db" service through the DATABASE_HOST and DATABASE_URL environment variables
160+
- The "frontend" service and the "api" service through the API_URL environment variable
161+
162+
When templates are generated, DeployStack will transform these environment variables according to each cloud provider's specific service discovery mechanism:
163+
164+
- For Render.com: Uses Blueprint's `fromService` syntax
165+
- For DigitalOcean App Platform: Uses direct service name references
166+
167+
For example, if your docker-compose.yml contains:
168+
169+
```yaml
170+
services:
171+
app:
172+
image: node:alpine
173+
environment:
174+
DATABASE_HOST: db
175+
db:
176+
image: mariadb:latest
177+
```
178+
179+
The generated Render.com template would transform DATABASE_HOST to use their service discovery syntax:
180+
181+
```yaml
182+
services:
183+
- name: app
184+
# ...other configuration...
185+
envVars:
186+
- key: DATABASE_HOST
187+
fromService:
188+
name: db
189+
type: pserv
190+
property: hostport
191+
```
192+
125193
## Schema Validation
126194

127195
The configuration file is automatically validated against our JSON Schema when using supported IDEs (VS Code, IntelliJ, etc.). The schema is available at:
@@ -147,6 +215,41 @@ application:
147215
logo: "https://example.com/logos/redis-manager.png"
148216
```
149217

218+
### Configure Multiple Branch Deployments with Service Connections
219+
220+
```yaml
221+
deployment:
222+
branches:
223+
stable:
224+
label: "Stable"
225+
description: "Production-ready version"
226+
priority: 1
227+
serviceConnections:
228+
mappings:
229+
- fromService: "web"
230+
toService: "api"
231+
environmentVariables:
232+
- "API_ENDPOINT"
233+
- fromService: "api"
234+
toService: "db"
235+
environmentVariables:
236+
- "DB_HOST"
237+
- "DB_CONNECTION"
238+
239+
beta:
240+
label: "Beta"
241+
description: "Preview of upcoming features"
242+
priority: 2
243+
exclude_providers:
244+
- "aws" # Beta version not supported on AWS
245+
serviceConnections:
246+
mappings:
247+
- fromService: "web"
248+
toService: "api"
249+
environmentVariables:
250+
- "API_ENDPOINT"
251+
```
252+
150253
### Minimal Configuration example for logo update
151254

152255
Please visit our [Application Logo Configuration](/docs/deploystack/application-logo-configuration.md) page.

0 commit comments

Comments
 (0)