Skip to content

Commit 25bb917

Browse files
authored
Merge pull request #81 from DefangLabs/postgres-docs
Postgres Docs
2 parents d3ccffc + 319492e commit 25bb917

15 files changed

+180
-57
lines changed

docs/concepts/configuration.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,25 @@ defang config set API_KEY
2323

2424
You can use sensitive config by specifying them in the `environment` section of a service in a `compose.yaml` file without any value, or by specifying an environment key with a `null` value in your Pulumi code.
2525

26-
```ts
26+
```yaml
2727
services:
2828
service1:
2929
image: image1:latest
3030
environment:
3131
- API_KEY
3232
```
3333
34+
You can also use this syntax:
35+
36+
37+
```yaml
38+
services:
39+
service1:
40+
image: image1:latest
41+
environment:
42+
API_KEY:
43+
```
44+
3445
Use the `defang config` command of the Defang CLI to manage the values.
3546

3647
## Connecting Services
@@ -45,4 +56,4 @@ You can find a sample of how to set sensitive config values [here](https://githu
4556

4657
Here are the different ways sensitive config values are stored depending on the provider you are using:
4758

48-
* [AWS](../providers/aws.md#secrets)
59+
* [AWS](../providers/aws/aws.md#secrets)

docs/concepts/defang-byoc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Defang does run the Defang build service to build your container images, which t
2121
The Public Beta of the v1 Defang BYOC AWS Provider is released as of Feb 1 2024.
2222
:::
2323

24-
Please read the [AWS Provider](../providers/aws.md) documentation for more details about how the AWS provider works and how to get started.
24+
Please read the [AWS Provider](../providers/aws/aws.md) documentation for more details about how the AWS provider works and how to get started.
2525

2626
## DigitalOcean
2727

docs/concepts/managed-storage.md

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"label": "Managed Storage",
3+
"position": 450,
4+
"collapsible": true
5+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: Managed Object Storage
3+
description: Defang can help you provision managed Redis instances.
4+
sidebar_position: 3000
5+
---
6+
7+
# Managed Object Storage
8+
9+
:::info Not Yet Supported
10+
As of September 2024, Defang does not yet support managed Object Storage, but it is on our roadmap. If you are interested in Object Storage support, please vote on [this issue](https://github.com/DefangLabs/defang/issues/688).
11+
:::
12+
13+
Managed Object Storage, like AWS S3, is a service that allows you to store and retrieve large amounts of data. Object storage is ideal for storing unstructured data like images, videos, and backups.
14+
15+
## Current Support
16+
17+
| Provider | Managed Object Storage |
18+
| --- | --- |
19+
| [Playground](/docs/providers/playground.md) ||
20+
| [AWS](/docs/providers/aws/aws.md) ||
21+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: Managed Postgres
3+
description: Defang can help you provision managed Postgres.
4+
sidebar_position: 1000
5+
---
6+
7+
# Managed Postgres
8+
9+
Postgres, or PostgreSQL, is an advanced open-source relational database system known for its robustness, extensibility, and compliance with SQL standards, making it a popular choice for complex applications requiring reliable data integrity and sophisticated querying capabilities.
10+
11+
## Current Support
12+
13+
| Provider | Managed Postgres |
14+
| --- | --- |
15+
| [Playground](/docs/providers/playground) ||
16+
| [AWS](/docs/providers/aws/aws.md#managed-postgres) ||
17+
18+
## How to use Managed Postgres
19+
20+
To use managed Postgres, in your `compose.yaml` file, use the `x-defang-postgres` extension to define your Postgres service. Adding the extension will tell Defang to provision a managed instance, rather than running Postgres as a service.
21+
22+
### Required Configuration
23+
24+
When using managed Postgres, you **must** set a password for the database using `defang config set POSTGRES_PASSWORD`. If you do not provide the password, the deployment will fail. You can can assign the password in the service's environment variables (to learn more about how this works, read about [configuration](../configuration.md)).
25+
26+
### Optional Configuration
27+
28+
You can also set the following environment variables to configure the managed Postgres instance:
29+
30+
- `POSTGRES_USER`: The user for the managed Postgres instance. The default is `postgres`.
31+
- `POSTGRES_DB`: The database name for the managed Postgres instance. The default is `postgres`.
32+
33+
### Connecting to Managed Postgres
34+
35+
You can connect to the managed Postgres instance using the name of your service as the hostname, `POSTGRES_USER`, `POSTGRES_DB`, and `POSTGRES_PASSWORD` environment variables.
36+
37+
### Example
38+
39+
```yaml
40+
app:
41+
# [...]
42+
environment:
43+
POSTGRES_HOST: database
44+
POSTGRES_USER: postgres
45+
POSTGRES_DB: postgres
46+
// highlight-start
47+
# Note: by leaving the value empty, Defang will use the
48+
# value set using `defang config set POSTGRES_PASSWORD`
49+
POSTGRES_PASSWORD:
50+
// highlight-end
51+
database:
52+
image: postgres:15
53+
x-defang-postgres: true
54+
restart: unless-stopped
55+
ports:
56+
- mode: host
57+
target: 5432
58+
environment:
59+
// highlight-start
60+
# Note: by leaving the value empty, Defang will use the
61+
# value set using `defang config set POSTGRES_PASSWORD`
62+
POSTGRES_PASSWORD:
63+
// highlight-end
64+
65+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Managed Redis
3+
description: Defang can help you provision managed Redis instances.
4+
sidebar_position: 2000
5+
---
6+
7+
# Managed Redis
8+
9+
Redis is an in-memory data structure store widely used for caching, real-time analytics, and session management due to its high performance, low latency, and support for various data types. Defang can help you provision a managed Redis instance.
10+
11+
## Current Support
12+
13+
| Provider | Managed Redis |
14+
| --- | --- |
15+
| [Playground](/docs/providers/playground.md#managed-redis) ||
16+
| [AWS](/docs/providers/aws/aws.md#managed-redis) ||
17+
18+
## How to use Managed Redis
19+
20+
To use managed Redis, in your `compose.yaml` file, use the `x-defang-redis` extension to define your Redis service. Adding the extension will tell Defang to provision a managed instance, rather than running Redis as a service. Defang will use the image tag to determine the version to provision from your cloud provider. Here's an example:
21+
22+
```yaml
23+
cache:
24+
image: redis:6.2
25+
x-defang-redis: true
26+
restart: unless-stopped
27+
ports:
28+
- mode: host
29+
target: 6379
30+
```
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Managed Storage
3+
description: Defang can help you provision managed storage services.
4+
sidebar_position: 000
5+
---
6+
7+
# Managed Storage
8+
9+
Defang helps you provision the infrastructure you need to run your services. That infrastructure is designed to scale in and out without persistent storage, so you can build highly scalable services. But Defang can also help you provision managed services to store and persist your data, like [caches](./managed-redis.md), [databases](./managed-postgres.md), and [object storage](./managed-object-storage.md).
10+

docs/providers/aws/_category_.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"label": "AWS",
3+
"position": 1000,
4+
"collapsible": true
5+
}

docs/providers/aws.md renamed to docs/providers/aws/aws.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: AWS
33
description: Defang allows you to easily create and manage full, scalable applications with AWS.
4-
sidebar_position: 010
4+
sidebar_position: 000
55
---
66

77
# AWS
@@ -50,6 +50,14 @@ To deploy your services, the Defang CLI packages your code and uploads it to an
5050

5151
The provider runs your workloads using ECS using Fargate. It provisions a VPC with public and private subnets, and deploys your services to the private subnets. It then provisions an Application Load Balancer (ALB) and routes traffic to your services.
5252

53+
## Managed Storage
54+
55+
Defang can help you provision [managed storage](/docs/concepts/managed-storage/managed-storage.md) services. The following managed storage services are supported on AWS:
56+
57+
### Managed Postgres
58+
59+
When using [Managed Postgres](/docs/concepts/managed-storage/managed-postgres.md), the Defang CLI provisions an RDS Postgres instance in your account.
60+
5361
### Managed Redis
5462

55-
When using [Managed Redis](../concepts/managed-storage.md#managed-redis), the Defang CLI provisions an ElastiCache Redis cluster in your account.
63+
When using [Managed Redis](/docs/concepts/managed-storage/managed-redis.md), the Defang CLI provisions an ElastiCache Redis cluster in your account.

0 commit comments

Comments
 (0)