Skip to content

Commit 0d420f3

Browse files
committed
initial postgres docs
1 parent 9dfdef7 commit 0d420f3

File tree

2 files changed

+46
-6
lines changed

2 files changed

+46
-6
lines changed

docs/concepts/configuration.md

Lines changed: 12 additions & 1 deletion
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

docs/concepts/managed-storage.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Redis is an in-memory data structure store widely used for caching, real-time an
1919
To use managed Redis, in your `compose.yaml` file, use the `x-defang-redis` extension to define your Redis service. Adding the annotation will tell Defang to provision a managed instance, rather than running Redis as a service. Here's an example:
2020

2121
```yaml
22-
redisx:
22+
cache:
2323
image: redis:6.2
2424
x-defang-redis: true
2525
restart: unless-stopped
@@ -30,12 +30,41 @@ To use managed Redis, in your `compose.yaml` file, use the `x-defang-redis` exte
3030
3131
## Managed Postgres
3232
33-
:::info
34-
As of July 22, 2024, managed Postgres is in development.
35-
:::
36-
3733
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.
3834
35+
### How to use Managed Postgres
36+
37+
To use managed Postgres, in your `compose.yaml` file, use the `x-defang-postgres` extension to define your Postgres service. Adding the annotation will tell Defang to provision a managed instance, rather than running Postgres as a service.
38+
39+
#### Configuration
40+
41+
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 as described in the [config section](./configuration.md).
42+
43+
You can also optionally set the following, using `defang config set`:
44+
45+
* `POSTGRES_USER`: The user for the managed Postgres instance. The default is `postgres`.
46+
* `POSTGRES_DB`: The database name for the managed Postgres instance. The default is `postgres`.
47+
48+
#### Connecting to Managed Postgres
49+
50+
You can connect to the managed Postgres instance using the `POSTGRES_HOST`, `POSTGRES_USER`, and `POSTGRES_PASSWORD` environment variables.
51+
52+
#### Example
53+
54+
```yaml
55+
database:
56+
image: postgres:13
57+
x-defang-postgres: true
58+
restart: unless-stopped
59+
ports:
60+
- mode: host
61+
target: 5432
62+
environment:
63+
// highlight-start
64+
POSTGRES_PASSWORD:
65+
// highlight-end
66+
```
67+
3968
## Managed Object Storage
4069

4170
:::info

0 commit comments

Comments
 (0)