Skip to content

Commit c1a653c

Browse files
lionellojordanstephensCopilotCopilot
authored
Add docs for new stacks feature (#321)
* add stacks docs * typo * remove tabs from stacks doc Co-authored-by: Copilot <[email protected]> * Update docs/concepts/stacks.md Co-authored-by: Jordan Stephens <[email protected]> * Update docs/concepts/stacks.md * Update docs/concepts/stacks.md Co-authored-by: Jordan Stephens <[email protected]> * Update docs/concepts/stacks.md Co-authored-by: Jordan Stephens <[email protected]> * Update docs/concepts/stacks.md Co-authored-by: Jordan Stephens <[email protected]> * Update docs/concepts/stacks.md Co-authored-by: Copilot <[email protected]> * Update docs/concepts/stacks.md Co-authored-by: Jordan Stephens <[email protected]> * Address unresolved review comments on stacks documentation (#328) * Initial plan * Address unresolved comments on stacks.md documentation Co-authored-by: lionello <[email protected]> * Apply suggestions from code review --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: lionello <[email protected]> Co-authored-by: Lio李歐 <[email protected]> --------- Co-authored-by: Jordan Stephens <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: lionello <[email protected]>
1 parent 241f5d2 commit c1a653c

File tree

2 files changed

+72
-2
lines changed

2 files changed

+72
-2
lines changed

docs/concepts/services.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: Services
3-
description: Defang allows you deploy services, defined as containers, to the cloud.
3+
description: Defang allows you to deploy services, defined as containers, to the cloud.
44
---
55

66
import Tabs from '@theme/Tabs';
77
import TabItem from '@theme/TabItem';
88

99
# Services
1010

11-
Defang allows you deploy services defined as containers. You can define your services using a [Compose file](./compose.md) or a [Pulumi program](./pulumi.md). Services can be exposed to the internet or kept private, and can communicate between themselves using certain conventions for hostnames.
11+
Defang allows you to deploy services defined as containers. You can define your services using a [Compose file](./compose.md) or a [Pulumi program](./pulumi.md). Services can be exposed to the internet or kept private, and can communicate between themselves using certain conventions for hostnames.
1212

1313
### Service Name Resolution
1414

docs/concepts/stacks.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Stacks
3+
description: Defang supports deploying multiple instances of a project as separate stacks.
4+
---
5+
6+
7+
# Stacks
8+
9+
Defang supports deploying multiple instances of a project as separate _stacks_. Each stack represents an isolated deployment of your project. Stacks allow you to manage different deployments of your project. For example, you can use stacks to support distinct development, staging, and production environments in the same cloud account. You can also use stacks to support deployments for different customers (e.g., Client A, Client B) or regions (e.g., North America, Europe) within the same project.
10+
11+
:::info
12+
Stacks is a new feature introduced in Defang CLI v2.4.0 and is currently in preview. We welcome your feedback! Please open an issue on [GitHub](https://github.com/DefangLabs/defang/issues) if you encounter any problems or have suggestions.
13+
:::
14+
15+
## Stack creation
16+
17+
You can create a new stack using the Defang CLI:
18+
19+
```bash
20+
defang stack new [stack-name]
21+
```
22+
23+
This command initializes a new stack. If you don't specify a name, Defang will prompt you to enter one.
24+
25+
After a stack is created, you will notice a new file in your working directory. If your stack was called `production`, you will see a file called `.defang/production`. Defang will never add secrets to this file. We recommend you add this file to your source code repository so you can share it with other contributors.
26+
27+
## Stack deployment
28+
29+
After a stack has been created, you can deploy it independently of others:
30+
31+
```bash
32+
defang up --stack=<stack-name>
33+
```
34+
35+
## Logging
36+
37+
To view logs for a specific stack, use the following command:
38+
39+
```bash
40+
defang logs --stack=<stack-name>
41+
```
42+
43+
or to tail the logs in real-time:
44+
45+
```bash
46+
defang tail --stack=<stack-name>
47+
```
48+
49+
## Listing stacks
50+
51+
This command shows all stacks in your project.
52+
53+
```bash
54+
defang stack list
55+
56+
NAME PROVIDER REGION MODE
57+
production aws us-west-2 BALANCED
58+
```
59+
60+
## Internals
61+
62+
When you create a new stack, Defang creates a new file for that stack in the `.defang` subfolder of your project directory. This file contains all the configuration and state information specific to that stack. Here's an example:
63+
64+
```dotenv
65+
DEFANG_PROVIDER=aws
66+
AWS_REGION=us-west-2
67+
DEFANG_MODE=balanced
68+
```
69+
70+
This file is very similar to `.env` files, but is specific to deployments of your project. This ensures that the values are not leaked into your runtime environment.

0 commit comments

Comments
 (0)