Skip to content

Commit e1e236a

Browse files
authored
Merge pull request #126 from deploystackio/main
latest prod release
2 parents 8238efa + 4a4461a commit e1e236a

5 files changed

Lines changed: 462 additions & 9 deletions

File tree

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
This repository contains the official documentation for the DeployStack ecosystem. Visit [deploystack.io](https://deploystack.io) to learn more about our platform.
44

5-
![GitHub Release](https://img.shields.io/github/v/release/deploystackio/documentation)
6-
![GitHub deployments](https://img.shields.io/github/deployments/deploystackio/documentation/Production?label=Production)
7-
85
## Project Structure
96

107
Key directories in this repository:

docs/deploystack/deploystack-config-file.md

Lines changed: 130 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ You can override these values using the `config.yml` (only on your main branch)
4343

4444
| Property | Type | Description | Constraints |
4545
|----------|------|-------------|-------------|
46-
| `name` | String | Override the repository name for DeployStack display | Maximum 40 characters |
47-
| `description` | String | Override the repository description for DeployStack display | Maximum 500 characters |
48-
| `logo` | String | URL to your application logo | [Application Logo Configuration](/docs/deploystack/application-logo-configuration.md) |
46+
| `mappings` | Array | Defines relationships between services for connection configuration | Required |
47+
| `mappings[].fromService` | String | Service that needs to connect to another service | Required |
48+
| `mappings[].toService` | String | Service being connected to | Required |
49+
| `mappings[].environmentVariables` | Array of Strings | Environment variable names that reference the target service | Required |
50+
| `mappings[].property` | String | Type of connection property to reference (e.g., 'connectionString', 'hostport') | Optional, defaults to 'hostport' |
4951

5052
The override process follows this order:
5153

@@ -64,6 +66,7 @@ You can configure multiple branch deployments using the `deployment.branches` se
6466
| `description` | String | Explain the branch's purpose or version | Maximum 100 characters |
6567
| `active` | Boolean | Whether this branch is available for deployment | Optional, defaults to true |
6668
| `priority` | Number | Order in which branches appear (lower numbers first) | Minimum value: 1 |
69+
| `exclude_providers` | Array | Optional list of cloud providers to exclude from template generation for this branch | Values must be valid provider codes: "aws", "rnd", "dop" |
6770

6871
The default branch always has `priority: 0` and appears first in the deployment options, regardless of other branch priorities.
6972

@@ -80,6 +83,8 @@ deployment:
8083
label: "Beta (v2.x)"
8184
description: "Preview of upcoming v2.x release"
8285
priority: 1
86+
exclude_providers:
87+
- "aws" # Exclude AWS CloudFormation for this branch
8388
v3:
8489
label: "Alpha (v3.x)"
8590
description: "Early preview of v3.x"
@@ -102,6 +107,93 @@ When multiple branches are configured:
102107

103108
This is especially useful for projects that maintain multiple active versions simultaneously, such as stable and beta releases.
104109

110+
The optional `exclude_providers` array allows you to specify which cloud providers should be excluded from template generation for particular branches. This is useful when certain features in a branch version may not be compatible with specific cloud providers. Valid provider codes are:
111+
112+
Please check our [current supported provider list here](/docs/docker-to-iac/parser/index.md).
113+
114+
For example, if your beta version uses features only supported in DigitalOcean, you might exclude the other providers:
115+
116+
```yaml
117+
v2-beta:
118+
label: "Beta"
119+
description: "Beta version with DigitalOcean-specific features"
120+
exclude_providers:
121+
- "aws"
122+
- "rnd"
123+
```
124+
125+
If no providers are excluded, templates will be generated for all supported cloud providers.
126+
127+
### Service Connections
128+
129+
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).
130+
131+
| Property | Type | Description | Constraints |
132+
|----------|------|-------------|-------------|
133+
| `mappings` | Array | Defines relationships between services for connection configuration | Required |
134+
| `mappings[].fromService` | String | Service that needs to connect to another service | Required |
135+
| `mappings[].toService` | String | Service being connected to | Required |
136+
| `mappings[].environmentVariables` | Array of Strings | Environment variable names that reference the target service | Required |
137+
138+
Example configuration for service connections:
139+
140+
```yaml
141+
deployment:
142+
branches:
143+
main:
144+
label: "Production"
145+
description: "Production release"
146+
serviceConnections:
147+
mappings:
148+
- fromService: "app"
149+
toService: "db"
150+
environmentVariables:
151+
- "DATABASE_HOST"
152+
- "DATABASE_URL"
153+
property: "connectionString"
154+
- fromService: "frontend"
155+
toService: "api"
156+
environmentVariables:
157+
- "API_URL"
158+
property: "hostport"
159+
```
160+
161+
This configuration tells DeployStack how to properly configure communication between:
162+
163+
- The "app" service and the "db" service through the DATABASE_HOST and DATABASE_URL environment variables
164+
- The "frontend" service and the "api" service through the API_URL environment variable
165+
166+
When templates are generated, DeployStack will transform these environment variables according to each cloud provider's specific service discovery mechanism:
167+
168+
- For Render.com: Uses Blueprint's `fromService` syntax
169+
- For DigitalOcean App Platform: Uses direct service name references
170+
171+
For example, if your docker-compose.yml contains:
172+
173+
```yaml
174+
services:
175+
app:
176+
image: node:alpine
177+
environment:
178+
DATABASE_HOST: db
179+
db:
180+
image: mariadb:latest
181+
```
182+
183+
The generated Render.com template would transform DATABASE_HOST to use their service discovery syntax:
184+
185+
```yaml
186+
services:
187+
- name: app
188+
# ...other configuration...
189+
envVars:
190+
- key: DATABASE_HOST
191+
fromService:
192+
name: db
193+
type: pserv
194+
property: hostport
195+
```
196+
105197
## Schema Validation
106198

107199
The configuration file is automatically validated against our JSON Schema when using supported IDEs (VS Code, IntelliJ, etc.). The schema is available at:
@@ -127,6 +219,41 @@ application:
127219
logo: "https://example.com/logos/redis-manager.png"
128220
```
129221

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

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

docs/docker-to-iac/api.md

Lines changed: 105 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ translate(input: string, options: {
129129
environmentVariableGeneration?: EnvironmentVariableGenerationConfig;
130130
environmentVariables?: Record<string, string>;
131131
persistenceKey?: string;
132+
serviceConnections?: ServiceConnectionsConfig;
132133
}): TranslationResult
133134
```
134135

@@ -139,6 +140,7 @@ interface TranslationResult {
139140
files: {
140141
[path: string]: FileOutput
141142
};
143+
serviceConnections?: ResolvedServiceConnection[];
142144
}
143145

144146
interface FileOutput {
@@ -215,6 +217,45 @@ Object.entries(result.files).forEach(([path, fileData]) => {
215217
});
216218
```
217219

220+
#### Configuring Service Connections
221+
222+
```javascript
223+
import { translate } from '@deploystack/docker-to-iac';
224+
225+
const dockerComposeContent = `
226+
version: "3"
227+
services:
228+
db:
229+
image: mariadb:latest
230+
environment:
231+
- MYSQL_ROOT_PASSWORD=rootpass
232+
app:
233+
image: node:alpine
234+
environment:
235+
- DATABASE_HOST=db # This will be transformed
236+
`;
237+
238+
const result = translate(dockerComposeContent, {
239+
source: 'compose',
240+
target: 'DOP', // DigitalOcean App Platform
241+
templateFormat: 'yaml',
242+
serviceConnections: {
243+
mappings: [
244+
{
245+
fromService: 'app', // Service that needs to connect
246+
toService: 'db', // Service to connect to
247+
environmentVariables: [ // Env vars that reference the service
248+
'DATABASE_HOST'
249+
]
250+
}
251+
]
252+
}
253+
});
254+
255+
// The result will include transformed service references:
256+
console.log(result.serviceConnections);
257+
```
258+
218259
### Example Output (AWS CloudFormation)
219260

220261
```yaml
@@ -373,11 +414,73 @@ const result = translate(dockerConfig, {
373414

374415
#### `options.persistenceKey?: string`
375416

376-
Optional. The `persistenceKey` parameter allows you to maintain consistent variable values across multiple template generations
417+
Optional. The `persistenceKey` parameter allows you to maintain consistent variable values across multiple template generations.
418+
419+
#### `options.serviceConnections?: ServiceConnectionsConfig`
420+
421+
Optional. Configure service-to-service communications by defining which environment variables reference other services.
422+
423+
```typescript
424+
type ServiceConnectionsConfig = {
425+
mappings: Array<{
426+
fromService: string; // Service that needs to connect
427+
toService: string; // Service to connect to
428+
environmentVariables: string[]; // Environment variables that reference the service
429+
property?: string; // Connection property type (connectionString, hostport, etc.)
430+
}>
431+
};
432+
```
433+
434+
This option is currently supported by:
435+
436+
- Render.com (RND): Uses Blueprint's `fromService` syntax
437+
- DigitalOcean App Platform (DOP): Uses direct service names
438+
439+
Example:
440+
441+
```javascript
442+
serviceConnections: {
443+
mappings: [
444+
{
445+
fromService: 'frontend',
446+
toService: 'api',
447+
environmentVariables: ['API_URL'],
448+
property: 'hostport'
449+
},
450+
{
451+
fromService: 'app',
452+
toService: 'db',
453+
environmentVariables: ['DATABASE_URL'],
454+
property: 'connectionString'
455+
}
456+
]
457+
}
458+
```
377459

378460
### Return Value
379461

380-
Returns the translated Infrastructure as Code template in the specified format. The structure and content will vary based on the target IaC language and template format chosen.
462+
Returns the translated Infrastructure as Code template and any resolved service connections:
463+
464+
```typescript
465+
{
466+
files: {
467+
// Generated IaC template files with paths as keys
468+
'render.yaml': { content: '...', format: 'yaml', isMain: true }
469+
},
470+
serviceConnections: [
471+
{
472+
fromService: 'app',
473+
toService: 'db',
474+
variables: {
475+
'DATABASE_HOST': {
476+
originalValue: 'db',
477+
transformedValue: 'db' // Transformed as appropriate for the provider
478+
}
479+
}
480+
}
481+
]
482+
}
483+
```
381484

382485
## List Services API
383486

docs/docker-to-iac/publishing-to-npm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ menuTitle: Publishing to NPM
55

66
# Publishing docker-to-iac module to NPM
77

8-
We have created an organization @deploystack for NPM. Publishing in NPM happens automatically through `semantic-release`. Config: [https://github.com/deploystackio/docker-to-iac/blob/main/.github/workflows/release.yml](https://github.com/deploystackio/docker-to-iac/blob/main/.github/workflows/release.yml)
8+
We have created an organization @deploystack for NPM. Publishing in NPM happens automatically through `semantic-release`. Config: [https://github.com/deploystackio/docker-to-iac/blob/main/.github/workflows/release-pr.yml](https://github.com/deploystackio/docker-to-iac/blob/main/.github/workflows/release-pr.yml)
99

1010
The prerequisite for a release is a successful pull request to the default branch `main`. This means that all tests must first be successfully completed. `semantic-release` creates a new version and automatically publishes the node package to: [https://www.npmjs.com/package/@deploystack/docker-to-iac](https://www.npmjs.com/package/@deploystack/docker-to-iac)
1111

0 commit comments

Comments
 (0)